Skip to content

ci: run unit tests under Native AOT#374

Merged
thomhurst merged 1 commit into
mainfrom
ci/aot-tests
Jul 22, 2026
Merged

ci: run unit tests under Native AOT#374
thomhurst merged 1 commit into
mainfrom
ci/aot-tests

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

Adds .github/workflows/aot.yml: publishes EnumerableAsyncProcessor.UnitTests with PublishAot=true and runs the native binary, verifying the library's runtime behaviour under Native AOT (IsAotCompatible only runs compile-time analyzers).

  • Matrix over net8.0 and net10.0 — net8.0 also exercises the pre-net9 completion-order streaming path in ToIAsyncEnumerable; net10.0 covers the Task.WhenEach path.
  • Runs the Microsoft.Testing.Platform executable directly; a failing test run exits non-zero and fails the job.

Notes

  • Local verification not possible (no C++ linker on dev machine); this PR run is the verification.
  • Publishing surfaces ~26 IL2026 warnings, all from TUnit's IsEquivalentTo (RequiresUnreferencedCode for structural comparison). Usages here are primitive collections, so they should behave correctly under AOT; warnings left visible rather than suppressed.

@thomhurst
thomhurst deployed to Pull Requests July 22, 2026 21:09 — with GitHub Actions Active
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a new GitHub Actions workflow (.github/workflows/aot.yml) that publishes the unit-test project as a Native AOT binary and executes it, providing runtime AOT verification beyond what the existing IsAotCompatible MSBuild property supplies (which is compile-time only).

  • Runs a matrix over net8.0 and net10.0, using only the .NET 10 SDK (sufficient to cross-target net8.0), with fail-fast: false so both legs always report independently.
  • Executes the resulting binary directly via Microsoft.Testing.Platform, so a non-zero exit from a failing test fails the job naturally.
  • net9.0 is intentionally omitted from the matrix (rationale in the PR description), but the test .csproj still targets it — this gap is worth a comment in the workflow for future maintainers.

Confidence Score: 4/5

The workflow is safe to merge; it adds CI coverage without touching any library or test source code.

The workflow is straightforward and consistent with the existing CI patterns in this repo. The only notable gap is that net9.0 — a framework the test project explicitly targets — is not included in the AOT matrix, which means a future net9.0-specific regression could slip through undetected. The rationale for skipping it is explained in the PR description but not in the workflow file itself.

.github/workflows/aot.yml — specifically the matrix definition and the absence of a comment explaining why net9.0 is excluded despite being a targeted framework.

Important Files Changed

Filename Overview
.github/workflows/aot.yml New CI workflow that publishes the unit-test project as a Native AOT binary and runs it on a net8.0/net10.0 matrix; functionally sound, though net9.0 is intentionally omitted and only the .NET 10 SDK is installed.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant CO as actions/checkout@v7
    participant SDK as actions/setup-dotnet@v6
    participant CLI as dotnet CLI
    participant BIN as AOT Binary

    GH->>CO: Checkout repo (persist-credentials: false)
    GH->>SDK: Install .NET 10.0.x SDK
    loop matrix: [net8.0, net10.0]
        GH->>CLI: "dotnet publish -f {framework} -r linux-x64 -c Release -p:PublishAot=true"
        CLI-->>GH: "Native binary at bin/Release/{framework}/linux-x64/publish/"
        GH->>BIN: Execute binary (Microsoft.Testing.Platform)
        BIN-->>GH: Exit 0 (all tests pass) / non-zero (failure)
    end
Loading

Reviews (1): Last reviewed commit: "ci: run unit tests under Native AOT" | Re-trigger Greptile

Comment thread .github/workflows/aot.yml
Comment on lines +20 to +21
framework: [net8.0, net10.0]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 net9.0 AOT coverage gap

The test project targets net8.0;net9.0;net10.0 (see EnumerableAsyncProcessor.UnitTests.csproj), but the matrix skips net9.0. The PR description explains the rationale (net8 covers the pre-net9 streaming path; net10 covers Task.WhenEach), but net9.0 is a distinct TFM with its own runtime behaviour and could have different AOT trimming characteristics. If a net9.0-specific code path is ever added, it would fall through this gate silently. Worth at least a brief inline comment in the matrix entry explaining why net9.0 is intentionally absent.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@thomhurst
thomhurst merged commit ad235dc into main Jul 22, 2026
9 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.

1 participant