-
-
Notifications
You must be signed in to change notification settings - Fork 0
520 lines (477 loc) · 18.5 KB
/
ci.yml
File metadata and controls
520 lines (477 loc) · 18.5 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
name: CI
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
workflow_dispatch:
inputs:
force_all:
description: 'Run all tests (ignore change detection)'
required: false
type: boolean
default: false
permissions:
contents: read
actions: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
env:
TURBO_TELEMETRY_DISABLED: 1
jobs:
# Detect which services are affected by changes
detect-changes:
uses: ./.github/workflows/_ci-detect-changes.reusable.yml
with:
force_all: ${{ inputs.force_all || false }}
# Build on Linux first since it's the fastest and its artifacts are used by all other jobs
build:
name: Build [Linux]
needs: [detect-changes]
uses: ./.github/workflows/_ci-build.reusable.yml
with:
os: 'ubuntu-latest'
# Run linting after build to use the build artifacts
lint:
name: Lint [Linux]
needs: [detect-changes, build]
uses: ./.github/workflows/_ci-lint.reusable.yml
with:
cache_key: ${{ needs.build.outputs.cache_key }}
# Run unit tests after linting to ensure code quality first
unit-matrix:
name: Unit
needs: [build, lint]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
display-name: Linux
- os: windows-latest
display-name: Windows
- os: macos-latest
display-name: macOS-ARM
- os: macos-15-intel
display-name: macOS-Intel
uses: ./.github/workflows/_ci-unit.reusable.yml
with:
os: ${{ matrix.os }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
# Build Tauri E2E app binaries - only if Tauri tests will run
build-tauri-e2e-app-linux:
name: Build Tauri E2E App [Linux]
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-build-tauri-e2e-app.reusable.yml
with:
os: 'ubuntu-latest'
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
build-tauri-e2e-app-windows:
name: Build Tauri E2E App [Windows]
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-build-tauri-e2e-app.reusable.yml
with:
os: 'windows-latest'
build-command: 'build:debug' # Use debug build on Windows to preserve stdout/stderr for log capture
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
# Build Tauri package test apps - only if Tauri package tests will run
build-tauri-package-app-linux:
name: Build Tauri Package Test App [Linux]
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-build-tauri-package-app.reusable.yml
with:
os: 'ubuntu-latest'
build-tauri-package-app-windows:
name: Build Tauri Package Test App [Windows]
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-build-tauri-package-app.reusable.yml
with:
os: 'windows-latest'
build-tauri-package-app-linux-arm:
name: Build Tauri Package Test App [Linux-ARM64]
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-build-tauri-package-app.reusable.yml
with:
os: 'ubuntu-24.04-arm'
# Run package tests after unit tests to ensure the package is built correctly
# Split Electron and Tauri tests across separate jobs for better parallelization and clarity
# Electron apps are built inline on the test runner (faster builds, Turbo caching handles it)
# Tauri apps are built separately due to longer build times and system dependencies
# Electron package tests are split by module type (CJS/ESM) for better error isolation
package-electron-matrix:
name: Package - Electron
needs: [detect-changes, build, lint]
if: needs.detect-changes.outputs.run_electron == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
display-name: Linux
module-type: cjs
- os: ubuntu-latest
display-name: Linux
module-type: esm
- os: ubuntu-24.04-arm
display-name: Linux-ARM64
module-type: cjs
- os: ubuntu-24.04-arm
display-name: Linux-ARM64
module-type: esm
- os: windows-latest
display-name: Windows
module-type: cjs
- os: windows-latest
display-name: Windows
module-type: esm
- os: macos-latest
display-name: macOS-ARM
module-type: cjs
- os: macos-latest
display-name: macOS-ARM
module-type: esm
- os: macos-15-intel
display-name: macOS-Intel
module-type: cjs
- os: macos-15-intel
display-name: macOS-Intel
module-type: esm
uses: ./.github/workflows/_ci-package.reusable.yml
with:
os: ${{ matrix.os }}
service: 'electron'
module-type: ${{ matrix.module-type }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
package-tauri-linux:
name: Package - Tauri [Linux]
needs: [detect-changes, build, lint, build-tauri-package-app-linux]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-package.reusable.yml
with:
os: 'ubuntu-latest'
service: 'tauri'
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ${{ needs.build-tauri-package-app-linux.outputs.cache_key }}
package-tauri-windows:
name: Package - Tauri [Windows]
needs: [detect-changes, build, lint, build-tauri-package-app-windows]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-package.reusable.yml
with:
os: 'windows-latest'
service: 'tauri'
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ${{ needs.build-tauri-package-app-windows.outputs.cache_key }}
package-tauri-linux-arm:
name: Package - Tauri [Linux-ARM64]
needs: [detect-changes, build, lint, build-tauri-package-app-linux-arm]
if: needs.detect-changes.outputs.run_tauri == 'true'
uses: ./.github/workflows/_ci-package.reusable.yml
with:
os: 'ubuntu-24.04-arm'
service: 'tauri'
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ${{ needs.build-tauri-package-app-linux-arm.outputs.cache_key }}
# Run Tauri package tests across different Linux distributions using Docker
# Tests cross-distro compatibility, tauri-driver auto-installation, and WebKitWebDriver detection
# Excluded distributions:
# - SUSE: No official WebKitWebDriver package (requires multi-hour source build)
# - Alpine: musl/static linking incompatible with GTK/webkit (no static libraries available)
# - CentOS Stream 9: glib 2.68 too old (Tauri requires >= 2.70)
# - CentOS Stream 10: WebKitGTK removed by Red Hat due to 200+ CVEs and unsustainable maintenance
package-tauri-distros:
name: Package - Tauri (Docker)
needs: [detect-changes, build, lint]
if: needs.detect-changes.outputs.run_tauri == 'true'
strategy:
fail-fast: false
matrix:
include:
- distro: ubuntu
display-name: Ubuntu
- distro: fedora
display-name: Fedora
- distro: debian
display-name: Debian
- distro: arch
display-name: Arch
- distro: void
display-name: Void
uses: ./.github/workflows/_ci-package-docker.reusable.yml
with:
distro: ${{ matrix.distro }}
# Run build tests outside of the main Linux build job
build-matrix:
name: Build
needs: [detect-changes, build, lint]
if: needs.detect-changes.outputs.run_electron == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
display-name: Windows
- os: macos-latest
display-name: macOS-ARM
- os: macos-15-intel
display-name: macOS-Intel
uses: ./.github/workflows/_ci-build.reusable.yml
with:
os: ${{ matrix.os }}
# E2E test matrix strategy:
# - Run tests across operating systems and architectures (Linux, Windows, macOS ARM, macOS Intel)
# - Test 3 scenarios (builder, forge, script)
# - E2E tests use ESM only (CJS/ESM testing is done in package tests)
# - Optimize for GitHub Actions concurrency limits
e2e-matrix:
name: E2E - Electron
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_electron == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
display-name: Linux
scenario: builder
- os: ubuntu-latest
display-name: Linux
scenario: forge
- os: ubuntu-latest
display-name: Linux
scenario: script
- os: windows-latest
display-name: Windows
scenario: builder
- os: windows-latest
display-name: Windows
scenario: forge
- os: windows-latest
display-name: Windows
scenario: script
- os: macos-latest
display-name: macOS-ARM
scenario: builder
- os: macos-latest
display-name: macOS-ARM
scenario: forge
- os: macos-latest
display-name: macOS-ARM
scenario: script
- os: macos-15-intel
display-name: macOS-Intel
scenario: builder
- os: macos-15-intel
display-name: macOS-Intel
scenario: forge
- os: macos-15-intel
display-name: macOS-Intel
scenario: script
uses: ./.github/workflows/_ci-e2e.reusable.yml
with:
os: ${{ matrix.os }}
node-version: '20'
scenario: ${{ matrix.scenario }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
# Electron window tests - run on Linux with splash screen enabled
e2e-electron-window:
name: E2E - Electron [Linux] (window)
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_electron == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
display-name: Linux
scenario: builder
- os: ubuntu-latest
display-name: Linux
scenario: forge
- os: ubuntu-latest
display-name: Linux
scenario: script
uses: ./.github/workflows/_ci-e2e.reusable.yml
with:
os: ${{ matrix.os }}
node-version: '20'
scenario: ${{ matrix.scenario }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
# Tauri E2E tests for Linux - only waits for E2E app build
e2e-tauri-linux-matrix:
name: E2E - Tauri [Linux] - ${{ matrix.scenario }}${{ matrix.test-type != 'standard' && format(' ({0})', matrix.test-type) || '' }}
needs: [detect-changes, build, build-tauri-e2e-app-linux]
if: needs.detect-changes.outputs.run_tauri == 'true'
strategy:
fail-fast: false
matrix:
scenario: ['tauri-basic']
test-type: ['standard', 'window', 'multiremote', 'standalone']
uses: ./.github/workflows/_ci-e2e-tauri.reusable.yml
with:
os: 'ubuntu-latest'
node-version: '20'
scenario: ${{ matrix.scenario }}
test-type: ${{ matrix.test-type }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ${{ needs.build-tauri-e2e-app-linux.outputs.cache_key }}
# Tauri E2E tests for Windows
e2e-tauri-windows-matrix:
name: E2E - Tauri [Windows] - ${{ matrix.scenario }}${{ matrix.test-type != 'standard' && format(' ({0})', matrix.test-type) || '' }}
needs: [detect-changes, build, build-tauri-e2e-app-windows]
if: needs.detect-changes.outputs.run_tauri == 'true'
strategy:
fail-fast: false
matrix:
scenario: ['tauri-basic']
test-type: ['standard', 'window', 'multiremote', 'standalone']
uses: ./.github/workflows/_ci-e2e-tauri.reusable.yml
with:
os: 'windows-latest'
node-version: '20'
scenario: ${{ matrix.scenario }}
test-type: ${{ matrix.test-type }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ${{ needs.build-tauri-e2e-app-windows.outputs.cache_key }}
# Tauri E2E tests for macOS - skipped with clear messaging
# macOS is not supported due to WKWebView WebDriver limitations
e2e-tauri-macos-matrix:
name: E2E - Tauri (macOS)
needs: [detect-changes, build]
if: needs.detect-changes.outputs.run_tauri == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
display-name: macOS-ARM
scenario: tauri-basic
test-type: standard
- os: macos-latest
display-name: macOS-ARM
scenario: tauri-basic
test-type: multiremote
- os: macos-latest
display-name: macOS-ARM
scenario: tauri-basic
test-type: standalone
- os: macos-15-intel
display-name: macOS-Intel
scenario: tauri-basic
test-type: standard
- os: macos-15-intel
display-name: macOS-Intel
scenario: tauri-basic
test-type: multiremote
- os: macos-15-intel
display-name: macOS-Intel
scenario: tauri-basic
test-type: standalone
uses: ./.github/workflows/_ci-e2e-tauri.reusable.yml
with:
os: ${{ matrix.os }}
node-version: '20'
scenario: ${{ matrix.scenario }}
test-type: ${{ matrix.test-type }}
build_id: ${{ needs.build.outputs.build_id }}
artifact_size: ${{ needs.build.outputs.artifact_size }}
cache_key: ${{ needs.build.outputs.cache_key }}
tauri_cache_key: ''
# Universal binary verification - Electron only
package-electron-mac-universal:
name: Package - Electron [macOS-Universal-Verify]
needs: [detect-changes, build, lint]
if: needs.detect-changes.outputs.run_electron == 'true'
runs-on: macos-latest
steps:
- name: 👷 Checkout Repository
uses: actions/checkout@v6
- name: 🛠️ Setup Development Environment
uses: ./.github/workflows/actions/setup-workspace
with:
node-version: '20'
- name: 📦 Download Build Artifacts
uses: ./.github/workflows/actions/download-archive
with:
name: wdio-desktop-mobile
path: wdio-desktop-mobile-build
filename: artifact.zip
cache_key_prefix: wdio-desktop-build
exact_cache_key: ${{ needs.build.outputs.cache_key || github.run_id && format('{0}-{1}-{2}-{3}{4}', 'Linux', 'wdio-desktop-build', 'wdio-desktop-mobile', github.run_id, github.run_attempt > 1 && format('-rerun{0}', github.run_attempt) || '') || '' }}
- name: 🔨 Build Universal Binary (Electron Builder)
run: pnpm --filter electron-builder-e2e-app build:mac-universal
- name: ✅ Verify Universal Binary Contains Both Architectures (Builder)
run: |
BINARY_PATH="fixtures/e2e-apps/electron-builder/dist-electron/mac-universal/electron-builder-e2e-app.app/Contents/MacOS/electron-builder-e2e-app"
if [ ! -f "$BINARY_PATH" ]; then
echo "❌ Binary not found at $BINARY_PATH"
echo "Contents of dist-electron/mac-universal:"
ls -la fixtures/e2e-apps/electron-builder/dist-electron/mac-universal/ || echo "Directory does not exist"
exit 1
fi
echo "Binary found, checking architecture..."
lipo -info "$BINARY_PATH"
ARCHS=$(lipo -info "$BINARY_PATH" | grep "Architectures" | awk '{print $(NF-1), $NF}')
echo "Found architectures: $ARCHS"
if [[ "$ARCHS" != *"x86_64"* ]]; then
echo "❌ Missing x86_64 architecture"
exit 1
fi
if [[ "$ARCHS" != *"arm64"* ]]; then
echo "❌ Missing arm64 architecture"
exit 1
fi
echo "✅ Universal binary verified: $ARCHS"
- name: 🔨 Build Universal Binary (Electron Forge)
run: pnpm --filter electron-forge-e2e-app build:mac-universal
- name: ✅ Verify Universal Binary Contains Both Architectures (Forge)
run: |
BINARY_PATH="fixtures/e2e-apps/electron-forge/out/electron-forge-e2e-app-darwin-universal/electron-forge-e2e-app.app/Contents/MacOS/electron-forge-e2e-app"
if [ ! -f "$BINARY_PATH" ]; then
echo "❌ Binary not found at $BINARY_PATH"
echo "Contents of out/:"
ls -la fixtures/e2e-apps/electron-forge/out/ || echo "Directory does not exist"
exit 1
fi
echo "Binary found, checking architecture..."
lipo -info "$BINARY_PATH"
ARCHS=$(lipo -info "$BINARY_PATH" | grep "Architectures" | awk '{print $(NF-1), $NF}')
echo "Found architectures: $ARCHS"
if [[ "$ARCHS" != *"x86_64"* ]]; then
echo "❌ Missing x86_64 architecture"
exit 1
fi
if [[ "$ARCHS" != *"arm64"* ]]; then
echo "❌ Missing arm64 architecture"
exit 1
fi
echo "✅ Universal binary verified: $ARCHS"