|
8 | 8 | permissions: |
9 | 9 | contents: write |
10 | 10 |
|
| 11 | +# 워크플로우 최적화 |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
11 | 16 | jobs: |
12 | 17 | build: |
13 | | - |
14 | 18 | 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 |
15 | 23 |
|
16 | 24 | steps: |
17 | 25 | - uses: actions/checkout@v4 |
18 | | - - name: set up JDK 17 |
| 26 | + |
| 27 | + - name: Set up JDK 17 |
19 | 28 | uses: actions/setup-java@v4 |
20 | 29 | with: |
21 | 30 | java-version: '17' |
22 | 31 | distribution: 'temurin' |
23 | 32 | 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- |
24 | 53 |
|
25 | 54 | - name: Grant execute permission for gradlew |
26 | 55 | run: chmod +x gradlew |
@@ -117,17 +146,15 @@ jobs: |
117 | 146 | echo "version_code=$VERSION_CODE" >> $GITHUB_OUTPUT |
118 | 147 | echo "Extracted version: $VERSION_NAME ($VERSION_CODE)" |
119 | 148 |
|
120 | | - - name: Get timestamp |
121 | | - id: timestamp |
122 | | - run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT |
| 149 | +
|
123 | 150 |
|
124 | 151 | - name: Build with Gradle |
125 | | - run: ./gradlew build |
| 152 | + run: ./gradlew build --parallel --max-workers=2 --daemon |
126 | 153 |
|
127 | 154 | - name: Build Release APK |
128 | 155 | run: | |
129 | 156 | echo "Starting assembleRelease..." |
130 | | - ./gradlew assembleRelease --info --stacktrace |
| 157 | + ./gradlew assembleRelease --parallel --max-workers=2 --daemon --info --stacktrace |
131 | 158 | echo "assembleRelease completed with exit code: $?" |
132 | 159 | echo "Checking if APK was generated..." |
133 | 160 | if [ -f "app/build/outputs/apk/release/app-release.apk" ]; then |
@@ -199,45 +226,35 @@ jobs: |
199 | 226 | |
200 | 227 | APK: Prod Release Version |
201 | 228 |
|
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 |
240 | 249 | 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