From 271b27fcc61d01589081c3653b340693d551a9b0 Mon Sep 17 00:00:00 2001 From: panos Date: Fri, 27 Mar 2026 16:28:28 +0800 Subject: [PATCH 1/3] ci: use mold linker for faster CI builds 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. --- .github/workflows/build.yml | 5 ++++- .github/workflows/lint.yml | 3 +++ .github/workflows/test.yml | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a406645..44cf124 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ concurrency: env: CARGO_TERM_COLOR: always - RUSTFLAGS: -D warnings + RUSTFLAGS: -D warnings -C link-arg=-fuse-ld=mold jobs: build: @@ -30,6 +30,9 @@ jobs: with: components: rustfmt, clippy + - name: Install mold linker + uses: rui314/setup-mold@v1 + - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c4ec838..786ab05 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,6 +44,9 @@ jobs: with: components: clippy + - name: Install mold linker + uses: rui314/setup-mold@v1 + - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e20a83..c4df4f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ concurrency: env: CARGO_TERM_COLOR: always RUST_MIN_STACK: 8388608 + RUSTFLAGS: -C link-arg=-fuse-ld=mold jobs: test: @@ -28,6 +29,9 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Install mold linker + uses: rui314/setup-mold@v1 + - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: @@ -70,6 +74,9 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Install mold linker + uses: rui314/setup-mold@v1 + - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: From ed336a8b864623575040ee6a064d9b8bf1fe80ae Mon Sep 17 00:00:00 2001 From: panos Date: Wed, 1 Apr 2026 00:19:42 +0800 Subject: [PATCH 2/3] fix(ci): install mold in doc-test job RUSTFLAGS is set globally so all jobs that compile need mold installed. --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4df4f0..682c687 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,9 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Install mold linker + uses: rui314/setup-mold@v1 + - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: From 7d785c6ab6a972d4ebb9f14475f459e4b9fbb11e Mon Sep 17 00:00:00 2001 From: panos Date: Wed, 1 Apr 2026 00:32:57 +0800 Subject: [PATCH 3/3] ci(build): replace full builds with cargo check - 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) --- .github/workflows/build.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44cf124..67177fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,6 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy - name: Install mold linker uses: rui314/setup-mold@v1 @@ -38,8 +36,5 @@ jobs: with: cache-on-failure: true - - name: Build debug - run: cargo build --all --verbose - - - name: Build release - run: cargo build --all --release --verbose + - name: Check compilation + run: cargo check --all --all-targets