Skip to content

ci(maui): build, check and smoke-test the Android sample in Release (#368) - #369

Merged
michaelstonis merged 3 commits into
spec/33-broadside-v1from
368-maui-android-release-ci
Oct 19, 2026
Merged

michaelstonis merged 3 commits into
spec/33-broadside-v1from
368-maui-android-release-ci

Conversation

@michaelstonis

Copy link
Copy Markdown
Owner

Closes #368

Stacked on #367. This branch merges 366-maui-android-aot-crash so the new Release coverage runs against the fixed sample. Merge #367 first; after that, this diff is only the CI change. Without #367, the new maui step fails on the integration branch, which is the point of the step.

Summary

CI's maui job built the MAUI sample for Android only in Debug. Debug has no AOT images, so #366 got through: in Release, the APK packaged assemblies its AOT images were not compiled from, and the app aborted at startup.

  • ci.yml › maui (every PR): builds the sample in Release with -warnaserror (ILLink and AOT on, default ABIs arm64 and x86_64), then runs tools/ApkAotCheck on the APK.
  • tools/ApkAotCheck (new): the brief proposed comparing obj/.../android/assets/<abi>/ with obj/.../aot-in/. Those folders only exist with AndroidLinkMode=None; with the SDK default (SdkOnly, which fix(viewer): Android MAUI sample crashes at startup with AOT (#366) #367 restores) both are missing, so that check would pass without checking anything. This tool checks the APK instead. Mono writes into each AOT image the MVIDs of the assembly it compiled and of every assembly that one references. For each ABI, the tool reads libassembly-store.so (ELF payload section, store v3, LZ4-compressed entries), takes each assembly's MVID, and requires two things: every libaot-X.so holds X's MVID, and it holds no MVID of an assembly the APK doesn't ship. It fails when it finds no AOT images, and it fails loudly on an unknown store version.
  • maui-android.yml (new; weekly, workflow_dispatch, and PRs that touch the sample, the viewer shells, tools/ApkAotCheck, Directory.*.props or global.json): builds Release for android-x64, runs the same check, boots an API 35 x86_64 emulator (reactivecircus/android-emulator-runner, SwiftShader) and runs samples/Broadside.Viewer.Maui.Sample/smoke-android.sh. That script installs the APK, sends the smoke intent, and requires BROADSIDE_SMOKE_OK before any of: BROADSIDE_SMOKE_FAILED, an F monodroid abort, a fatal signal in the app's pid, the process exiting, or 300 s. I kept it out of ci.yml per spec Spec: Broadside v1 #33 open decision 9, the same as android.yml.

Docs: .github/workflows/README.md (the maui row and a new section), tools/ApkAotCheck/README.md, and the sample README.

Public API changes

None. No spec clause, so no conformance rows.

Time added

Where Added Source
ci.yml › maui: Release build + check TIME_CI CI run on this PR
maui-android.yml › smoke (whole job, not on every PR) TIME_SMOKE CI run on this PR
Local reference (M-series Mac, clean): Release build of both ABIs 248 s dotnet build … -c Release
Local reference: smoke run, install to BROADSIDE_SMOKE_OK 5–6 s smoke-android.sh on an API 35 SwiftShader emulator

Verification

  • Fixed sample (this branch), Release, both ABIs: ApkAotCheck reports arm64-v8a: 102 assemblies, 102 AOT images, OK and the same for x86_64, exit 0.
  • The MAUI sample: Android Release (AOT) aborts at startup on a class layout mismatch #366 APK (-p:AndroidLinkMode=None, 299 assemblies): exit 1, 19 problems per ABI, for example libaot-Xamarin.AndroidX.Core.dll.so was compiled from a different Xamarin.AndroidX.Core.dll than the one packaged, and 16 images compiled against the unmodified AndroidX.Core MVID.
  • smoke-android.sh on a throwaway API 35 arm64 AVD with -gpu swiftshader_indirect:
  • dotnet build tools/ApkAotCheck -c Release -warnaserror and dotnet format tools/ApkAotCheck/ApkAotCheck.csproj --verify-no-changes are clean (the tool is in Broadside.slnx and Broadside.Core.slnf, so build-test and format cover it). actionlint is clean on both workflows.
  • Not covered: no unit tests for the tool. It reads a binary format produced only by an Android build, and the two real APKs above are its test. A fixture would mean committing a multi-MB APK.

🤖 Generated with Claude Code

michaelstonis and others added 2 commits October 19, 2026 13:13
…368)

The maui job built the sample for Android only in Debug, which has no
AOT images, so #366 (the APK shipped assemblies its AOT images were not
compiled from, and the app aborted at startup) passed CI.

- ci.yml maui: build the sample in Release (ILLink and AOT, arm64 and
  x86_64) with -warnaserror, then run tools/ApkAotCheck on the APK.
- tools/ApkAotCheck: reads each ABI's assembly store from the APK and
  requires that every libaot-X.so holds X's MVID and only MVIDs of
  assemblies the APK ships. Fails the #366 APK with 19 problems per ABI.
- maui-android.yml: Release x86_64 build, the same check, and the smoke
  intent on an API 35 emulator via smoke-android.sh. Weekly and on
  pull requests touching the sample or its inputs (open decision 9).

Signed-off-by: Michael Stonis <michael.stonis@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Linux target selection, smoke-monitoring races and missing automated checker coverage need correction before approval.

3 open issues
What changed in this PR

Adds Android Release coverage for the MAUI sample to catch assembly/AOT mismatches behind #366, building on #367.

Changes:

  • Builds and checks Release APKs in regular CI.
  • Adds scheduled, manual and path-triggered emulator smoke testing.
  • Introduces an APK consistency checker and documents the workflow.
File Description
tools/​ApkAotCheck/​README.md Documents checker usage and validation.
tools/​ApkAotCheck/​Program.cs Provides command-line reporting and exit codes.
tools/​ApkAotCheck/​ApkAotChecker.cs Reads packaged assemblies and checks AOT identifiers.
tools/​ApkAotCheck/​ApkAotCheck.csproj Defines the checker executable.
samples/​Broadside.Viewer.Maui.Sample/​smoke-android.sh Installs and monitors the smoke run.
samples/​Broadside.Viewer.Maui.Sample/​README.md Documents Android smoke execution.
samples/​Broadside.Viewer.Maui.Sample/​Broadside.Viewer.Maui.Sample.csproj Restores default Android linking.
Broadside.slnx Includes the checker project.
Broadside.Core.slnf Includes the checker in core validation.
.github/​workflows/​README.md Documents Release and emulator coverage.
.github/​workflows/​maui-android.yml Adds the emulator smoke workflow.
.github/​workflows/​ci.yml Adds Release builds and APK checks.

Review effort: Balanced

Comment on lines +77 to +78
dotnet build samples/Broadside.Viewer.Maui.Sample -f net10.0-android -c Release -warnaserror
-p:RuntimeIdentifier=android-x64 -p:AndroidSdkDirectory="$ANDROID_HOME"
Comment on lines +21 to +38
pid=$(adb shell pidof "$package" | tr -d '\r')

while (( SECONDS - start < timeout )); do
log=$(adb logcat -d)
if grep -q "BROADSIDE_SMOKE_OK" <<<"$log"; then
grep -m 1 "BROADSIDE_SMOKE_OK" <<<"$log"
echo "Smoke run passed in $(( SECONDS - start )) s."
exit 0
fi

# monodroid only logs for .NET apps, and this emulator runs one; a fatal signal counts only in the app's process.
if grep -qE "BROADSIDE_SMOKE_FAILED|F monodroid" <<<"$log" || { [[ -n "$pid" ]] && grep -qE "Fatal signal.* pid $pid " <<<"$log"; }; then
echo "Smoke run failed after $(( SECONDS - start )) s."
dump_log
exit 1
fi

if [[ -z "$(adb shell pidof "$package" | tr -d '\r')" ]]; then
private const string AotImagePrefix = "libaot-";
private const string AssemblyStoreFile = "libassembly-store.so";

public static IReadOnlyList<AbiReport> Check(string apkPath)
@michaelstonis
michaelstonis merged commit ec190bc into spec/33-broadside-v1 Oct 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants