|
35 | 35 | runs-on: ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg |
36 | 36 | env: |
37 | 37 | GRADLE_USER_HOME: /home/admin/_work/.gradle |
| 38 | + CACHE_GENERATION: v1 # Increment this to bust the cache (v1, v2, v3, etc.) |
38 | 39 | outputs: |
39 | 40 | apk-uploaded: ${{ steps.upload-apk.outcome == 'success' }} |
40 | 41 | aab-uploaded: ${{ steps.upload-aab.outcome == 'success' }} |
@@ -63,16 +64,14 @@ jobs: |
63 | 64 |
|
64 | 65 | - name: Cache Gradle dependencies |
65 | 66 | uses: cirruslabs/cache@v4 |
| 67 | + id: gradle-cache-restore |
| 68 | + env: |
| 69 | + GRADLE_CACHE_VERSION: 1 |
66 | 70 | with: |
67 | 71 | path: | |
68 | | - /home/runner/_work/.gradle/caches |
69 | | - /home/runner/_work/.gradle/wrapper |
70 | | - /home/admin/_work/.gradle/caches |
71 | | - /home/admin/_work/.gradle/wrapper |
72 | | - android/.gradle |
73 | | - key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
74 | | - restore-keys: | |
75 | | - gradle-${{ runner.os }}- |
| 72 | + ~/_work/.gradle/caches |
| 73 | + ~/_work/.gradle/wrapper |
| 74 | + key: gradle-${{ env.GRADLE_CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
76 | 75 |
|
77 | 76 | - name: Setup project dependencies with retry |
78 | 77 | uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2 |
@@ -115,24 +114,24 @@ jobs: |
115 | 114 | fi |
116 | 115 |
|
117 | 116 | - name: Check and restore cached APKs if Fingerprint is found |
118 | | - id: cache-restore |
| 117 | + id: apk-cache-restore |
119 | 118 | uses: cirruslabs/cache@v4 |
120 | 119 | with: |
121 | 120 | path: | |
122 | 121 | ${{ steps.determine-target-paths.outputs.apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}.apk |
123 | 122 | ${{ steps.determine-target-paths.outputs.test-apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}-androidTest.apk |
124 | 123 | ${{ steps.determine-target-paths.outputs.aab-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}.aab |
125 | | - key: android-apk-${{ inputs.build_type }}-${{ steps.generate-fingerprint.outputs.fingerprint }} |
| 124 | + key: android-apk-${{ inputs.build_type }}-${{ env.CACHE_GENERATION }}-${{ steps.generate-fingerprint.outputs.fingerprint }} |
126 | 125 | restore-keys: | |
127 | | - android-apk-${{ inputs.build_type }}- |
| 126 | + android-apk-${{ inputs.build_type }}-${{ env.CACHE_GENERATION }}- |
128 | 127 | android-apk- |
129 | 128 |
|
130 | 129 | - name: Build Android E2E APKs |
131 | | - if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} |
| 130 | + if: ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' || steps.gradle-cache-restore.outputs.cache-hit != 'true' }} |
132 | 131 | run: | |
133 | 132 | echo "🏗 Building Android E2E APKs..." |
134 | 133 | export NODE_OPTIONS="--max-old-space-size=8192" |
135 | | - # cp android/gradle.properties.github android/gradle.properties - Build for all apps to stabilize e2e |
| 134 | + cp android/gradle.properties.github android/gradle.properties |
136 | 135 | yarn build:android:${{ inputs.build_type }}:e2e |
137 | 136 | shell: bash |
138 | 137 | env: |
@@ -179,7 +178,7 @@ jobs: |
179 | 178 | MM_INFURA_PROJECT_ID: ${{ secrets.MM_INFURA_PROJECT_ID }} |
180 | 179 |
|
181 | 180 | - name: Repack APK with JS updates using @expo/repack-app |
182 | | - if: ${{ steps.cache-restore.outputs.cache-hit == 'true' }} |
| 181 | + if: ${{ steps.apk-cache-restore.outputs.cache-hit == 'true' && steps.gradle-cache-restore.outputs.cache-hit == 'true' }} |
183 | 182 | run: | |
184 | 183 | echo "📦 Repacking APK with updated JavaScript bundle using @expo/repack-app..." |
185 | 184 | # Use the optimized repack script which uses @expo/repack-app |
@@ -230,14 +229,14 @@ jobs: |
230 | 229 |
|
231 | 230 | # Cache build artifacts with the pre-build fingerprint |
232 | 231 | - name: Cache build artifacts |
233 | | - if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} |
| 232 | + if: ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' || steps.gradle-cache-restore.outputs.cache-hit != 'true' }} |
234 | 233 | uses: cirruslabs/cache@v4 |
235 | 234 | with: |
236 | 235 | path: | |
237 | 236 | ${{ steps.determine-target-paths.outputs.apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}.apk |
238 | 237 | ${{ steps.determine-target-paths.outputs.test-apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}-androidTest.apk |
239 | 238 | ${{ steps.determine-target-paths.outputs.aab-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}.aab |
240 | | - key: android-apk-${{ inputs.build_type }}-${{ steps.generate-fingerprint.outputs.fingerprint }} |
| 239 | + key: android-apk-${{ inputs.build_type }}-${{ env.CACHE_GENERATION }}-${{ steps.generate-fingerprint.outputs.fingerprint }} |
241 | 240 |
|
242 | 241 | - name: Upload Android APK |
243 | 242 | id: upload-apk |
|
0 commit comments