-
Notifications
You must be signed in to change notification settings - Fork 86
553 lines (505 loc) · 22.9 KB
/
checks.yml
File metadata and controls
553 lines (505 loc) · 22.9 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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
name: checks
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- '**/lib/**'
- '**/android/**'
- '**/ios/**'
- '**/pubspec.yaml'
- '**/test/**'
- '**/test_driver/**'
- '**/assets/**'
- '**/integration_test/**'
- '.github/workflows/checks.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# The version of Flutter to use should use the minimum Dart SDK version supported by the package.
# Current minimum (N-1 logic)
FLUTTER_VERSION_MINIMUM_DEFAULT: "3.38.10"
# Latest 3.x stable
FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT: "3.x"
# Beta channel support
FLUTTER_VERSION_BETA_CHANNEL_DEFAULT: "beta"
jobs:
setup_matrix:
name: Determine Flutter Test Versions
runs-on: ubuntu-latest
outputs:
flutter_versions_json: ${{ steps.set_versions.outputs.versions_json }}
steps:
- name: Determine Flutter versions
id: set_versions
run: |
MIN="${{ env.FLUTTER_VERSION_MINIMUM_DEFAULT }}"
STABLE="${{ env.FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT }}"
BETA="${{ env.FLUTTER_VERSION_BETA_CHANNEL_DEFAULT }}"
# Create JSON array: ["3.38.10", "3.x", "beta"]
VERSIONS_JSON=$(jq -c --null-input '$ARGS.positional' --args "$MIN" "$STABLE" "$BETA")
echo "versions_json=$VERSIONS_JSON" >> $GITHUB_OUTPUT
analyze:
needs: setup_matrix
timeout-minutes: 15
runs-on: ubuntu-latest
name: ${{ matrix.package }} analysis on ${{ matrix.flutter_version }}
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
package: [wakelock_plus, wakelock_plus_platform_interface]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
# Logic: If version contains a dot or 'x', it's a version/3.x. Otherwise (beta), it's a channel.
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Install dependencies
# --no-example is crucial here so that we only get the library's dependencies
run: flutter pub get --no-example
working-directory: ${{ matrix.package }}
- name: Check format
# Ensure CI fails if code isn't formatted according to dart style
run: dart format . --set-exit-if-changed
working-directory: ${{ matrix.package }}
# Only skip errors if we're on the minimum default version,
# or if we're running the beta channel.
# The only version that matters as far as formatting is concerned is the latest version.
continue-on-error: ${{ matrix.flutter_version == env.FLUTTER_VERSION_MINIMUM_DEFAULT || matrix.flutter_version == env.FLUTTER_VERSION_BETA_CHANNEL_DEFAULT }}
- name: Analyze
# We explicitly analyze only lib and test to ignore the example app's integration tests
run: flutter analyze lib test
working-directory: ${{ matrix.package }}
unit_tests:
needs: setup_matrix
runs-on: ubuntu-latest
name: ${{ matrix.package }} unit tests on ${{ matrix.flutter_version }}
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
package: [wakelock_plus, wakelock_plus_platform_interface]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Install dependencies
run: flutter pub get --no-example
working-directory: ${{ matrix.package }}
- name: Run unit tests
run: flutter test
working-directory: ${{ matrix.package }}
# --- ANDROID ---
android_example_build:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Android Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- name: Install dependencies (Linux build hosts)
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build Android APK
run: |
cd wakelock_plus/example
flutter pub get
flutter build apk --debug --target=./lib/main.dart
android_integration_test:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
# 24: Min SDK (Nougat)
# 28: Pre-Scoped Storage / Legacy (Pie)
# 31: Android 12 (S) - Significant splash screen and permission changes
# 33: Android 13 (T) - Granular media permissions
# 35: Android 15 (Latest Stable)
api-level: [24, 28, 31, 33, 35]
fail-fast: false
name: Android Integration Test (API ${{ matrix.api-level }} - ${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Enable KVM
# Linux runners require KVM to run Android emulators with hardware acceleration
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: Run Integration Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
working-directory: wakelock_plus/example
# We use a single line here because the emulator-runner's script block often misinterprets backslashes
script: flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_plus_test.dart
# --- IOS ---
ios_example_build:
needs: setup_matrix
runs-on: macos-26
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: iOS Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build iOS
run: |
cd wakelock_plus/example
flutter pub get
flutter build ios --no-codesign --debug --target=./lib/main.dart
ios_integration_test:
needs: setup_matrix
# Per requirements: macOS-26 runner is required to access the iPhone 17 simulator environment
runs-on: macos-26
timeout-minutes: 60
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: iOS Integration Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Start iOS simulator
# Using standard simulator-action to handle the simulator lifecycle on macOS-26
uses: futureware-tech/simulator-action@v5
with:
model: 'iPhone 17'
wait_for_boot: true
boot_timeout_seconds: 600
boot_retries: 5
- name: Run Integration Tests
run: |
cd wakelock_plus/example
flutter pub get
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/wakelock_plus_test.dart
# --- MACOS ---
macos_example_build:
needs: setup_matrix
runs-on: macos-26
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: macOS Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build macOS
run: |
flutter config --enable-macos-desktop
cd wakelock_plus/example
flutter pub get
flutter build macos --debug --target=./lib/main.dart
macos_integration_test:
needs: setup_matrix
runs-on: macos-26
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: macOS Integration Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Run Integration Tests
run: |
flutter config --enable-macos-desktop
cd wakelock_plus/example
flutter pub get
flutter drive \
-d macos \
--driver=test_driver/integration_test.dart \
--target=integration_test/wakelock_plus_test.dart
# --- LINUX ---
linux_example_build:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Linux Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build Linux
run: |
flutter config --enable-linux-desktop
cd wakelock_plus/example
flutter pub get
flutter build linux --debug --target=./lib/main.dart
linux_integration_test:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
fail-fast: false
name: Linux Integration Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Install dependencies
# dbus-x11 and xvfb are critical for plugins that interact with ScreenSaver services headlessly
run: |
sudo apt-get update
sudo apt-get install -y \
clang cmake ninja-build pkg-config \
libgtk-3-dev liblzma-dev xvfb dbus-x11 \
python3-dbus python3-gi
- name: Run Linux Unit Tests
run: |
cd wakelock_plus
flutter pub get
flutter test test/wakelock_plus_linux_plugin_test.dart
- name: Run Integration Tests
run: |
flutter config --enable-linux-desktop
cd wakelock_plus/example
flutter pub get
# We use xvfb-run (display) and dbus-run-session (bus).
# Inside, we run a Python mock of 'org.freedesktop.portal.Desktop' so the plugin logic succeeds.
xvfb-run dbus-run-session bash -c "
python3 -c \"
import dbus, dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
class RequestMock(dbus.service.Object):
def __init__(self, bus):
dbus.service.Object.__init__(self, bus, '/org/freedesktop/portal/desktop/request/1_1/test')
@dbus.service.method('org.freedesktop.portal.Request', in_signature='', out_signature='')
def Close(self): pass
class DesktopMock(dbus.service.Object):
def __init__(self, bus):
bus_name = dbus.service.BusName('org.freedesktop.portal.Desktop', bus=bus)
dbus.service.Object.__init__(self, bus_name, '/org/freedesktop/portal/desktop')
@dbus.service.method('org.freedesktop.portal.Inhibit', in_signature='sua{sv}', out_signature='o')
def Inhibit(self, window, flags, options): return dbus.ObjectPath('/org/freedesktop/portal/desktop/request/1_1/test')
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
DesktopMock(bus)
RequestMock(bus)
GLib.MainLoop().run()\" &
sleep 5 && \
flutter drive \
-d linux \
--driver=test_driver/integration_test.dart \
--target=integration_test/wakelock_plus_test.dart"
# --- WINDOWS ---
windows_example_build:
needs: setup_matrix
runs-on: windows-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Windows Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build Windows
run: |
flutter config --enable-windows-desktop
cd wakelock_plus/example
flutter pub get
flutter build windows --debug --target=./lib/main.dart
windows_integration_test:
needs: setup_matrix
runs-on: windows-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Windows Integration Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Run Integration Tests
# Use single line to prevent PowerShell ParserErrors with backslashes
run: |
flutter config --enable-windows-desktop
cd wakelock_plus/example
flutter pub get
flutter drive -d windows --driver=test_driver/integration_test.dart --target=integration_test/wakelock_plus_test.dart
# --- WEB ---
web_example_build:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Web Example Build (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Build Web
run: |
cd wakelock_plus/example
flutter pub get
flutter build web --debug --target=./lib/main.dart
web_plugin_unit_test:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Web Plugin Unit Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Install dependencies
run: flutter pub get
working-directory: wakelock_plus
- name: Run Web Plugin Tests
run: |
flutter test \
--platform chrome \
--dart-define=WEB_PLUGIN_TESTS=true \
test/wakelock_plus_web_plugin_test.dart
working-directory: wakelock_plus
web_integration_test:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }}
name: Web Integration Test (${{ matrix.flutter_version }})
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ (contains(matrix.flutter_version, '.') || contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
channel: ${{ (!contains(matrix.flutter_version, '.') && !contains(matrix.flutter_version, 'x')) && matrix.flutter_version || '' }}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Install Web Dependencies
run: |
sudo apt-get update
# Install xvfb and the specific chromium-chromedriver
sudo apt-get install -y xvfb chromium-chromedriver
- name: Start ChromeDriver & Xvfb
run: |
# 1. Export DISPLAY so chromedriver knows which screen to use
export DISPLAY=:99
# 2. Start Xvfb manually with the resolution used by plus_plugins
Xvfb $DISPLAY -screen 0 1024x768x16 &
# 3. Start chromedriver on the port expected by Flutter's web driver
chromedriver --port=4444 &
# 4. Give services time to initialize
sleep 5
- name: Run Integration Tests
run: |
# Must re-export DISPLAY in this step as well
export DISPLAY=:99
flutter config --enable-web
cd wakelock_plus/example
flutter pub get
# Use timeout to prevent the CI hang common in headless web environments
timeout 10m flutter drive \
-d chrome \
--driver=test_driver/integration_test.dart \
--target=integration_test/wakelock_plus_test.dart \
--dart-define=CI=true \
--no-keep-app-running || {
if [ $? -eq 124 ]; then
echo "Flutter drive reached timeout. Process was killed to prevent CI hang."
else
exit $?
fi
}