Skip to content

Add CI workflow to build all /samples projects on PR #509

Description

@adrianhall

Summary

Surfaced during the #499 / #508 investigation (and noted as a gap in #507): /samples has no CI coverage at all today. None of the existing workflows (build-library.yml, build-docs.yml, build-template.yml) touch the samples/** path, so a PR can introduce a broken sample (bad package bump, breaking API change, stale TargetFramework, etc.) and nothing will catch it until someone manually opens the solution or a security scan flags a transitive dependency. That's effectively what happened with #492/#498/#499/#506 — none of those regressions were caught by CI.

This issue asks for a new workflow that builds every sample solution whenever a PR touches samples/**, mirroring the path-filtered pull_request trigger pattern already used by build-library.yml and build-template.yml.

Inventory of what needs building

Sample Solution TFMs Runner / workload needs
Avalonia TodoApp samples/todoapp/TodoApp.Avalonia/TodoApp.Avalonia.sln net10.0 (shared+desktop), net10.0-android, net10.0-ios ubuntu-latest for shared+desktop; android workload for Android head; ios workload + macOS/Xcode for iOS head
Uno TodoApp samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.26100;net10.0-browserwasm;net10.0-desktop Uno.Sdk (pinned via global.json, currently 5.4.5) + android/ios/maui/wasm-tools workloads across runners; note: the desktop head currently has a pre-existing NU1605 (Uno.WinUI version mismatch) per #506 that will need resolving before this head builds cleanly in CI
WinUI3 / WPF / MAUI TodoApp samples/todoapp/Samples.TodoApp.sln net10.0-windows10.0.19041.0 (WinUI3), net10.0-windows (WPF), net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.26100;net10.0-browserwasm;net10.0-desktop (MAUI) windows-latest required for WinUI3/WPF and the MAUI Windows TFM; maui/android/ios workloads for the rest
Datasync server sample samples/datasync-server/Sample.Datasync.Server.sln net10.0 ubuntu-latest, no extra workloads
Datasync server (Cosmos DB) sample samples/datasync-server-cosmosdb-singlecontainer/Datasync.Server.CosmosDb.SingleContainer.sln net10.0 ubuntu-latest, no extra workloads (the infra/ Bicep/Terraform, if present, is out of scope for a dotnet build job)
TodoApp tutorial samples/todoapp-tutorial/todoapp.sln net10.0 ubuntu-latest, no extra workloads
TodoApp MVC samples/todoapp-mvc/part5.sln net10.0 ubuntu-latest, no extra workloads
TodoApp Blazor WASM samples/todoapp-blazor-wasm/TodoApp.BlazorWasm.sln net10.0 ubuntu-latest, likely needs wasm-tools workload for the client head

Suggested approach

Given how heterogeneous the runner/workload requirements are across this list, a single dotnet build **/*.sln step won't work. Suggest a phased rollout instead of trying to cover everything in one PR:

  1. Phase 1 — low-hanging fruit: add a build-samples.yml workflow (triggered on pull_request/push to main with paths: ['samples/**', '.github/workflows/build-samples.yml']) that builds the plain net10.0 samples with no extra workloads on ubuntu-latest: datasync-server, datasync-server-cosmosdb-singlecontainer, todoapp-tutorial, todoapp-mvc, todoapp-blazor-wasm, and the Avalonia shared+Desktop projects (TodoApp.Avalonia.csproj + TodoApp.Avalonia.Desktop.csproj) specifically (not the full .sln, to avoid pulling in the Android/iOS heads before workloads are set up).
  2. Phase 2 — Windows-only heads: add a windows-latest job for TodoApp.WPF, TodoApp.WinUI3, and the MAUI Windows TFM.
  3. Phase 3 — mobile heads: add android/ios/maui workload installation steps and build the Android/iOS heads for Avalonia, Uno, and MAUI. iOS builds will need a macOS runner. This phase should start with Avalonia (the pattern is simplest — 2 mobile heads, no Uno.Sdk complications) before attempting Uno, since Uno's desktop head is currently blocked by the unrelated NU1605 from Investigate resolving NU1903 for Tmds.DBus in Uno desktop sample #506.
  4. Consider continue-on-error: true (or excluding entirely) for any sample/head known to have a pre-existing, unrelated build break (e.g., Uno desktop per Investigate resolving NU1903 for Tmds.DBus in Uno desktop sample #506) until that's fixed, so the new workflow doesn't start life red for reasons outside a given PR's control.

Should be build-only (dotnet restore + dotnet build), not run/test — most of these are UI apps without a practical headless test story today. A follow-up could explore headless Avalonia UI tests, but that's out of scope here.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions