-
Notifications
You must be signed in to change notification settings - Fork 5
520 lines (446 loc) · 16.8 KB
/
ci.yml
File metadata and controls
520 lines (446 loc) · 16.8 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
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: "0"
jobs:
rust:
name: Rust lint and unit tests
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install native build dependencies
run: brew install pkg-config x264
- name: Cache Rust build outputs
uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
packages/server/target
key: rust-${{ runner.os }}-${{ hashFiles('packages/server/Cargo.lock', 'packages/server/Cargo.toml', 'packages/server/build.rs', 'packages/server/src/**/*.rs', 'packages/server/native/**/*.m') }}
restore-keys: |
rust-${{ runner.os }}-
- name: Check Rust formatting
run: cargo fmt --manifest-path packages/server/Cargo.toml --check
- name: Clippy
run: cargo clippy --manifest-path packages/server/Cargo.toml --all-targets -- -D warnings
- name: Rust unit tests
run: cargo test --manifest-path packages/server/Cargo.toml
client:
name: Client lint, build, and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
packages/client/package-lock.json
- name: Install root dependencies
run: npm ci --ignore-scripts --force
- name: Install client dependencies
run: npm ci --prefix packages/client
- name: Check Prettier formatting
run: npx prettier --check .
- name: Test studio provider bridge
run: npm run test:studio-provider
- name: Test integration harness helpers
run: npm run test:integration-harness
- name: Test workflow and CLI packaging guards
run: npm run test:github-actions
- name: Typecheck client
run: npm run --prefix packages/client typecheck
- name: Test client
run: npm run --prefix packages/client test
- name: Build client
run: npm run --prefix packages/client build
packages:
name: Packages and VS Code extension
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
packages/react-native-inspector/package-lock.json
packages/nativescript-inspector/package-lock.json
- name: Install root dependencies
run: npm ci --ignore-scripts --force
- name: Install NativeScript inspector dependencies
run: npm ci --prefix packages/nativescript-inspector
- name: Install React Native inspector dependencies
run: npm ci --prefix packages/react-native-inspector
- name: Build inspector and test packages
run: npm run build:packages
- name: Package VS Code extension
run: npm run package:vscode-extension
build-artifacts:
name: Build integration artifacts
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
packages/client/package-lock.json
- uses: dtolnay/rust-toolchain@stable
- name: Install native build dependencies
run: brew install pkg-config x264
- name: Cache Rust build outputs and fixture app
uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
packages/server/target
.cache/simdeck/fixture
key: rust-${{ runner.os }}-${{ hashFiles('packages/server/Cargo.lock', 'packages/server/Cargo.toml', 'packages/server/build.rs', 'packages/server/src/**/*.rs', 'packages/server/native/**/*.m', 'scripts/integration/fixture.mjs') }}
restore-keys: |
rust-${{ runner.os }}-
- name: Install root dependencies
run: npm ci --ignore-scripts
- name: Install client dependencies
run: npm ci --prefix packages/client
- name: Build CLI, client, and JS test API
run: |
npm run build:cli
npm run build:client
npm run build:simdeck-test
npm run test:integration:fixture
- name: Upload integration artifacts
uses: actions/upload-artifact@v4
with:
name: simdeck-integration-artifacts
if-no-files-found: error
include-hidden-files: true
path: |
build/simdeck
build/simdeck-bin
packages/client/dist
packages/simdeck-test/dist
.cache/simdeck/fixture
integration-cli:
name: CLI simulator integration
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
needs:
- rust
- client
- packages
- build-artifacts
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Download integration artifacts
uses: actions/download-artifact@v4
with:
name: simdeck-integration-artifacts
path: .
- name: Make CLI executable
run: chmod +x build/simdeck build/simdeck-bin
- name: CLI simulator integration tests
run: npm run test:integration:cli
env:
SIMDECK_INTEGRATION_VERBOSE: "1"
- name: LaunchAgent service restart integration test
run: npm run test:integration:service
env:
SIMDECK_INTEGRATION_LAUNCHAGENT: "1"
integration-js-api:
name: JS API simulator integration
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
needs:
- rust
- client
- packages
- build-artifacts
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Download integration artifacts
uses: actions/download-artifact@v4
with:
name: simdeck-integration-artifacts
path: .
- name: Make CLI executable
run: chmod +x build/simdeck build/simdeck-bin
- name: JS API simulator integration tests
run: npm run test:integration:js-api
integration-webrtc:
name: WebRTC stream benchmark
runs-on: macos-15
timeout-minutes: 20
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
needs:
- rust
- client
- packages
- build-artifacts
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Download integration artifacts
uses: actions/download-artifact@v4
with:
name: simdeck-integration-artifacts
path: .
- name: Make CLI executable
run: chmod +x build/simdeck build/simdeck-bin
- name: WebRTC software stream benchmark
run: npm run test:integration:webrtc
env:
# The service still targets 60 fps at full device resolution. Hosted
# macOS headless Chrome decode can dip under runner contention, so CI
# gates 55+ received fps for the software stream plus a modest
# hosted-browser decode floor. Local runs can keep 55+ fps thresholds.
SIMDECK_E2E_MIN_DECODED_FPS: "18"
SIMDECK_E2E_MIN_PRESENTED_FPS: "18"
SIMDECK_E2E_MIN_RECEIVED_FPS: "55"
SIMDECK_E2E_WEBRTC_MS: "20000"
SIMDECK_INTEGRATION_DEVICE_TYPE: iPhone SE (3rd generation)
integration-android:
name: Android emulator integration (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 65
needs:
- client
- packages
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- uses: dtolnay/rust-toolchain@stable
- name: Enable KVM access
if: runner.os == 'Linux'
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: Install root dependencies
run: npm ci --ignore-scripts --force
- name: Build Android integration artifacts
run: |
npm run build:cli
npm run build:simdeck-test
- name: Android emulator integration tests (Linux)
if: runner.os == 'Linux'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis
arch: x86_64
profile: pixel_6
avd-name: SimDeck_Pixel_CI
disable-animations: true
emulator-options: -no-window -no-audio -no-boot-anim -no-snapshot -gpu swiftshader_indirect -grpc 8554
script: npm run test:integration:android
env:
SIMDECK_INTEGRATION_ANDROID_AVD: SimDeck_Pixel_CI
SIMDECK_INTEGRATION_REQUIRE_RUNNING_ANDROID: "1"
SIMDECK_INTEGRATION_VERBOSE: "1"
- name: Create, boot, and test Android emulator (Windows)
if: runner.os == 'Windows'
shell: pwsh
timeout-minutes: 45
run: |
$ErrorActionPreference = "Stop"
$sdk = $env:ANDROID_HOME
if (-not $sdk) {
$sdk = $env:ANDROID_SDK_ROOT
}
if (-not $sdk) {
$sdk = Join-Path $env:LOCALAPPDATA "Android\Sdk"
}
$env:ANDROID_HOME = $sdk
$env:ANDROID_SDK_ROOT = $sdk
$cmdlineTools = Get-ChildItem -Path (Join-Path $sdk "cmdline-tools") -Directory -ErrorAction SilentlyContinue |
Sort-Object Name -Descending |
Select-Object -First 1
$toolsBin = if (Test-Path (Join-Path $sdk "cmdline-tools\latest\bin")) {
Join-Path $sdk "cmdline-tools\latest\bin"
} elseif ($cmdlineTools) {
Join-Path $cmdlineTools.FullName "bin"
} else {
Join-Path $sdk "tools\bin"
}
$sdkmanager = Join-Path $toolsBin "sdkmanager.bat"
$avdmanager = Join-Path $toolsBin "avdmanager.bat"
$adb = Join-Path $sdk "platform-tools\adb.exe"
$emulator = Join-Path $sdk "emulator\emulator.exe"
$windowsApi = "35"
$windowsPlatform = "platforms;android-$windowsApi"
$windowsSystemImage = "system-images;android-$windowsApi;google_atd;x86_64"
$yesFile = Join-Path $env:RUNNER_TEMP "android-sdk-yes.txt"
1..200 | ForEach-Object { "y" } | Set-Content -Path $yesFile -Encoding ascii
$noFile = Join-Path $env:RUNNER_TEMP "android-avd-no.txt"
"no" | Set-Content -Path $noFile -Encoding ascii
function Invoke-AndroidToolWithInput($tool, $arguments, $inputFile) {
$line = "`"$tool`" $arguments < `"$inputFile`""
Write-Host "cmd /c $line"
cmd /c $line
if ($LASTEXITCODE -ne 0) {
throw "$tool $arguments failed with exit code $LASTEXITCODE."
}
}
Write-Host "Accepting Android SDK licenses"
Invoke-AndroidToolWithInput $sdkmanager "--licenses" $yesFile
Write-Host "Installing Android SDK emulator packages"
Invoke-AndroidToolWithInput $sdkmanager "--install `"platform-tools`" `"emulator`" `"$windowsPlatform`" `"$windowsSystemImage`"" $yesFile
Write-Host "Checking Android emulator acceleration"
& $emulator -accel-check
$accelSupported = $LASTEXITCODE -eq 0
if (-not $accelSupported) {
Write-Host "Hosted Windows runner did not report VM acceleration; forcing software acceleration for the CI smoke emulator."
}
Write-Host "Creating Android AVD"
Invoke-AndroidToolWithInput $avdmanager "create avd --force --name SimDeck_Pixel_CI --package `"$windowsSystemImage`" --device `"pixel_6`"" $noFile
$stdout = Join-Path $env:RUNNER_TEMP "simdeck-android-emulator.out.log"
$stderr = Join-Path $env:RUNNER_TEMP "simdeck-android-emulator.err.log"
$serial = "emulator-5554"
$args = @(
"-avd", "SimDeck_Pixel_CI",
"-qt-hide-window",
"-no-audio",
"-no-boot-anim",
"-no-snapshot-load",
"-no-snapshot-save",
"-wipe-data",
"-gpu", "swiftshader_indirect",
"-feature", "-Vulkan",
"-grpc", "8554",
"-port", "5554",
"-no-metrics",
"-skip-adb-auth",
"-camera-back", "none",
"-camera-front", "none",
"-cores", "2",
"-memory", "2048",
"-verbose"
)
if ($accelSupported) {
$args += @("-accel", "on")
} else {
$args += @("-accel", "off")
}
function Write-EmulatorDiagnostics {
Write-Host "adb devices:"
& $adb devices -l
if (Test-Path $stdout) {
Write-Host "emulator stdout tail:"
Get-Content $stdout -Tail 80
}
if (Test-Path $stderr) {
Write-Host "emulator stderr tail:"
Get-Content $stderr -Tail 120
}
}
Write-Host "Starting Android emulator"
$process = Start-Process -FilePath $emulator -ArgumentList $args -PassThru -RedirectStandardOutput $stdout -RedirectStandardError $stderr
$process.Id | Out-File -FilePath emulator.pid -Encoding ascii
$deviceDeadline = (Get-Date).AddMinutes(10)
$deviceSeen = $false
do {
if ($process.HasExited) {
Write-EmulatorDiagnostics
throw "Android emulator exited early with code $($process.ExitCode)."
}
$devices = (& $adb devices)
if ($devices -match "$serial\s+device") {
$deviceSeen = $true
break
}
Start-Sleep -Seconds 5
} while ((Get-Date) -lt $deviceDeadline)
if (-not $deviceSeen) {
Write-EmulatorDiagnostics
throw "Android emulator did not appear in adb before the timeout."
}
$deadline = (Get-Date).AddMinutes(20)
do {
if ($process.HasExited) {
Write-EmulatorDiagnostics
throw "Android emulator exited early with code $($process.ExitCode)."
}
$booted = (& $adb -s $serial shell getprop sys.boot_completed 2>$null | Out-String).Trim()
if ($booted -eq "1") {
break
}
Start-Sleep -Seconds 5
} while ((Get-Date) -lt $deadline)
if ($booted -ne "1") {
Write-EmulatorDiagnostics
throw "Android emulator did not boot before the timeout."
}
& $adb -s $serial shell settings put global window_animation_scale 0
& $adb -s $serial shell settings put global transition_animation_scale 0
& $adb -s $serial shell settings put global animator_duration_scale 0
$env:SIMDECK_INTEGRATION_ANDROID_AVD = "SimDeck_Pixel_CI"
$env:SIMDECK_INTEGRATION_REQUIRE_RUNNING_ANDROID = "1"
$env:SIMDECK_INTEGRATION_VERBOSE = "1"
npm run test:integration:android
$testExitCode = $LASTEXITCODE
if ($testExitCode -ne 0) {
Write-EmulatorDiagnostics
throw "Android integration tests failed with exit code $testExitCode."
}
- name: Stop Android emulator (Windows)
if: always() && runner.os == 'Windows'
shell: pwsh
run: |
$sdk = $env:ANDROID_HOME
if (-not $sdk) {
$sdk = $env:ANDROID_SDK_ROOT
}
if ($sdk) {
$adb = Join-Path $sdk "platform-tools\adb.exe"
if (Test-Path $adb) {
& $adb emu kill
if ($LASTEXITCODE -ne 0) {
Write-Host "No Android emulator accepted adb emu kill."
$global:LASTEXITCODE = 0
}
}
}
if (Test-Path emulator.pid) {
Stop-Process -Id (Get-Content emulator.pid) -Force -ErrorAction SilentlyContinue
}
exit 0