Skip to content

Commit

Permalink
Merge pull request #80 from Travel-in-nanaland/feat/#47-ci-cd
Browse files Browse the repository at this point in the history
[#47] feat: workflow 수정
  • Loading branch information
Te-H0 authored Apr 24, 2024
2 parents 0dd54c2 + 6a9fb54 commit 2ead457
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 77 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/deploy.yml → .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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/[email protected]
Expand All @@ -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/[email protected]
# 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 }}

Expand Down
110 changes: 55 additions & 55 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
# 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 }}

0 comments on commit 2ead457

Please sign in to comment.