Skip to content

ci: Spike NativeAOT and tvOS tests on GHA - #24952

Draft
MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/ci-gha-aot-tvos
Draft

MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/ci-gha-aot-tvos

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #24951

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Spike: a GitHub Actions workflow (.github/workflows/runtime-tests-mobile.yml) that runs on PRs to master and mirrors two ADO stages, reusing their device scripts unchanged:

  • Android+NativeAOT Skia: build on ubuntu-24.04 (same dotnet publish as .azure-devops-tests-android-nativeaot-skia-build.yml), then 5 test shards on KVM emulators (API 34) through android-run-skia-runtime-tests.sh. Unlike ADO, the tests run on PRs.
  • tvOS Skia: build on macos-26 with the Xcode .vsts-ci.yml pins (or the newest of the same major), then 2 test shards (max-parallel: 2) through tvos-uitest-run.sh. Fewer shards than ADO's 4, because the org shares only 5 concurrent macOS jobs.

Supporting pieces:

  • .github/actions/mobile-dotnet-setup: pinned SDK from build/ci/net11/_global.json, uno-check with the version read from .vsts-ci.yml.
  • .github/scripts/select-xcode.sh: GHA port of ios-build-select-version.yml.
  • .github/scripts/check-nunit-results.py: fails the job on failed/missing results and writes a job summary (ADO uses PublishTestResults@2 for that).

ADO stages are untouched. This PR only changes .github/, which .vsts-ci.yml excludes, so it does not start an ADO run of its own. Comparison numbers will be posted in a comment.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_012psuk5dxG4cNcryRVL2VWS

@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 34s —— View job


Review complete ✅

  • Gather context (PR diff, AGENTS.md, custom review rules)
  • Review .github/actions/mobile-dotnet-setup/action.yml
  • Review .github/scripts/check-nunit-results.py
  • Review .github/scripts/select-xcode.sh
  • Review .github/workflows/runtime-tests-mobile.yml
  • Post inline findings
  • Post summary

Verdict: ship (fix-first optional) — this is CI-only infra (no src/** changes), and I traced each new script/workflow against the ADO templates and device scripts it claims to mirror (.azure-devops-tests-android-nativeaot-skia*.yml, .azure-devops-tests-tvos-skia*.yml, ios-build-select-version.yml, android-run-skia-runtime-tests.sh, tvos-uitest-run.sh). The workflow structure, job gating, artifact paths, log paths, timeout budgets, skip-lists, and shard counts all line up correctly with their ADO counterparts, including non-obvious details (e.g. the Android vs. tvOS results-file glob difference is correct, not a bug — tvOS's device script copies results into TestResult-original.xml while Android's doesn't, so each check step targets the file that's actually populated).

4 inline findings posted, all low/medium severity — none block merge, but worth a look before/after landing since this is a CI spike meant to be compared against ADO numbers:

  1. mobile-dotnet-setup/action.yml (medium confidence) — drops the --preview-major flag that ADO always passes alongside --pre-major to uno-check. Could change workload resolution if the two flags aren't aliases.
  2. mobile-dotnet-setup/action.yml (low/nit) — a composite-action input is interpolated directly into the run: shell body via ${{ }} rather than through env:. No real risk with today's literal-only callers, but it's the pattern Actions security guidance says to avoid in a reusable action.
  3. select-xcode.sh (low confidence) — the download-retry loop skips the sudo xcodebuild -runFirstLaunch reset between attempts that the ADO template does; could make retries less effective if that reset is load-bearing.
  4. check-nunit-results.py (low/nit) — a corrupt/truncated results file would raise an unhandled ParseError instead of failing through the script's friendly summary path.

No cross-cutting architectural concerns — the new .github/actions + .github/scripts split is clean, scoped only to .github/ as the PR description states, and doesn't touch ADO config.
· branch

fi

for attempt in 1 2 3; do
if uno-check -v --ci --non-interactive --fix "${SKIPS[@]}" --pre-major --tfm "$NET_TFM-${{ inputs.uno-check-tfm }}"; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible mirroring gap: missing --preview-major.

The ADO templates invoke uno-check as --pre-major ${{ parameters.UnoCheckParameters }}, where UnoCheckParameters is '--preview-major --tfm $(netCurrentTargetFramework)-android' (linux) / '--preview-major --tfm $(netCurrentTargetFramework)-tvos' (mac) — see build/ci/tests/.azure-devops-tests-android-nativeaot-skia-build.yml:26 and build/ci/templates/dotnet-mobile-install-{linux,mac}.yml. So ADO always passes both --pre-major and --preview-major.

This action only passes --pre-major, dropping --preview-major. If these aren't aliases in uno-check, workload/version resolution could behave differently here than on ADO (e.g. missing a preview workload needed for the android/tvos TFMs), which would only surface as a flaky/failing build on this new workflow. Worth double-checking uno-check's flag semantics, or adding --preview-major to match the ADO invocation exactly.

fi

for attempt in 1 2 3; do
if uno-check -v --ci --non-interactive --fix "${SKIPS[@]}" --pre-major --tfm "$NET_TFM-${{ inputs.uno-check-tfm }}"; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor hardening: ${{ inputs.uno-check-tfm }} is interpolated directly into the run: script body rather than passed through an env var.

Today the only callers in this PR pass literal strings (android, tvos), so there's no real injection risk right now. But this is a reusable composite action, and GitHub's own security guidance for Actions recommends never substituting ${{ }} expressions directly into a shell script — always route them through env: + "$VAR" — specifically so a future caller can't accidentally (or an attacker via some upstream untrusted value) inject shell metacharacters into the command. Low severity given current usage, but worth fixing while this file is new, e.g.:

      run: |
        ...
        for attempt in 1 2 3; do
          if uno-check -v --ci --non-interactive --fix "${SKIPS[@]}" --pre-major --tfm "$NET_TFM-$UNO_CHECK_TFM"; then
      env:
        UNO_CHECK_TFM: ${{ inputs.uno-check-tfm }}

Comment on lines +58 to +68
for attempt in 1 2 3; do
if sudo xcodebuild -downloadPlatform "$PLATFORM"; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "::error::$PLATFORM simulator runtime download failed after $attempt attempts."
exit 1
fi
echo "Download failed (attempt $attempt). Retrying in 30s..."
sleep 30
done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Divergence from the ADO template this mirrors: build/ci/templates/ios-build-select-version.yml re-runs sudo xcodebuild -runFirstLaunch before each retry of -downloadPlatform:

if [ "$attempt" -lt 3 ]; then
  ...
  sudo xcodebuild -runFirstLaunch
  sleep 30
fi

This loop only sleeps and retries the download, without the -runFirstLaunch reset in between. If that call exists in the ADO template to recover from a bad Xcode first-launch state after a failed download (rather than just being a harmless no-op), dropping it here could make retries less effective at resolving transient failures on the GHA runner. Worth confirming this was an intentional simplification rather than an oversight.

total = passed = failed = skipped = 0
failures = []
for path in files:
for case in ET.parse(path).getroot().iter("test-case"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor robustness gap: if a matched results file exists but is truncated/corrupt (e.g. the device/runner was killed mid-write, which is plausible given this parses output from emulator/simulator test runs that can crash), ET.parse(path) raises an uncaught ParseError. The step still ends up failing (good), but as an unhandled Python traceback instead of the friendly ### <title> summary this script is meant to produce in GITHUB_STEP_SUMMARY — so a crash mid-write looks like a tooling bug in the Actions log rather than "no/bad results produced". Consider wrapping the parse in a try/except and treating a parse failure the same as "no files" (fail with the friendly message) for easier triage.

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 57s —— View job


Review complete ✅

  • Gather context (PR diff, AGENTS.md, previous review state)
  • Review .github/actions/mobile-dotnet-setup/action.yml
  • Review .github/scripts/check-nunit-results.py
  • Review .github/scripts/select-xcode.sh
  • Review .github/workflows/runtime-tests-mobile.yml
  • Post inline findings
  • Post summary

Verdict: ship — this synchronize trigger adds one new commit (93d6edee, "ci: Install the Microsoft JDK for uno-check") on top of the state already reviewed in my previous pass. It only touches .github/workflows/runtime-tests-mobile.yml (lines 55-60), replacing the JAVA_HOME_17_X64 env-var selection with actions/setup-java@v6 + distribution: microsoft.

I verified this against build/ci/templates/dotnet-mobile-install-linux.yml:14-16, which installs msopenjdk-17 (the Microsoft build of OpenJDK) for the ADO Android path. The previous JAVA_HOME_17_X64 approach selected whichever JDK distribution GitHub's runner image preinstalls (typically Temurin), which doesn't match what uno-check expects on ADO — so this fix is correct and properly targeted at the root cause (wrong JDK vendor) rather than a workaround. Action version (@v6) is consistent with the major-version-pin convention already used for actions/checkout, actions/upload-artifact, etc. elsewhere in this same file.

No new inline findings — the change is small, self-contained, and doesn't touch the three files from my prior review pass (mobile-dotnet-setup/action.yml, check-nunit-results.py, select-xcode.sh), so the 4 low/medium findings posted there are unaffected and still stand as optional follow-ups (none block merge).
· branch

@MartinZikmund

Copy link
Copy Markdown
Member Author

Spike results

Two runs: 37035371788 (tvOS green, Android build failed on uno-check's OpenJDK checkup, fixed in 93d6ede by using the Microsoft JDK) and 37039510028 (all green).

GHA (this PR) ADO (last 40 builds of def 5, median)
tvOS build 19 min (macos-26, Xcode 26.6, tvOS 26.5 sim preinstalled) 29 min
tvOS test shards 2 shards, 14-17 min each, ~10 s queue 4 shards, 13 min each, 30 min queue (p90 53)
tvOS wall clock 34-36 min 63 min (p90 105)
tvOS results 9157 tests, 0 failed (4960 + 4197) green
NativeAOT build 28 min (2 min of that is freeing disk) 23 min
NativeAOT test shards 5 shards, 13-18 min each (~2.5 min emulator boot), ~2 s queue 12 min each, not run on PRs
NativeAOT wall clock 46 min n/a on PRs
NativeAOT results 9025 tests, 0 failed n/a on PRs

macOS slots: the tvOS path uses 1 slot for 19 min, then 2 for ~16 min (about 52 macOS runner-minutes per PR), out of the org's 5. Fork PRs would draw from the same pool.

Differences from ADO: tests run on the Xcode 26.6 / tvOS 26.5 simulator, not Xcode 15.3 on macOS-14. The bundle is still tvossimulator-x64, as on ADO.

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/ci-gha-aot-tvos branch from 93d6ede to ab72fa2 Compare October 3, 2026 08:52
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 21s —— View job


Review complete ✅

  • Gather context (PR diff, AGENTS.md, prior review state)
  • Re-check .github/actions/mobile-dotnet-setup/action.yml
  • Re-check .github/scripts/check-nunit-results.py
  • Re-check .github/scripts/select-xcode.sh
  • Re-check .github/workflows/runtime-tests-mobile.yml
  • Post inline findings (none new)
  • Post summary

Verdict: ship — the branch is unchanged since the last review pass (still 17f8c683 + ab72fa24, same file SHAs for all 4 files). No new commits to review.

I re-verified the diff against the ADO templates independently this pass rather than just reusing prior conclusions, specifically re-checking the one asymmetry that looked suspicious: the tvOS build job (runtime-tests-mobile.yml:160-161) selects the preinstalled JAVA_HOME_17_arm64 instead of installing the Microsoft JDK the way the Android job now does. I traced this against build/ci/templates/dotnet-mobile-install-mac.yml → jdk-setup.yml, which confirms the ADO mac template also just selects the agent's preinstalled JDK (JAVA_HOME_17_X64) rather than installing msopenjdk— that's Linux-only behavior (dotnet-mobile-install-linux.yml apt-installs msopenjdk-17). So the tvOS job's JDK handling correctly mirrors ADO; not a bug.

I also diffed the build/test steps in .azure-devops-tests-android-nativeaot-skia-build.yml, .azure-devops-tests-tvos-skia-build.yml, and .azure-devops-tests-android-nativeaot-skia.yml line-by-line against the corresponding GHA jobs — publish args, artifact paths, and the --preview-major flag question (confirmed present in both ADO mac and linux templates, reinforcing finding #1 from the previous pass) all check out with no additional discrepancies found.

The 4 inline findings from the previous review pass (missing --preview-major, direct ${{ }} interpolation into a composite action's shell body, missing -runFirstLaunch reset between Xcode download retries, unhandled ParseError on corrupt NUnit XML) are unaffected by this unchanged state and still stand as optional follow-ups — none block merge. No new findings this pass.
· branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run NativeAOT and tvOS runtime tests on PRs via GitHub Actions

1 participant