Skip to content

Commit 263fbc0

Browse files
authored
dataconnect: improve cache restoration in github actions workflow (#6697)
1 parent caed74c commit 263fbc0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

.github/workflows/dataconnect.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ jobs:
7373
npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }}
7474
7575
- name: Restore Gradle cache
76+
id: restore-gradle-cache
7677
uses: actions/cache/restore@v4
7778
if: github.event_name != 'schedule'
7879
with:
7980
path: |
8081
~/.gradle/caches
8182
~/.gradle/wrapper
82-
key: gradle-cache-jqnvfzw6w7
83+
key: gradle-cache-jqnvfzw6w7-${{ github.run_id }}
84+
restore-keys: |
85+
gradle-cache-jqnvfzw6w7-
8386
8487
- name: tool versions
8588
continue-on-error: true
@@ -121,7 +124,7 @@ jobs:
121124
path: |
122125
~/.gradle/caches
123126
~/.gradle/wrapper
124-
key: gradle-cache-jqnvfzw6w7-${{ github.run_id }}
127+
key: ${{ steps.restore-gradle-cache.outputs.cache-primary-key }}
125128

126129
- name: Enable KVM group permissions for Android Emulator
127130
run: |
@@ -133,24 +136,24 @@ jobs:
133136
- name: Restore AVD cache
134137
uses: actions/cache/restore@v4
135138
if: github.event_name != 'schedule'
136-
id: avd-cache
139+
id: restore-avd-cache
137140
with:
138141
path: |
139142
~/.android/avd/*
140143
~/.android/adb*
141-
key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
142-
143-
- run: echo "github.event_name == '${{ github.event_name }}' steps.avd-cache.outputs.cache-hit == '${{ steps.avd-cache.outputs.cache-hit }}'"
144+
key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
145+
restore-keys: |
146+
avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-
144147
145148
- name: Create AVD
146-
if: github.event_name == 'schedule' || steps.avd-cache.outputs.cache-hit != 'true'
149+
if: github.event_name == 'schedule' || steps.restore-avd-cache.outputs.cache-hit != 'true'
147150
uses: reactivecircus/android-emulator-runner@v2
148151
with:
149152
api-level: ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}
150153
arch: x86_64
151154
force-avd-creation: false
152155
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
153-
disable-animations: false
156+
disable-animations: true
154157
script: echo "Generated AVD snapshot for caching."
155158

156159
- name: Save AVD cache
@@ -160,7 +163,7 @@ jobs:
160163
path: |
161164
~/.android/avd/*
162165
~/.android/adb*
163-
key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-${{ github.run_id }}
166+
key: ${{ steps.restore-avd-cache.outputs.cache-primary-key }}
164167

165168
- name: Data Connect Emulator
166169
run: |

0 commit comments

Comments
 (0)