Skip to content

Add NativeAOT dotnet tool packaging and E2E smoke test#15955

Draft
radical wants to merge 8 commits intomicrosoft:mainfrom
radical:ankj/dotnet-tool-naot-azdo
Draft

Add NativeAOT dotnet tool packaging and E2E smoke test#15955
radical wants to merge 8 commits intomicrosoft:mainfrom
radical:ankj/dotnet-tool-naot-azdo

Conversation

@radical
Copy link
Copy Markdown
Member

@radical radical commented Apr 8, 2026

Summary

Adds CI plumbing and an E2E smoke test for the dotnet tool install packaging path of the Aspire CLI.

Changes

CI Workflow (build-cli-native-archives.yml, run-tests.yml):

  • Upload Aspire.Cli.{rid}.*.nupkg as a CI artifact from the native archives build
  • Download the linux-x64 nupkg in test jobs and set ASPIRE_CLI_TOOL_NUPKG_DIR env var

E2E Test (DotnetToolSmokeTests.cs):

  • Validates the full distribution chain: dotnet tool install → self-extracting bundle → aspire new + aspire run
  • Reuses existing Docker/Hex1b infrastructure with a custom install step
  • Skips gracefully when no linux-x64 nupkg is available

Motivation

The existing CLI E2E tests install the native binary directly (mount or download), but none test the dotnet tool packaging path. Since the dotnet tool wraps a native AOT binary via SelfExtractingBundle, we need a test that validates the full distribution chain.

Testing

  • Build compiles clean (0 warnings, 0 errors)
  • Test will run as its own CI job via SplitTestsOnCI=true

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15955

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15955"

@github-actions
Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

radical and others added 7 commits April 20, 2026 12:03
Squashed NativeAOT dotnet-tool changes, excluding aspire-update-json.

Changes:
- Make CLI dotnet-tool nupkg contain NativeAOT binary
- Add NativeAOT tool pack to AzDO pipeline
- Split stage/publish loops so 1ES compliance steps run once
- Add dotnet-tool smoke test to GitHub CI
- Add C# dotnet-tool install smoke test
- Add CLI E2E tests for dotnet tool installation and self-update
- Fix Windows dotnet tool test for NativeAOT .cmd shim
- Dispose ServiceProvider in UpdateCommand tests to close log file handles
- Collapse/merge Windows+Unix step pairs in build-cli-native-archives
- Remove cli_dotnet_tool_smoke_test job from tests.yml

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add eng/clitoolpack/ with per-RID projects that mirror the eng/clipack/
pattern. When the native build runs with TargetRids, this produces the
Aspire.Cli dotnet tool nupkg alongside the CLI archives — same build,
same artifacts.

- 7 per-RID csproj wrappers (one per supported RID)
- Common.projitems: NoTargets project that calls Restore+Pack on
  Aspire.Cli.Tool.csproj with the correct RID, NativeAOT settings,
  BundlePayloadPath, and version properties
- eng/Build.props: wired into the native build section next to clipack

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… races

Instead of a separate eng/clitoolpack/ directory with per-RID wrappers that
ran as parallel ProjectToBuild items (racing on shared deps like
Aspire.TypeSystem.deps.json), add a PackCliTool target to clipack's
Common.projitems that runs AfterTargets="Build". This ensures the tool
nupkg is produced after the archive publish, reusing cached dependency
outputs without file locking.

Removes: eng/clitoolpack/ (8 per-RID csprojs + Common.projitems)
Modifies: eng/clipack/Common.projitems (adds PackCliTool target)
Modifies: eng/Build.props (removes _NativeToolPackProject items)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the per-RID 'dotnet pack Aspire.Cli.Tool.csproj' step from after
the main build+sign step into the per-RID loop that runs before it.
This ensures the tool nupkgs are already in Shipping when Arcade's
-sign step runs, so they get signed alongside all other packages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove duplicate PackCliTool target from Common.projitems that was
  overwriting signed nupkgs with unsigned ones during Build step
- Keep pack step ordering: pack before build+sign in build_sign_native.yml
  so Arcade's --sign signs the nupkg
- Add verify-cli-tool-nupkg.sh (Unix) and verify-cli-tool-nupkg.ps1
  (Windows) validation scripts that check:
  - nupkg existence for the target RID
  - size sanity (>5MB for NativeAOT binary)
  - binary presence and file type (ELF/Mach-O/PE)
  - primary pointer package existence
- Wire validation steps into both pipeline templates:
  - build_sign_native.yml: runs for all macOS/Linux RIDs
  - BuildAndTest.yml: runs for all Windows RIDs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@radical radical force-pushed the ankj/dotnet-tool-naot-azdo branch from 544e9aa to 2f6c0e9 Compare April 20, 2026 23:01
Move tool nupkg creation inside clipack via _PackCliTool target, which
runs after _PublishProject. Instead of having dotnet pack compile its own
NativeAOT binary (which fails for cross-RID targets), we pass the
clipack-built binary via PreBuiltCliBinaryPath. The csproj sets
IsPublishable=false to skip the SDK's Publish step and copies the
pre-built binary to PublishDir for PackTool to glob.

This ensures:
- No cross-compilation failures (binary is built by clipack on matching OS)
- Signing alignment (nupkg in Shipping dir before Arcade --sign runs)
- SDK still generates DotnetToolSettings.xml with Runner="executable"
- Works across all contexts: GH Actions, AzDO macOS/Linux, AzDO Windows

Removes standalone 'Pack CLI dotnet-tool' steps from all three pipelines
since clipack now handles it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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