From a1f2a9b8bc34947ee1d007c671481f25693026d0 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Thu, 2 Apr 2026 13:34:11 -0700 Subject: [PATCH] ci: speed up Rust CI builds (#327) * ci: speed up Rust CI builds with caching and prebuilt tools The Windows builder takes ~6min vs ~3min on Ubuntu, largely because cargo-llvm-cov is compiled from source on every run. This adds Swatinem/rust-cache for build artifact caching and switches to taiki-e/install-action for prebuilt cargo-llvm-cov binaries. Also fixes the undefined `inputs.shell` references by hardcoding `bash`. * fix: add Swatinem and taiki to cspell dictionary * ci: remove rust-cache, no measurable benefit for this project Investigated cache hit/miss across 3 CI runs. Even with warm cache hits (macOS/Windows), build times were unchanged or slightly slower due to cache download/extract overhead (~39MB) outweighing the small dependency compile time savings. * ci: remove redundant cargo build step Clippy already compiles all targets, so the explicit cargo build step was redundant. The test step (cargo llvm-cov) also does its own instrumented build, so nothing depended on the build step's artifacts. * ci: try larger Windows runner for faster Rust builds Switch from windows-latest (4 vCPU) to windows-latest-large (8 vCPU) to see if the extra cores meaningfully speed up Rust compilation. Windows builds currently take ~2x longer than macOS/Ubuntu. * ci: use Namespace Windows runner (8 vCPU) instead of GitHub-hosted Switch to nscloud-windows-2022-amd64-8x16 to test whether doubling the cores from 4 to 8 meaningfully speeds up Rust compilation on Windows, which currently takes ~2x longer than macOS/Ubuntu. * fix: add nscloud to cspell dictionary --- .github/actions/rust_crate/action.yaml | 6 +----- .github/workflows/main.yaml | 2 +- cspell.config.yaml | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/actions/rust_crate/action.yaml b/.github/actions/rust_crate/action.yaml index 460b494..4b0af7b 100644 --- a/.github/actions/rust_crate/action.yaml +++ b/.github/actions/rust_crate/action.yaml @@ -21,16 +21,12 @@ runs: shell: bash run: cargo fmt --check + # No explicit build step needed — clippy already compiles all targets. - name: Clippy working-directory: ${{ inputs.working_directory }} shell: bash run: cargo clippy --all-targets -- -D warnings - - name: Build - working-directory: ${{ inputs.working_directory }} - shell: bash - run: cargo build --verbose - - name: Test working-directory: ${{ inputs.working_directory }} shell: bash diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index dfb749e..df8c0ea 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -63,7 +63,7 @@ jobs: strategy: matrix: crate: ${{ fromJSON(needs.changes.outputs.needs_rust_build) }} - os: [macos-latest, windows-latest, ubuntu-latest] + os: [macos-latest, nscloud-windows-2022-amd64-8x16, ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/cspell.config.yaml b/cspell.config.yaml index 3388b9a..b69fb4e 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -57,6 +57,7 @@ words: - mockall - mocktail - msvc + - nscloud - oslog - pubspec - repr