Skip to content

ci: use mold linker for faster CI builds#71

Merged
panos-xyz merged 3 commits intomainfrom
panos/ci-mold
Mar 31, 2026
Merged

ci: use mold linker for faster CI builds#71
panos-xyz merged 3 commits intomainfrom
panos/ci-mold

Conversation

@panos-xyz
Copy link
Copy Markdown
Contributor

@panos-xyz panos-xyz commented Mar 27, 2026

Summary

  • Install mold multi-threaded linker via rui314/setup-mold in build, clippy, and test jobs
  • Pass -C link-arg=-fuse-ld=mold via RUSTFLAGS to use mold instead of default single-threaded ld
  • fmt and doc-test jobs excluded (don't produce linked binaries)

Both scroll-reth and tempo use mold in CI for faster builds.

Test plan

  • Build workflow completes with mold
  • Clippy workflow completes with mold
  • Test workflow completes with mold
  • Compare CI times before/after to measure improvement

Summary by CodeRabbit

  • Chores
    • CI workflows updated to install and use a faster linker and set build environment variables for consistent linking.
    • Build jobs simplified to a quicker verification step, reducing CI time; lint and test jobs also include the linker installation for consistency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49c6a069-e4c5-4f94-acae-c8f3ca2c89ff

📥 Commits

Reviewing files that changed from the base of the PR and between 271b27f and 7d785c6.

📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • .github/workflows/test.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/test.yml
  • .github/workflows/build.yml

📝 Walkthrough

Walkthrough

CI workflows were updated to install the mold linker via rui314/setup-mold@v1 and pass -C link-arg=-fuse-ld=mold through RUSTFLAGS. The build workflow switched from running debug/release cargo build to cargo check --all --all-targets. Lint and test workflows now install mold before caching and execution.

Changes

Cohort / File(s) Summary
Build workflow
.github/workflows/build.yml
Added rui314/setup-mold@v1 step; extended RUSTFLAGS to include -C link-arg=-fuse-ld=mold; replaced dual cargo build steps with cargo check --all --all-targets.
Lint workflow
.github/workflows/lint.yml
Inserted rui314/setup-mold@v1 step after Rust toolchain install and before caching/Clippy runs; RUSTFLAGS usage aligned with other workflows.
Test workflows
.github/workflows/test.yml
Set global RUSTFLAGS to -C link-arg=-fuse-ld=mold; added rui314/setup-mold@v1 step in test, doc-test, and e2e jobs before caching and test steps.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as GitHub Actions Runner
  participant Rust as setup-rust (toolchain + clippy)
  participant Mold as setup-mold (rui314/setup-mold@v1)
  participant Cache as actions/cache
  participant Cargo as Cargo (build/check/test)

  Runner->>Rust: install Rust toolchain (+clippy)
  Runner->>Mold: install mold linker
  Runner->>Cache: restore cache
  Runner->>Cargo: run `cargo check` / `cargo clippy` / `cargo test`
  Cargo-->>Cache: update cache
  Cargo-->>Runner: report results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • anylots
  • chengwenxi

Poem

🐰 Hopping through CI with a hop and a thud,

I fetch the mold linker and tidy the mud.
Checks sprint along, lint gives a cheer,
I nibble the logs and vanish — see you next year! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main objective: adopting the mold linker in CI workflows for performance improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch panos/ci-mold

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

chengwenxi

This comment was marked as duplicate.

Copy link
Copy Markdown
Contributor

@chengwenxi chengwenxi left a comment

Choose a reason for hiding this comment

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

LGTM. Clean integration of mold linker via rui314/setup-mold@v1 in build/clippy/test jobs. -C link-arg=-fuse-ld=mold is the correct RUSTFLAGS approach. fmt/doc-test exclusion is reasonable.

Install mold via rui314/setup-mold and pass -C link-arg=-fuse-ld=mold
via RUSTFLAGS in build, clippy, and test jobs. Mold is a multi-threaded
linker that significantly speeds up the linking phase compared to the
default single-threaded ld. fmt and doc-test jobs are excluded as they
don't produce linked binaries.
RUSTFLAGS is set globally so all jobs that compile need mold installed.
- Replace `cargo build --all` (debug) + `cargo build --all --release`
  with `cargo check --all --all-targets`
- cargo check only does type-checking without producing binaries,
  ~4x faster while still catching compilation errors and warnings
- Release builds should only happen in release workflow, not PR CI
- Remove unnecessary rustfmt/clippy components from build job
  (those are installed in the lint workflow)
@panos-xyz panos-xyz merged commit 3de73b8 into main Mar 31, 2026
13 checks passed
@panos-xyz panos-xyz deleted the panos/ci-mold branch March 31, 2026 16:57
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.

2 participants