ci(device-tests): add a reusable workflow that runs device test apps on an emulator and simulator - #78
Merged
Conversation
…on an emulator and simulator - Add scripts/device-tests.cs, a file-based app that boots a headless Android emulator or iOS simulator, runs the test app, collects the TRX report and device logs, and shuts the device down - Run Android through the .NET SDK's `dotnet test --device` and iOS through simctl, refusing hosts that cannot run the platform - Add workflow-common-device-tests.yml with an Android job on Linux and an iOS job on macOS, each skippable and uploading its results - Check the script out at job.workflow_sha so a caller pinned to a branch runs that branch's script - Document the workflow and the local command in README.md
- Default --framework to the project's first -android or -ios target framework instead of a fixed one - Leave the workflow's framework inputs empty by default so the script chooses
Merged
3 of 4 tasks
Comment on lines
+85
to
+95
| - name: Checkout device-tests script | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| repository: reactiveui/actions-common | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .device-tests-tooling | ||
| sparse-checkout: scripts | ||
| persist-credentials: false | ||
|
|
||
| # The hosted runner has KVM, but only root can open /dev/kvm until a udev rule opens it to the runner user. | ||
| - name: Enable KVM |
Comment on lines
+153
to
+162
| - name: Checkout device-tests script | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| repository: reactiveui/actions-common | ||
| ref: ${{ job.workflow_sha }} | ||
| path: .device-tests-tooling | ||
| sparse-checkout: scripts | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup .NET Environment |
- Avoid the undisposed JsonDocument that fails the script's build under a caller's analyzer settings
- Choose the device type from the runtime's supported device types, since the global list includes iPhones the newest runtime cannot boot
… cannot boot - Point avdmanager and the emulator at one ANDROID_AVD_HOME, since on hosted runners they looked in different folders and the emulator could not find the AVD it had just created - Check the created AVD is visible to the emulator before booting it - Refuse to start when /dev/kvm is not writable, stop waiting as soon as the emulator exits, and print emulator.log to the job log on a failed boot - Give the emulator 4 GB and 4 cores, skip metrics, and allow a 15-minute cold boot
…eport what was searched
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A new reusable workflow runs a repository's device test apps on a headless Android emulator and an iOS simulator, through one script developers can also run locally.
workflow-common-device-tests.ymlhas an Android job on Linux and an iOS job on macOS. The jobs are nameddevice-tests (android)anddevice-tests (ios)for branch protection.runAndroid: falseorrunIos: falseskips a job, which still passes a required check.scripts/device-tests.csdoes the whole device lifecycle. It boots a headless emulator or a fresh simulator, runs each test app, collects the report and logs, shuts the device down, and exits non-zero when a test fails.dotnet test --device <serial>installs the app, starts its instrumentation, streams each result and writes the TRX report on the host./dev/kvm.Why
Platform code under
Platforms/android,apple-commonanduikit-commononly runs on a device, so no CI job exercised it.@ci/device-tests) until this one merges, then switches to@main.Breaking changes
None. This adds a workflow and a script; no existing workflow changes.
How this was verified
The Android leg ran end to end on a local Linux host with KVM, in Debug and Release, against ReactiveUI's device test app.
Notes for the reviewer
Start with
scripts/device-tests.cs; the workflow is thin around it.job.workflow_sha, so a caller pinned to this branch runs this branch's script. actionlint 1.7.12 does not know that documentedjobproperty yet and flags it (fix: add documented job workflow context properties rhysd/actionlint#707).-read-onlyand its own AVD (rxui-device-tests, created when missing), so it does not touch a developer's running emulators.macos-latest.Checklist