-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (89 loc) · 2.99 KB
/
pr_to_develop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: (build, test) Develop branch when PR to develop
# develop 브런치에 push가 되면 아래의 flow가 실행됩니다.
on:
pull_request:
branches: [ "develop" ]
# flow에서 사용할 변수
env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: nanaland-github-actions-s3-bucket
CODE_DEPLOY_APPLICATION_NAME: nanaland-codedeploy-app
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: nanaland-codedeploy-deployment-group
permissions: write-all
jobs:
test:
runs-on: ubuntu-latest
environment: production
steps:
# 1) 기본 체크아웃
- name: Checkout
uses: actions/checkout@v4
# 2) JDK 17 셋팅
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# 2.5) secret설정한 test yml 등록
- name: Set Test YML
run: |
mkdir -p src/main/resources
echo "${{ secrets.TEST_YML }}" | base64 --decode > src/main/resources/application-test.yml
find src
# 2.7) caching을 사용한 속도 향상
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# 3) gradlew 권한 설정
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: SPRING_PROFILES_ACTIVE=[test] ./gradlew test -i
# 테스트 결과 확인하기
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ always() }}
with:
files: build/test-results/**/*.xml
# cache 관련 파일 제거
- name: Cleanup Gradle Cache
if: ${{ always() }}
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
build:
runs-on: ubuntu-latest
environment: production
steps:
# 1) 기본 체크아웃
- name: Checkout
uses: actions/checkout@v4
# 2) JDK 17 셋팅
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# 2.5) secret설정한 yml 등록
- name: Set YML
run: |
mkdir -p src/main/resources
echo "${{ secrets.YML }}" | base64 --decode > src/main/resources/application.yml
find src
# # 4) gradle 테스트 빌드
# - name: Build Test with Gradle
# run: ./gradlew test -i
# # run: ./gradlew clean build -i
# # working-directory: ${{ env.working-directory }}
# 3) gradlew 권한 설정
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# 4) gradle 빌드
- name: Build with Gradle
run: ./gradlew clean build -x test -i