From 6a9fb54730b29209c636eee6837107572c1b437f Mon Sep 17 00:00:00 2001 From: teho Date: Wed, 24 Apr 2024 21:29:48 +0900 Subject: [PATCH] =?UTF-8?q?[#47]=20feat:=20workflow=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{deploy.yml => gradle.yml} | 33 ++---- .github/workflows/test.yml | 110 +++++++++---------- 2 files changed, 66 insertions(+), 77 deletions(-) rename .github/workflows/{deploy.yml => gradle.yml} (76%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/gradle.yml similarity index 76% rename from .github/workflows/deploy.yml rename to .github/workflows/gradle.yml index 6f8f19dd..216a2ed3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/gradle.yml @@ -1,11 +1,9 @@ -name: deploy +name: Java CI with Gradle & Deploy to EC2 # develop 브런치에 push가 되면 아래의 flow가 실행됩니다. on: - workflow_run: - workflows: [ "test" ] - types: - - completed + push: + branches: [ "develop" ] # flow에서 사용할 변수 env: @@ -44,6 +42,12 @@ jobs: echo "${{ secrets.YML }}" | base64 --decode > src/main/resources/application.yml find src + # 2.5) secret설정한 test-yml 등록 + - name: Set TEST_YML + run: | + mkdir -p src/test/resources + echo "${{ secrets.TEST_YML }}" | base64 --decode > src/test/resources/application-test.yml + find src - name: Set up MariaDB 10 uses: getong/mariadb-action@v1.1 @@ -55,30 +59,15 @@ jobs: mysql password: ${{ secrets.DATABASE_KEY }} # mysql root password: ${{ secrets.RootPassword }} # Required if "mysql user" is empty, default is empty. The root superuser password - # - name: Set TEST_YML - # run: | - # mkdir -p src/test/resources - # echo "${{ secrets.TEST_YML }}" | base64 --decode > src/test/resources/application.yml - # find src - - # - name: Set up MariaDB 10 for test - # uses: getong/mariadb-action@v1.1 - # with: - # host port: 3306 - # container port: 3307 - # mysql database: 'nanaland_test' - # mysql user: 'root' - # mysql password: ${{ secrets.DATABASE_KEY }} - # # mysql root password: ${{ secrets.RootPassword }} # Required if "mysql user" is empty, default is empty. The root superuser password # 3) gradlew 권한 설정 - name: Grant execute permission for gradlew run: chmod +x gradlew - # working-directory: ${{ env.working-directory }} + # working-directory: ${{ env.working-directory }} # 4) gradle 빌드 - name: Build with Gradle - run: ./gradlew clean build -x test -i + run: ./gradlew clean build -i # run: ./gradlew clean build -i # working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27e42837..8ef601be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,55 +1,55 @@ -name: test - -# develop 브런치에 push가 되면 아래의 flow가 실행됩니다. -on: - push: - branches: [ "develop" ] - -permissions: - contents: read - -jobs: - deploy: - name: test - runs-on: ubuntu-latest - environment: production - - # 아래의 flow들이 차례대로 실행됩니다. - steps: - # 1) 기본 체크아웃 - - name: Checkout - uses: actions/checkout@v3 - - # 2) JDK 17 셋팅 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - # 2.5) secret설정한 test-yml 등록 - - name: Set TEST_YML - run: | - mkdir -p src/test/resources - echo "${{ secrets.TEST_YML }}" | base64 --decode > src/test/resources/application-test.yml - find src - - - name: Set up MariaDB 10 - uses: getong/mariadb-action@v1.1 - with: - host port: 3306 - container port: 3306 - mysql database: 'nanaland_test' - mysql user: 'root' - mysql password: ${{ secrets.DATABASE_KEY }} - - # 3) gradlew 권한 설정 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - # working-directory: ${{ env.working-directory }} - - # 4) gradle 빌드 - - name: Build with Gradle - run: ./gradlew clean test -i - # run: ./gradlew clean build -i - # working-directory: ${{ env.working-directory }} +#name: test +# +## develop 브런치에 push가 되면 아래의 flow가 실행됩니다. +#on: +# push: +# branches: [ "develop" ] +# +#permissions: +# contents: read +# +#jobs: +# deploy: +# name: test +# runs-on: ubuntu-latest +# environment: production +# +# # 아래의 flow들이 차례대로 실행됩니다. +# steps: +# # 1) 기본 체크아웃 +# - name: Checkout +# uses: actions/checkout@v3 +# +# # 2) JDK 17 셋팅 +# - name: Set up JDK 17 +# uses: actions/setup-java@v3 +# with: +# java-version: '17' +# distribution: 'temurin' +# +# # 2.5) secret설정한 test-yml 등록 +# - name: Set TEST_YML +# run: | +# mkdir -p src/test/resources +# echo "${{ secrets.TEST_YML }}" | base64 --decode > src/test/resources/application-test.yml +# find src +# +# - name: Set up MariaDB 10 +# uses: getong/mariadb-action@v1.1 +# with: +# host port: 3306 +# container port: 3306 +# mysql database: 'nanaland_test' +# mysql user: 'root' +# mysql password: ${{ secrets.DATABASE_KEY }} +# +# # 3) gradlew 권한 설정 +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# # working-directory: ${{ env.working-directory }} +# +# # 4) gradle 빌드 +# - name: Build with Gradle +# run: ./gradlew clean test -i +# # run: ./gradlew clean build -i +# # working-directory: ${{ env.working-directory }}