From e1399ced9fe0d9fe515c71c66a6f39ce224b7ed4 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 25 Sep 2024 18:46:56 +0900 Subject: [PATCH 1/5] =?UTF-8?q?Refactor=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20ci=20,=20=EB=B0=B0=ED=8F=AC=20ci=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 13 ++++--------- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 05e2e3b..0178537 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,8 +3,6 @@ name: Docker Image CI on: push: branches: [ "main", "develop" ] - pull_request: - branches: [ "main", "develop" ] jobs: build: @@ -27,21 +25,18 @@ jobs: echo "${{ secrets.APPLICATION_DEV }}" > ./src/main/resources/application-dev.yml echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.yml echo "${{ secrets.APPLICATION_LOCAL }}" > ./src/main/resources/application-local.yml - echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application-test.yml - - name: gradlew 실행 권한 부여 run: chmod +x ./gradlew - - name: 테스트 및 빌드하기 (main 브랜치) + - name: 빌드하기 (main 브랜치) if: github.ref == 'refs/heads/main' - run: ./gradlew clean build -PspringProfile=prod --warning-mode all --scan + run: ./gradlew clean build -x test -PspringProfile=prod --warning-mode all --scan - - name: 테스트 및 빌드하기 (develop 브랜치) + - name: 빌드하기 (develop 브랜치) if: github.ref == 'refs/heads/develop' run: | - ./gradlew clean test -PspringProfile=test - ./gradlew build -x test -PspringProfile=dev --warning-mode all --scan + ./gradlew clean build -x test -PspringProfile=dev --warning-mode all --scan - name: 빌드된 파일 이름 변경 run: mv ./build/libs/*SNAPSHOT.jar ./project.jar diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0891435 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Docker Image CI + +on: + pull_request: + branches: [ "main", "develop" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Github Repository 에 올린 파일들을 볼러오기 + uses: actions/checkout@v4 + + - name: JDK 17 버전 설치 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: application.yml 파일 만들기 + run: | + mkdir -p ./src/main/resources + echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml + echo "${{ secrets.APPLICATION_COMMON }}" > ./src/main/resources/application-common.yml + echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application-test.yml + + + - name: gradlew 실행 권한 부여 + run: chmod +x ./gradlew + + - name: 테스트 + run : ./gradlew clean test -PspringProfile=test + + From 17b93323755550c21982b5c21d33970114c1ae8e Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 25 Sep 2024 19:10:59 +0900 Subject: [PATCH 2/5] =?UTF-8?q?Fix=20:=20=EB=B9=8C=EB=93=9C=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0891435..307dcfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,6 @@ jobs: run: chmod +x ./gradlew - name: 테스트 - run : ./gradlew clean test -PspringProfile=test + run : ./gradlew clean test -PspringProfile=test --no-build-cache From 490719b0742474ed496a2a43cd69776596b42781 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 25 Sep 2024 19:16:04 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Fix=20:=20=EB=A1=9C=EA=B7=B8=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 307dcfc..0172405 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,6 @@ jobs: run: chmod +x ./gradlew - name: 테스트 - run : ./gradlew clean test -PspringProfile=test --no-build-cache + run : ./gradlew clean test -PspringProfile=test --no-build-cache --info From ed897d2afb1684a2d3a03fc6924f9a3dfc6b741c Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Wed, 25 Sep 2024 19:23:51 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Feat=20:=20=20gradle=20package,=20wrapper?= =?UTF-8?q?=20=EC=BA=90=EC=8B=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0172405..c2fd26f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,21 @@ jobs: - name: gradlew 실행 권한 부여 run: chmod +x ./gradlew + - name: Gradle packages 캐시 + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle + + - name: Gradle wrapper 캐시 + uses: actions/cache@v3 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - name: 테스트 - run : ./gradlew clean test -PspringProfile=test --no-build-cache --info + run : ./gradlew clean test -PspringProfile=test --info From 8d58b9c12bde33adb1fdc2d6f2dc15c64d09fa17 Mon Sep 17 00:00:00 2001 From: Donghun Won Date: Mon, 30 Sep 2024 14:09:47 +0900 Subject: [PATCH 5/5] =?UTF-8?q?Fix=20:=20=EA=B0=9C=EB=B0=9C=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=ED=8F=AC=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0178537..d68a02e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,6 +80,6 @@ jobs: mkdir /home/ubuntu/solitour-server/current mv /home/ubuntu/solitour-server/tobe/project.jar /home/ubuntu/solitour-server/current/project.jar cd /home/ubuntu/solitour-server/current - sudo fuser -k -n tcp 8080 || true + sudo fuser -k -n tcp 8081 || true nohup java -jar -Dspring.profiles.active=dev project.jar > ./output.log 2>&1 & rm -rf /home/ubuntu/solitour-server/tobe