Skip to content

Commit

Permalink
Merge branch 'be/dev/cron' of github.com:innovationacademy-kr/Cabi in…
Browse files Browse the repository at this point in the history
…to be/dev/cron
  • Loading branch information
leedonggyu1848 committed Mar 10, 2024
2 parents e17a5dc + 9c067e9 commit 0a3596a
Show file tree
Hide file tree
Showing 23 changed files with 1,116 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/cron-cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: backend CI

on:
push:
paths:
- "cron/**"
pull_request:
paths:
- "cron/**"
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Make ssh file
run: |
mkdir -p ~/.ssh
echo '${{ secrets.SSH_CONFIG }}' | base64 -d > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Checkout
uses: actions/checkout@v3
with:
submodule: true
- name: Update submodule
run: |
git submodule update --init config/
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "corretto"
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: |
cd cron
chmod +x gradlew
./gradlew jar
shell: bash
- name: Main S3에 업로드
if: ${{ github.ref == 'refs/heads/main' }}
run: |
cp cron/build/libs/cron-*.jar deploy-cron/build
mkdir -p deploy && cp deploy-cron/* deploy/
zip -r deploy.zip deploy
aws s3 cp deploy.zip s3://${{ secrets.AWS_S3_MAIN_BUCKET_NAME }}/deploy.zip
aws deploy create-deployment \
--application-name ${{ secrets.AWS_CODEDEPLOY_MAIN_APP_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ secrets.AWS_CODEDEPLOY_MAIN_GROUP_NAME }} \
--file-exists-behavior OVERWRITE \
--s3-location bucket=${{ secrets.AWS_S3_MAIN_BUCKET_NAME }},bundleType=zip,key=deploy.zip
44 changes: 44 additions & 0 deletions cron/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store

**/resources/config/**
68 changes: 68 additions & 0 deletions cron/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.9.0'
id 'application'
}
ext {
jacksonVersion = '2.15.2'
okhttpVersion = '2.7.5'
exposedVersion = '0.41.1'
mariadbVersion = "3.1.4"
h2Version = "2.2.220"
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.squareup.okhttp:okhttp:${okhttpVersion}"
implementation "org.jetbrains.exposed:exposed-core:${exposedVersion}"
implementation "org.jetbrains.exposed:exposed-dao:${exposedVersion}"
implementation "org.jetbrains.exposed:exposed-jdbc:${exposedVersion}"
implementation "org.jetbrains.exposed:exposed-java-time:${exposedVersion}"
runtimeOnly "org.mariadb.jdbc:mariadb-java-client:${mariadbVersion}"
implementation "com.zaxxer:HikariCP:5.0.1"
implementation "io.github.microutils:kotlin-logging-jvm:2.0.10"
implementation "org.slf4j:slf4j-api:1.7.30"
implementation "org.slf4j:slf4j-simple:1.7.25"

testImplementation "org.jetbrains.kotlin:kotlin-test"
testRuntimeOnly "com.h2database:h2:${h2Version}"
}

tasks.register('copyMainConfig', Copy) {
from '../config/cron/src/resources/config'
into 'src/main/resources/config'
}

tasks.named('processResources') {
dependsOn 'copyMainConfig'
}

test {
useJUnitPlatform()
}

kotlin {
jvmToolchain(17)
}

application {
mainClass.set("MainKt")
}

jar {
manifest {
attributes 'Main-Class': 'MainKt'
}
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
1 change: 1 addition & 0 deletions cron/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file added cron/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions cron/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0a3596a

Please sign in to comment.