@@ -182,10 +182,12 @@ jobs:
182
182
183
183
- name : Check turborepo cache for Android
184
184
run : |
185
- TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
185
+ TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.taskId === 'paper#build:android').cache.status")
186
+ TURBO_HASH=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.taskId === 'paper#build:android').hash")
186
187
187
188
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
188
189
echo "turbo_cache_hit=1" >> $GITHUB_ENV
190
+ echo "turbo_hash=$TURBO_HASH" >> $GITHUB_ENV
189
191
fi
190
192
191
193
- name : Install JDK
@@ -233,16 +235,19 @@ jobs:
233
235
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --concurrency 1
234
236
235
237
- name : Cache apk
238
+ if : env.turbo_cache_hit != 1
236
239
uses : actions/cache/save@v3
237
240
env :
238
241
cache-name : cache-apk
239
242
with :
240
243
path : apps/paper/android/app/build/outputs/apk/debug/app-debug.apk
241
- key : apk-${{ github.sha }}
244
+ key : apk-${{ env.turbo_hash }}
242
245
243
246
test-android :
244
247
needs : build-android
245
248
runs-on : macos-latest-large
249
+ env :
250
+ TURBO_CACHE_DIR : .turbo/android
246
251
strategy :
247
252
matrix :
248
253
working-directory : [apps/paper]
@@ -256,13 +261,21 @@ jobs:
256
261
uses : ./.github/actions/setup
257
262
with :
258
263
github_token : ${{ secrets.GITHUB_TOKEN }}
259
-
264
+
265
+ - name : Check turborepo cache for Android
266
+ run : |
267
+ TURBO_HASH=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.taskId === 'paper#build:android').hash")
268
+
269
+ if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
270
+ echo "turbo_hash=$TURBO_HASH" >> $GITHUB_ENV
271
+ fi
272
+
260
273
- name : Restore APK
261
274
id : cache-apk
262
275
uses : actions/cache/restore@v3
263
276
with :
264
277
path : ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
265
- key : apk-${{ github.sha }}
278
+ key : apk-${{ env.turbo_hash }}
266
279
267
280
- name : SKDs - download required images
268
281
run : $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-30;default;x86_64"
0 commit comments