-
Notifications
You must be signed in to change notification settings - Fork 4.1k
417 lines (410 loc) · 18.1 KB
/
e2e_tests_fdc.yaml
File metadata and controls
417 lines (410 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
name: e2e-fdc
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '**/flutterfire_ui/**'
- '**.md'
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '**.md'
permissions:
contents: read
jobs:
android:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
env:
AVD_ARCH: x86_64
AVD_API_LEVEL: 34
AVD_TARGET: google_apis
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '21'
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- name: Setup PostgreSQL for Linux/macOS/Windows
uses: ikalnytskyi/action-setup-postgres@v7
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope "firebase_data_connect*"
- name: Start Firebase Emulator
run: |
cd ./packages/firebase_data_connect/firebase_data_connect/example
unset PGSERVICEFILE
firebase experiments:enable dataconnect
./start-firebase-emulator.sh
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
- name: Free Disk Space (Ubuntu)
uses: AdityaGarg8/remove-unwanted-software@90e01b21170618765a73370fcc3abbd1684a7793
with:
remove-dotnet: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
remove-large-packages: true
- name: AVD cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
id: avd-cache
continue-on-error: true
with:
# Must match the save path exactly
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }}
- name: Start AVD then run E2E tests
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b
with:
api-level: ${{ env.AVD_API_LEVEL }}
target: ${{ env.AVD_TARGET }}
arch: ${{ env.AVD_ARCH }}
emulator-build: 14214601
working-directory: 'packages/firebase_data_connect/firebase_data_connect/example'
script: |
flutter test integration_test/e2e_test.dart --dart-define=CI=true --timeout 10x -d emulator-5554
- name: Save Android Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
key: ${{ steps.avd-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: |
~/.android/avd/*
~/.android/adb*
- name: Save Firestore Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators
ios:
runs-on: macos-15
timeout-minutes: 45
strategy:
fail-fast: false
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '21'
- name: Setup PostgreSQL for Linux/macOS/Windows
uses: ikalnytskyi/action-setup-postgres@v7
- uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639
name: Xcode Compile Cache
with:
key: xcode-cache-${{ runner.os }}
save: "${{ github.ref == 'refs/heads/main' }}"
max-size: 700M
- uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
name: Pods Cache
id: pods-cache
with:
# Must match the save path exactly
path: tests/ios/Pods
key: ${{ runner.os }}-fdc-pods-${{ hashFiles('tests/pubspec.lock') }}
restore-keys: ${{ runner.os }}-fdc-pods
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope "firebase_data_connect*"
- name: 'Build Application'
working-directory: 'packages/firebase_data_connect/firebase_data_connect/example'
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
export CCACHE_FILECLONE=true
export CCACHE_DEPEND=true
export CCACHE_INODECACHE=true
ccache -s
flutter build ios --no-codesign --simulator --debug --target=./integration_test/e2e_test.dart --dart-define=CI=true
ccache -s
- name: Start Firebase Emulator
run: |
sudo chown -R 501:20 "/Users/runner/.npm"
cd ./packages/firebase_data_connect/firebase_data_connect/example
unset PGSERVICEFILE
firebase experiments:enable dataconnect
./start-firebase-emulator.sh
- uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5
id: simulator
with:
model: "iPhone 16"
- name: 'E2E Tests'
working-directory: 'packages/firebase_data_connect/firebase_data_connect/example'
env:
SIMULATOR: ${{ steps.simulator.outputs.udid }}
run: |
# Uncomment following line to have simulator logs printed out for debugging purposes.
# xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' &
# The iOS simulator sometimes fails to connect the VM Service, hanging for
# 12 minutes before timing out. Use a 6-minute limit and retry once with
# a simulator reboot. Normal connection takes 30s-5min.
perl -e 'alarm 360; exec @ARGV' -- flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --timeout 10x || {
echo "First attempt failed or timed out. Rebooting simulator and retrying..."
xcrun simctl shutdown "$SIMULATOR" || true
xcrun simctl boot "$SIMULATOR"
xcrun simctl bootstatus "$SIMULATOR" -b
flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --timeout 10x
}
- name: Save Firestore Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators
- name: Save Pods Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
key: ${{ steps.pods-cache.outputs.cache-primary-key }}
# Must match the restore paths exactly
path: tests/ios/Pods
web:
runs-on: macos-latest
timeout-minutes: 15
strategy:
fail-fast: false
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '21'
- name: Setup PostgreSQL for Linux/macOS/Windows
uses: ikalnytskyi/action-setup-postgres@v7
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope "firebase_data_connect*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- name: Start Firebase Emulator
run: |
sudo chown -R 501:20 "/Users/runner/.npm"
cd ./packages/firebase_data_connect/firebase_data_connect/example
unset PGSERVICEFILE
firebase experiments:enable dataconnect
./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: 'packages/firebase_data_connect/firebase_data_connect/example'
# Web devices are not supported for the `flutter test` command yet. As a
# workaround we can use the `flutter drive` command. Tracking issue:
# https://github.com/flutter/flutter/issues/66264
run: |
chromedriver --port=4444 --trace-buffer-size=100000 &
flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true | tee output.log
# We have to check the output for failed tests matching the string "[E]"
output=$(<output.log)
if [[ "$output" =~ \[E\] ]]; then
# You will see "All tests passed." in the logs even when tests failed.
echo "All tests did not pass. Please check the logs for more information."
exit 1
fi
shell: bash
- name: Save Firestore Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators
web-wasm:
runs-on: macos-latest
timeout-minutes: 15
strategy:
fail-fast: false
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '21'
- name: Setup PostgreSQL for Linux/macOS/Windows
uses: ikalnytskyi/action-setup-postgres@v7
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope "firebase_data_connect*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- name: Start Firebase Emulator
run: |
cd ./packages/firebase_data_connect/firebase_data_connect/example
unset PGSERVICEFILE
firebase experiments:enable dataconnect
./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: 'packages/firebase_data_connect/firebase_data_connect/example'
# Web devices are not supported for the `flutter test` command yet. As a
# workaround we can use the `flutter drive` command. Tracking issue:
# https://github.com/flutter/flutter/issues/66264
run: |
chromedriver --port=4444 --trace-buffer-size=100000 &
mv ./web/wasm_index.html ./web/index.html
flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --wasm --dart-define=CI=true | tee output.log
# We have to check the output for failed tests matching the string "[E]"
output=$(<output.log)
if [[ "$output" =~ \[E\] ]]; then
# You will see "All tests passed." in the logs even when tests failed.
echo "All tests did not pass. Please check the logs for more information."
exit 1
fi
shell: bash
- name: Save Firestore Emulator Cache
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators