2727 timeout-minutes : 45
2828 strategy :
2929 fail-fast : false
30+ env :
31+ AVD_ARCH : x86_64
32+ AVD_API_LEVEL : 34
33+ AVD_TARGET : google_apis
3034 steps :
3135 - uses : actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
3236 - uses : actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
@@ -37,11 +41,20 @@ jobs:
3741 with :
3842 distribution : ' temurin'
3943 java-version : ' 21'
44+ - name : ' Install Tools'
45+ run : |
46+ sudo npm i -g firebase-tools
47+ echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
4048 - name : Firebase Emulator Cache
41- uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
49+ id : firebase-emulator-cache
50+ uses : actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
51+ continue-on-error : true
4252 with :
53+ # The firebase emulators are pure javascript and java, OS-independent
54+ enableCrossOsArchive : true
55+ # Must match the save path exactly
4356 path : ~/.cache/firebase/emulators
44- key : firebase-emulators-v3-fdc- ${{ runner.os }}
57+ key : firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
4558 restore-keys : firebase-emulators-v3
4659 - uses : subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
4760 with :
5568 melos-version : ' 5.3.0'
5669 - name : ' Bootstrap package'
5770 run : melos bootstrap --scope "firebase_data_connect*"
58- - name : ' Install Tools'
59- run : |
60- sudo npm i -g firebase-tools
6171 - name : Start Firebase Emulator
6272 run : |
6373 cd ./packages/firebase_data_connect/firebase_data_connect/example
@@ -80,23 +90,47 @@ jobs:
8090 remove-docker-images : true
8191 remove-large-packages : true
8292 - name : AVD cache
83- uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
93+ uses : actions/cache/restore @1bd1e32a3bdc45362d1e726936510720a7c30a57
8494 id : avd-cache
95+ continue-on-error : true
8596 with :
97+ # Must match the save path exactly
8698 path : |
8799 ~/.android/avd/*
88100 ~/.android/adb*
89- key : avd-${{ runner.os }}
101+ key : avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
90102 - name : Start AVD then run E2E tests
91103 uses : reactivecircus/android-emulator-runner@v2
92104 with :
93- api-level : 34
94- target : google_apis
95- arch : x86_64
105+ api-level : ${{ env.AVD_API_LEVEL }}
106+ target : ${{ env.AVD_TARGET }}
107+ arch : ${{ env.AVD_ARCH }}
96108 emulator-build : 14214601
97109 working-directory : ' packages/firebase_data_connect/firebase_data_connect/example'
98110 script : |
99111 flutter test integration_test/e2e_test.dart --dart-define=CI=true -d emulator-5554
112+ - name : Save Android Emulator Cache
113+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
114+ if : github.ref == 'refs/heads/main'
115+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
116+ continue-on-error : true
117+ with :
118+ key : ${{ steps.avd-cache.outputs.cache-primary-key }}
119+ # Must match the restore path exactly
120+ path : |
121+ ~/.android/avd/*
122+ ~/.android/adb*
123+ - name : Save Firestore Emulator Cache
124+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
125+ if : github.ref == 'refs/heads/main'
126+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
127+ continue-on-error : true
128+ with :
129+ # The firebase emulators are pure javascript and java, OS-independent
130+ enableCrossOsArchive : true
131+ key : ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
132+ # Must match the restore path exactly
133+ path : ~/.cache/firebase/emulators
100134
101135 ios :
102136 runs-on : macos-15
@@ -121,19 +155,31 @@ jobs:
121155 name : Xcode Compile Cache
122156 with :
123157 key : xcode-cache-${{ runner.os }}
158+ save : " ${{ github.ref == 'refs/heads/main' }}"
124159 max-size : 700M
125- - uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
160+ - uses : actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
161+ continue-on-error : true
126162 name : Pods Cache
127163 id : pods-cache
128164 with :
165+ # Must match the save path exactly
129166 path : tests/ios/Pods
130167 key : ${{ runner.os }}-fdc-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }}
131168 restore-keys : ${{ runner.os }}-ios-pods-v2
169+ - name : ' Install Tools'
170+ run : |
171+ sudo npm i -g firebase-tools
172+ echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
132173 - name : Firebase Emulator Cache
133- uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
174+ id : firebase-emulator-cache
175+ uses : actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
176+ continue-on-error : true
134177 with :
178+ # The firebase emulators are pure javascript and java, OS-independent
179+ enableCrossOsArchive : true
180+ # Must match the save path exactly
135181 path : ~/.cache/firebase/emulators
136- key : firebase-emulators-v3-fdc- ${{ runner.os }}
182+ key : firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
137183 restore-keys : firebase-emulators-v3
138184 - uses : subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
139185 with :
@@ -145,9 +191,6 @@ jobs:
145191 melos-version : ' 5.3.0'
146192 - name : ' Bootstrap package'
147193 run : melos bootstrap --scope "firebase_data_connect*"
148- - name : ' Install Tools'
149- run : |
150- sudo npm i -g firebase-tools
151194 - name : ' Build Application'
152195 working-directory : ' packages/firebase_data_connect/firebase_data_connect/example'
153196 run : |
@@ -179,6 +222,26 @@ jobs:
179222 # Uncomment following line to have simulator logs printed out for debugging purposes.
180223 # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' &
181224 flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true
225+ - name : Save Firestore Emulator Cache
226+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
227+ if : github.ref == 'refs/heads/main'
228+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
229+ continue-on-error : true
230+ with :
231+ # The firebase emulators are pure javascript and java, OS-independent
232+ enableCrossOsArchive : true
233+ key : ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
234+ # Must match the restore path exactly
235+ path : ~/.cache/firebase/emulators
236+ - name : Save Pods Cache
237+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
238+ if : github.ref == 'refs/heads/main'
239+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
240+ continue-on-error : true
241+ with :
242+ key : ${{ steps.pods-cache.outputs.cache-primary-key }}
243+ # Must match the restore paths exactly
244+ path : tests/ios/Pods
182245
183246 web :
184247 runs-on : macos-latest
@@ -208,12 +271,19 @@ jobs:
208271 - name : ' Bootstrap package'
209272 run : melos bootstrap --scope "firebase_data_connect*"
210273 - name : ' Install Tools'
211- run : sudo npm i -g firebase-tools
212- - name : Cache Firebase Emulator
213- uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
274+ run : |
275+ sudo npm i -g firebase-tools
276+ echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
277+ - name : Firebase Emulator Cache
278+ id : firebase-emulator-cache
279+ uses : actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
280+ continue-on-error : true
214281 with :
282+ # The firebase emulators are pure javascript and java, OS-independent
283+ enableCrossOsArchive : true
284+ # Must match the save path exactly
215285 path : ~/.cache/firebase/emulators
216- key : firebase-emulators-v3-fdc- ${{ runner.os }}
286+ key : firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
217287 restore-keys : firebase-emulators-v3
218288 - name : Start Firebase Emulator
219289 run : |
@@ -238,3 +308,23 @@ jobs:
238308 exit 1
239309 fi
240310 shell : bash
311+ - name : Save Firestore Emulator Cache
312+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
313+ if : github.ref == 'refs/heads/main'
314+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
315+ continue-on-error : true
316+ with :
317+ # The firebase emulators are pure javascript and java, OS-independent
318+ enableCrossOsArchive : true
319+ key : ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
320+ # Must match the restore path exactly
321+ path : ~/.cache/firebase/emulators
322+ - name : Save Pods Cache
323+ # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
324+ if : github.ref == 'refs/heads/main'
325+ uses : actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
326+ continue-on-error : true
327+ with :
328+ key : ${{ steps.pods-cache.outputs.cache-primary-key }}
329+ # Must match the restore paths exactly
330+ path : tests/ios/Pods
0 commit comments