ci: use mold for Linux Rust builds#238
Conversation
|
51c1ac1 to
ddce4f6
Compare
ddce4f6 to
b885a3d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be31307442
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GCC only accepts -fuse-ld=mold from GCC 12 onward, so the RUSTFLAGS approach would fail at link time on the ubuntu-22.04 release runners (GCC 11) — paths that never run on PR CI. make-default symlinks /usr/bin/ld to mold, which works on any GCC, keeps RUSTFLAGS and rust-cache keys untouched, and lets release.yml reuse the composite action instead of an inline copy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
release.yml can be dispatched with a release_tag whose checkout predates the local composite action, which would fail to resolve. The remote setup-mold action resolves at any checkout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
rui314/setup-mold@v1action instead of apt, then configure Cargo/Rust withRUSTFLAGS=-C link-arg=-fuse-ld=mold.Motivation
TraceDecay's Rust build spends enough time in heavy native/link phases that Linux builds were worth benchmarking against mold, especially since Windows already uses
lld-link.Official mold sources recommend this path: the mold README links to “our setup-mold GitHub Action,” and that action is published under the same
rui314owner asrui314/mold.Local clean debug binary benchmark on this machine:
2:28.61wall clockclang -fuse-ld=mold:1:51.26wall clockRUSTFLAGS=-C link-arg=-fuse-ld=mold:1:53.68wall clockThe mold build's binary included
mold 2.30.0 (compatible with GNU ld)in.comment, confirming the intended linker path was actually used.GitHub Actions evidence is more mixed. The first PR run was slower on Linux jobs because changing linker env caused cold Rust target-cache behavior. After rerunning
Test Linuxwarm on the same branch/run, it was essentially neutral rather than faster:Test Linux:2:58vs recent pre-moldmastermedian2:56Test Linux/Run testsstep:2:15vs recent pre-mold median2:10Clippy:1:58vs recent pre-mold median1:42, but the actualRun blocking Clippy policystep was identical at1:15; mold setup/cache overhead explains the job-level deltaDashboard:3:35vs recent pre-mold median3:28Hermes integration:2:13vs recent pre-mold median1:53, while the actualBuild tracedecay binarystep was slightly faster at1:08vs1:10Swatinem/rust-cachealready includes compiler env such asRUSTFLAGSin its cache key, so this PR keeps the existing shared keys and lets the cache action separate artifacts by its built-in Rust environment hash instead of adding an extra mold-specific suffix.Changes
.github/actions/setup-linux-mold/action.ymldelegates installation torui314/setup-mold@v1and exports the Rust linker flag..github/workflows/ci.ymluses the local action for Linux Rust test, clippy, dashboard, and Hermes jobs..github/workflows/release-plz.ymluses the local action for Ubuntu release-plz jobs..github/workflows/release.ymland.github/workflows/release-beta.ymluserui314/setup-mold@v1plus explicit Rust linker flags for Linux release matrices.Test plan
actionlint .github/workflows/ci.yml .github/workflows/release.yml .github/workflows/release-beta.yml .github/workflows/release-plz.ymlgit diff --checkRUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 cargo build --bin tracedecay --lockedreadelf -p .comment /scratch/cargo-target/linux-ci-mold-linker_-7759b4054875/debug/tracedecay | rg -i 'mold|LLVM|GCC'51c1ac1passedTest Linuxon the same run passed in2:58rui314/setup-mold@v1Checklist
CHANGELOG.mdupdated (N/A: CI-only change).envfiles included