Skip to content

Commit 9cbadb1

Browse files
committed
feat: ci/cd 개선
1 parent 0592b00 commit 9cbadb1

1 file changed

Lines changed: 65 additions & 48 deletions

File tree

.github/workflows/android.yml

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,48 @@ on:
88
permissions:
99
contents: write
1010

11+
# 워크플로우 최적화
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1116
jobs:
1217
build:
13-
1418
runs-on: ubuntu-latest
19+
20+
# 빌드 캐시 설정
21+
env:
22+
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
1523

1624
steps:
1725
- uses: actions/checkout@v4
18-
- name: set up JDK 17
26+
27+
- name: Set up JDK 17
1928
uses: actions/setup-java@v4
2029
with:
2130
java-version: '17'
2231
distribution: 'temurin'
2332
cache: gradle
33+
34+
- name: Setup Gradle Cache
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.gradle/caches
39+
~/.gradle/wrapper
40+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
41+
restore-keys: |
42+
${{ runner.os }}-gradle-
43+
44+
- name: Setup Android SDK Cache
45+
uses: actions/cache@v4
46+
with:
47+
path: |
48+
~/.android/build-cache
49+
~/.android/cache
50+
key: ${{ runner.os }}-android-${{ hashFiles('**/gradle.properties', '**/local.properties') }}
51+
restore-keys: |
52+
${{ runner.os }}-android-
2453
2554
- name: Grant execute permission for gradlew
2655
run: chmod +x gradlew
@@ -117,17 +146,15 @@ jobs:
117146
echo "version_code=$VERSION_CODE" >> $GITHUB_OUTPUT
118147
echo "Extracted version: $VERSION_NAME ($VERSION_CODE)"
119148
120-
- name: Get timestamp
121-
id: timestamp
122-
run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
149+
123150
124151
- name: Build with Gradle
125-
run: ./gradlew build
152+
run: ./gradlew build --parallel --max-workers=2 --daemon
126153

127154
- name: Build Release APK
128155
run: |
129156
echo "Starting assembleRelease..."
130-
./gradlew assembleRelease --info --stacktrace
157+
./gradlew assembleRelease --parallel --max-workers=2 --daemon --info --stacktrace
131158
echo "assembleRelease completed with exit code: $?"
132159
echo "Checking if APK was generated..."
133160
if [ -f "app/build/outputs/apk/release/app-release.apk" ]; then
@@ -199,45 +226,35 @@ jobs:
199226
200227
APK: Prod Release Version
201228
202-
- name: action-slack
203-
uses: 8398a7/action-slack@v3
204-
with:
205-
status: ${{ job.status }}
206-
author_name: RunCombi Android CI
207-
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
208-
if_mention: failure,cancelled
209-
custom_payload: |
210-
{
211-
"attachments": [{
212-
"color": "${{ job.status == 'success' && '#36a64f' || '#ff0000' }}",
213-
"title": "🎉 RunCombi Android 빌드 완료",
214-
"fields": [
215-
{
216-
"title": "📱 앱 버전",
217-
"value": "v${{ steps.app_version.outputs.version_name }} (${{ steps.app_version.outputs.version_code }})",
218-
"short": true
219-
},
220-
{
221-
"title": "🔗 PR 제목",
222-
"value": "${{ github.event.pull_request.title }}",
223-
"short": true
224-
},
225-
{
226-
"title": "📝 PR 내용",
227-
"value": "${{ github.event.pull_request.body || '내용이 없습니다.' }}",
228-
"short": false
229-
},
230-
{
231-
"title": "🚀 GitHub Release",
232-
"value": "https://github.com/${{ github.repository }}/releases/tag/v${{ steps.app_version.outputs.version_name }}",
233-
"short": false
234-
}
235-
],
236-
"footer": "RunCombi Android CI",
237-
"ts": "${{ env.TIMESTAMP }}"
238-
}]
239-
}
229+
- name: If Success, Send notification on Slack
230+
if: ${{success()}}
231+
uses: rtCamp/action-slack-notify@v2
232+
env:
233+
SLACK_COLOR: '#60E0C5'
234+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
235+
SLACK_TITLE: 'RunCombi Android 빌드 성공 ✅'
236+
MSG_MINIMAL: true
237+
SLACK_USERNAME: RunCombi Android CI
238+
SLACK_MESSAGE: |
239+
🎉 RunCombi Android 빌드 성공!
240+
241+
📱 **앱 버전**: v${{ steps.app_version.outputs.version_name }} (${{ steps.app_version.outputs.version_code }})
242+
🔗 **PR 제목**: ${{ github.event.pull_request.title }}
243+
📝 **PR 내용**: ${{ github.event.pull_request.body || '내용이 없습니다.' }}
244+
🚀 **GitHub Release**: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.app_version.outputs.version_name }}
245+
246+
- name: If Fail, Send notification on Slack
247+
if: ${{failure()}}
248+
uses: rtCamp/action-slack-notify@v2
240249
env:
241-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
242-
TIMESTAMP: ${{ steps.timestamp.outputs.timestamp }}
243-
if: always()
250+
SLACK_COLOR: '#ff0000'
251+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
252+
SLACK_TITLE: 'RunCombi Android 빌드 실패 ❌'
253+
MSG_MINIMAL: true
254+
SLACK_USERNAME: RunCombi Android CI
255+
SLACK_MESSAGE: |
256+
❌ RunCombi Android 빌드 실패 - 확인이 필요합니다!
257+
258+
📱 **앱 버전**: v${{ steps.app_version.outputs.version_name }} (${{ steps.app_version.outputs.version_code }})
259+
🔗 **PR 제목**: ${{ github.event.pull_request.title }}
260+
📝 **PR 내용**: ${{ github.event.pull_request.body || '내용이 없습니다.' }}

0 commit comments

Comments
 (0)