Skip to content

Commit 7306636

Browse files
committed
[NDGL-108] chore: CI 워크플로우를 병렬 실행 및 재사용 가능한 구조로 개선
1 parent 93de905 commit 7306636

2 files changed

Lines changed: 82 additions & 39 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI Setup
2+
description: Common setup steps for CI jobs
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup Gradle
8+
uses: gradle/actions/setup-gradle@v4
9+
with:
10+
gradle-home-cache-cleanup: true
11+
12+
- name: Set up JDK 21
13+
uses: actions/setup-java@v4
14+
with:
15+
java-version: '21'
16+
distribution: 'temurin'
17+
18+
- name: Grant execute permission for gradlew
19+
run: chmod +x gradlew
20+
shell: bash
21+
22+
- name: Download config files
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: config-files

.github/workflows/android_ci.yml

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,65 @@ on:
66
pull_request:
77
branches: [ "develop" ]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
14+
setup:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up local.properties
21+
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > local.properties
22+
23+
- name: Set up keystore
24+
run: |
25+
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/ndgl.keystore
26+
echo "KEYSTORE_PATH=../app/ndgl.keystore" >> local.properties
27+
echo "KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}" >> local.properties
28+
echo "KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }}" >> local.properties
29+
echo "KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> local.properties
30+
echo "NDGL_BASE_URL_DEBUG=${{ secrets.NDGL_BASE_URL_DEBUG }}" >> local.properties
31+
echo "NDGL_BASE_URL_RELEASE=${{ secrets.NDGL_BASE_URL_RELEASE }}" >> local.properties
32+
33+
- name: Set up google-services.json
34+
run: |
35+
mkdir -p app/src/debug app/src/release
36+
echo '${{ secrets.GOOGLE_SERVICES_DEBUG }}' | base64 -d > app/src/debug/google-services.json
37+
echo '${{ secrets.GOOGLE_SERVICES_RELEASE }}' | base64 -d > app/src/release/google-services.json
38+
39+
- name: Upload config files
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: config-files
43+
retention-days: 1
44+
path: |
45+
local.properties
46+
app/ndgl.keystore
47+
app/src/debug/google-services.json
48+
app/src/release/google-services.json
49+
50+
lint:
51+
needs: setup
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: ./.github/actions/ci-setup
57+
58+
- name: Code style checks
59+
run: ./gradlew ktlintCheck detekt --build-cache --parallel
60+
1061
build:
62+
needs: setup
1163
runs-on: ubuntu-latest
1264

1365
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Setup Gradle
17-
uses: gradle/actions/setup-gradle@v4
18-
with:
19-
gradle-home-cache-cleanup: true
20-
21-
- name: Set up JDK 21
22-
uses: actions/setup-java@v4
23-
with:
24-
java-version: '21'
25-
distribution: 'temurin'
26-
27-
- name: Grant execute permission for gradlew
28-
run: chmod +x gradlew
29-
30-
- name: Set up local.properties
31-
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > local.properties
32-
33-
- name: Set up keystore
34-
run: |
35-
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/ndgl.keystore
36-
echo "KEYSTORE_PATH=../app/ndgl.keystore" >> local.properties
37-
echo "KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}" >> local.properties
38-
echo "KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }}" >> local.properties
39-
echo "KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> local.properties
40-
echo "NDGL_BASE_URL_DEBUG=${{ secrets.NDGL_BASE_URL_DEBUG }}" >> local.properties
41-
echo "NDGL_BASE_URL_RELEASE=${{ secrets.NDGL_BASE_URL_RELEASE }}" >> local.properties
42-
43-
- name: Set up google-services.json
44-
run: |
45-
echo '${{ secrets.GOOGLE_SERVICES_DEBUG }}' | base64 -d > app/src/debug/google-services.json
46-
echo '${{ secrets.GOOGLE_SERVICES_RELEASE }}' | base64 -d > app/src/release/google-services.json
47-
48-
- name: Code style checks
49-
run: ./gradlew ktlintCheck detekt
50-
51-
- name: Run build
52-
run: ./gradlew assembleDebug --stacktrace
66+
- uses: actions/checkout@v4
67+
- uses: ./.github/actions/ci-setup
68+
69+
- name: Run build
70+
run: ./gradlew assembleDebug --build-cache --parallel --stacktrace

0 commit comments

Comments
 (0)