Skip to content

Commit e873380

Browse files
committed
fix: caching
1 parent 2a795ea commit e873380

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,25 @@ jobs:
8383
java-version: '17'
8484
distribution: 'temurin'
8585

86-
- name: Cache APK
87-
id: cache-apk
88-
uses: actions/cache@v4
86+
- name: Restore APK from cache
87+
id: cache-apk-restore
88+
uses: actions/cache/restore@v4
8989
with:
9090
path: apps/${{ matrix.app }}/android/app/build/outputs/apk/debug/app-debug.apk
9191
key: apk-${{ matrix.app }}
9292

9393
- name: Build Android app
94-
if: steps.cache-apk.outputs.cache-hit != 'true'
94+
if: steps.cache-apk-restore.outputs.cache-hit != 'true'
9595
working-directory: apps/${{ matrix.app }}
9696
run: |
97-
pnpm nx run @react-native-harness/${{ matrix.app }}:build-android
97+
pnpm nx run @react-native-harness/${{ matrix.app }}:build-android --tasks=assembleDebug
98+
99+
- name: Save APK to cache
100+
if: steps.cache-apk-restore.outputs.cache-hit != 'true' && success()
101+
uses: actions/cache/save@v4
102+
with:
103+
path: apps/${{ matrix.app }}/android/app/build/outputs/apk/debug/app-debug.apk
104+
key: apk-${{ matrix.app }}
98105

99106
- name: Enable KVM group perms
100107
run: |
@@ -103,17 +110,17 @@ jobs:
103110
sudo udevadm trigger --name-match=kvm
104111
ls /dev/kvm
105112
106-
- name: AVD cache
107-
uses: actions/cache@v4
108-
id: avd-cache
113+
- name: Restore AVD from cache
114+
id: avd-cache-restore
115+
uses: actions/cache/restore@v4
109116
with:
110117
path: |
111118
~/.android/avd/*
112119
~/.android/adb*
113120
key: avd-${{ matrix.app }}
114121

115122
- name: Create AVD and generate snapshot for caching
116-
if: steps.avd-cache.outputs.cache-hit != 'true'
123+
if: steps.avd-cache-restore.outputs.cache-hit != 'true'
117124
uses: reactivecircus/android-emulator-runner@v2
118125
with:
119126
working-directory: apps/${{ matrix.app }}/android
@@ -128,6 +135,15 @@ jobs:
128135
script: |
129136
echo "Generated AVD and snapshot for caching"
130137
138+
- name: Save AVD to cache
139+
if: steps.avd-cache-restore.outputs.cache-hit != 'true' && success()
140+
uses: actions/cache/save@v4
141+
with:
142+
path: |
143+
~/.android/avd/*
144+
~/.android/adb*
145+
key: avd-${{ matrix.app }}
146+
131147
- name: Run E2E tests
132148
uses: reactivecircus/android-emulator-runner@v2
133149
with:

0 commit comments

Comments
 (0)