Skip to content

ci: build release binaries with Bun's AOT compiler - #3718

Merged
dyoshikawa merged 1 commit into
mainfrom
ci/bun-aot-binaries
Oct 31, 2026
Merged

dyoshikawa merged 1 commit into
mainfrom
ci/bun-aot-binaries

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

Build the release binaries with Bun's ahead-of-time compiler (bun compile, i.e. bun build --compile --aot) instead of --bytecode.

AOT compiles the CLI to machine code at build time. Measured locally on linux-x64 (i7-7700K, WSL2) with hyperfine (-N --warmup 2), same commit, generate with --dry-run:

AOT (Bun 1.4.4-canary.1) --bytecode (Bun 1.4.4) Node (dist/)
--version 35 ms 81 ms 433 ms
generate --targets claudecode --features rules 53 ms 110 ms 481 ms
generate --targets '*' --features rules 361 ms 552 ms 1022 ms
generate --targets '*' --features '*' 15.7 s 18.6 s 25.3 s
Peak RSS of --version 49 MB 102 MB 137 MB
Binary size (gzip) 104 MB (48 MB) 163 MB (79 MB) -
Required glibc 2.17 2.17 -

In CI, the Test binary step went from 200 s to 70 s on Linux x64 and from 389 s to 112 s on Windows (whose binary had no --bytecode), and the whole E2E workflow from ~11 min to ~5 min.

The full E2E suite (1514 tests) passes against the AOT binary.

Changes

  • New composite action .github/actions/build-bun-binary: switches Bun to canary, prints its revision, runs bun compile --minify, and smoke-tests --version.
  • AOT cannot cross-compile, so both workflows now build each binary on a native runner: ubuntu-latest (linux-x64), ubuntu-24.04-arm (linux-arm64), macos-latest (darwin-arm64), macos-15-intel (darwin-x64), windows-latest (windows-x64).
  • e2e-binaries.yml: the separate build job and the binary cache are gone; each matrix leg builds its own binary and runs the E2E suite against it, so linux-arm64 and darwin-x64 are now tested too.
  • publish-assets.yml: a new build-binaries matrix job (read-only permissions) uploads each binary as an artifact; build-assets downloads them and continues as before (checksums, attestation, release upload). Asset names are unchanged.
  • --sourcemap is dropped: with AOT only --sourcemap=external has an effect, and the binary already reports source positions.
  • Windows now gets the same build as the others. Its --bytecode build used to segfault; the AOT build is checked by the Windows E2E leg.

Caveats

  • AOT has only shipped in Bun canary so far (stable 1.4.4 has no bun compile). Canary moves daily and cannot be pinned, so builds are not reproducible; the revision is printed in every build log. Once a stable Bun ships AOT, bun upgrade --canary should be removed.
  • AOT is marked experimental upstream.
  • A build takes ~25 s per binary instead of a few seconds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XcU6mYjWis3a6YpqCW2xgB

Compile the binaries with `bun compile` (Bun canary) on a native runner per
target, since AOT cannot cross-compile. Locally on linux-x64 the AOT binary
starts in ~40 ms instead of ~220 ms with --bytecode and is 104 MB instead of
163 MB, and passes the whole E2E suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XcU6mYjWis3a6YpqCW2xgB
@dyoshikawa
dyoshikawa merged commit ae3ff7b into main Oct 31, 2026
13 checks passed
@dyoshikawa
dyoshikawa deleted the ci/bun-aot-binaries branch October 31, 2026 07:10
@dyoshikawa dyoshikawa mentioned this pull request Oct 31, 2026
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