forked from firebase/flutterfire
-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (315 loc) · 13 KB
/
e2e_tests.yaml
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
name: e2e
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '**/flutterfire_ui/**'
- '**/cloud_firestore_odm/**'
- '**.md'
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '**/flutterfire_ui/**'
- '**/cloud_firestore_odm/**'
- '**.md'
jobs:
android:
runs-on: macos-13
timeout-minutes: 45
strategy:
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
name: Gradle Cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-v4-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-v4
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
name: AVD Cache
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd
- name: Firebase Emulator Cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ github.run_id }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
run-bootstrap: false
melos-version: '3.0.1'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
- name: Start Firebase Emulator
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: Create and start emulator
# We use the installed SDK in the macOS image to create and start the emulator
run: |
echo "List installed packages"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed
echo "Installing system image"
echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;google_apis;x86_64"
echo "Creating AVD"
echo "no" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n test_emulator -k "system-images;android-33;google_apis;x86_64" --force
echo "Starting emulator"
$ANDROID_SDK_ROOT/emulator/emulator -avd test_emulator -no-audio -no-boot-anim -no-window &
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
run: |
flutter test integration_test/e2e_test.dart --dart-define=CI=true
ios:
# Dropped down to macos-12 as macos-13 was timing out. This suspected issue:https://github.com/actions/runner-images/issues/8023
runs-on: macos-12
timeout-minutes: 45
strategy:
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
- uses: hendrikmuhs/ccache-action@6d1841ec156c39a52b1b23a810da917ab98da1f4
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-ios-v3
max-size: 700M
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
name: Pods Cache
id: pods-cache
with:
path: tests/ios/Pods
key: ${{ runner.os }}-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-ios-pods-v2
- name: Firebase Emulator Cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ github.run_id }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
run-bootstrap: false
melos-version: '3.0.1'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
- name: 'Build Application'
working-directory: ${{ matrix.working_directory }}
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 ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
run: |
# Boot simulator and wait for System app to be ready.
# List of available simulators: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-simulators
SIMULATOR="iPhone 14"
xcrun simctl bootstatus "$SIMULATOR" -b
xcrun simctl logverbose "$SIMULATOR" enable
# Sleep to allow simulator to settle.
sleep 15
# Uncomment following line to have simulator logs printed out for debugging purposes.
# xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' &
flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true
macos:
runs-on: macos-13
timeout-minutes: 45
strategy:
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
- uses: hendrikmuhs/ccache-action@6d1841ec156c39a52b1b23a810da917ab98da1f4
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-macos-v2
max-size: 700M
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
name: Pods Cache
id: pods-cache
with:
path: tests/macos/Pods
key: ${{ runner.os }}-pods-v2-${{ hashFiles('tests/macos/Podfile.lock') }}
restore-keys: ${{ runner.os }}-macos-pods-v1
- name: Cache Firebase Emulator
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ github.run_id }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
run-bootstrap: false
melos-version: '3.0.1'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
- name: 'Build Application'
working-directory: ${{ matrix.working_directory }}
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 macos --debug --target=./integration_test/e2e_test.dart --device-id=macos --dart-define=CI=true
ccache -s
- name: Start Firebase Emulator
# Chown the npm cache directory to the runner user to avoid permission issues
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
run: |
flutter test \
integration_test/e2e_test.dart \
-d macos \
--dart-define=CI=true
web:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
run-bootstrap: false
melos-version: '3.0.1'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
- name: Cache Firebase Emulator
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ github.run_id }}
restore-keys: firebase-emulators-v3
- name: Start Firebase Emulator
run: cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
# 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 \
--verbose-system-logs \
-d web-server \
--driver=test_driver/integration_test.dart \
--target=integration_test/e2e_test.dart \
--dart-define=CI=true
windows:
runs-on: windows-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
name: Install Node.js 20
with:
node-version: "20"
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
run-bootstrap: false
melos-version: '3.0.0'
- name: "Bootstrap package"
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: "Install Tools"
run: |
npm install -g firebase-tools
- name: Start Firebase Emulator and run tests
run: cd ./.github/workflows/scripts && firebase emulators:exec --project flutterfire-e2e-tests "cd ../../../tests && flutter test .\integration_test\e2e_test.dart -d windows"