ci: cross-compile osx-x64 CLI archive on Apple Silicon runner#18190
Open
radical wants to merge 1 commit into
Open
ci: cross-compile osx-x64 CLI archive on Apple Silicon runner#18190radical wants to merge 1 commit into
radical wants to merge 1 commit into
Conversation
The "Build native CLI archive (macOS x64)" job ran on the macos-15-intel runner, where Native AOT codegen (IlcCompile) dominates wall time. The Intel runner is ~2.5x slower per core than Apple Silicon, making this job the long pole of the CLI build matrix: ~18m vs ~8m for the osx-arm64 job on macos-latest. Build osx-x64 on the arm64 macos-latest runner instead, cross-compiling the x64 archive. Native AOT officially supports arm64 -> osx-x64 cross-compilation (.NET 8+), and the reusable build workflow only packages and structurally verifies the archive (verify-cli-tool-nupkg.ps1 / verify-cli-npm-package.ps1) -- it never executes the x64 binary, so x64-on-arm64 execution is never attempted. This mirrors the AzDO release pipeline, which already builds osx-x64 on an arm64 mac agent (eng/pipelines/templates/build_sign_native.yml). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18190Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18190" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR speeds up the macOS x64 CLI build job in GitHub Actions by cross-compiling on an Apple Silicon (macos-latest) runner instead of the slower Intel (macos-15-intel) runner, leveraging .NET Native AOT's official arm64→x64 cross-compilation support.
Changes:
- Switches the
build_cli_archive_macos_x64job's runner frommacos-15-inteltomacos-latest(Apple Silicon) for cross-compilation - Adds an informative comment explaining the rationale, safety guarantees, and precedent from the AzDO release pipeline
Contributor
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Build native CLI archive (macOS x64) job is the long pole of the CLI build matrix on PRs — ~18m vs ~8m for the equivalent osx-arm64 job.
Root cause: it ran on the
macos-15-intelrunner. The dominant cost is Native AOT codegen; theBuildCli.binlogfrom run 27448293173 showsIlcCompile~327s,CoreCompile~193s,LinkNative~84s. The Intel runner is ~2.5x slower per core than Apple Silicon, so every step pays that tax.The fix: build osx-x64 on the arm64
macos-latestrunner, cross-compiling the x64 archive. Native AOT officially supports arm64 → osx-x64 cross-compilation (.NET 8+); no project changes are needed — the SDK resolves the osx-x64 NativeAOT runtime package and clang targetsx86_64-apple-macosautomatically.Why this is safe: the reusable build workflow (
build-cli-native-archives.yml) only packages and structurally verifies the archive (verify-cli-tool-nupkg.ps1/verify-cli-npm-package.ps1check the binary's presence in the nupkg/npm package, never run it). The x64 binary is never executed, so running x64 on arm64 hardware is never attempted. This mirrors the AzDO release pipeline, which already builds osx-x64 on an arm64 mac agent (eng/pipelines/templates/build_sign_native.yml), gating only its execute-verify step by agent arch.Validation: cross-compile was reproduced locally on Apple Silicon —
dotnet publish -r osx-x64 -p:PublishAot=trueproduced a realMach-O 64-bit executable x86_64(confirmed withfile/lipo -archs). This PR's ownmacos-latestrun is the end-to-end proof on GitHub-hosted hardware.Fixes # (issue)
Checklist