ci: split clippy and tests for parallel execution
Some checks failed
Release Docker Image / define-variables (push) Successful in 2s
Checks / Rust / Prek & Format (push) Successful in 46s
Checks / Rust / Tests (push) Failing after 14s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Failing after 2m9s
Checks / Rust / Clippy (push) Successful in 3m21s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Failing after 1m25s
Release Docker Image / merge (push) Has been skipped

Split the combined rust-checks job into separate clippy and tests jobs
to maximise parallelisation and reduce overall CI time.

Previous performance:
- Combined clippy + tests in single job: ~5.5 minutes
- Running sequentially wasted runner capacity

New approach:
- Three fully parallel jobs: fast-checks, clippy, and tests
- No dependencies between jobs for maximum parallelisation
- Each heavy job runs independently: ~4.5 minutes each
- Better cache utilisation with shared Rust registry and system packages
- Overall pipeline completes faster with true parallelisation

Optimisations:
- Remove sccache from clippy job (doesn't compile, only analyses)
- Keep sccache for tests job where compilation caching provides benefit
- Add concurrency group to cancel in-progress runs on new pushes
- Remove job dependencies to enable full parallelisation

The duplication of setup steps (uv, rustup, system deps) is offset by
the parallelisation gains, as runners can process all checks simultaneously.
This commit is contained in:
Tom Foster 2025-08-12 10:56:14 +01:00
parent de9e277b28
commit 11a483f2bb

View file

@ -4,6 +4,11 @@ on:
push:
pull_request:
# Cancel in-progress runs when a new push is made to the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fast-checks:
name: Prek & Format
@ -34,10 +39,61 @@ jobs:
run: |
cargo +nightly fmt --all -- --check
rust-checks:
name: Clippy & Tests
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: https://github.com/astral-sh/setup-uv@v6
with:
enable-cache: true
ignore-nothing-to-cache: true
cache-dependency-glob: '' # Disable Python dependency tracking for Rust project
- name: Install Rust toolchain
run: |
# Install toolchain from rust-toolchain.toml
uvx rustup show # This will auto-install from rust-toolchain.toml
- name: Install system dependencies
run: sudo apt-get update
- name: Cache system packages
uses: https://github.com/awalsh128/cache-apt-pkgs-action@v1
with:
packages: clang liburing-dev
version: 1
- name: Cache Rust registry
uses: actions/cache@v4
with:
path: |
~/.cargo/git
!~/.cargo/git/checkouts
~/.cargo/registry
!~/.cargo/registry/src
key: rust-registry-${{hashFiles('**/Cargo.lock') }}
- name: Run Clippy lints
run: |
cargo clippy \
--workspace \
--features full \
--locked \
--no-deps \
--profile test \
-- \
-D warnings
tests:
name: Tests
runs-on: ubuntu-latest
needs: fast-checks
env:
SCCACHE_ENABLED: ${{ vars.GH_APP_ID != '' && secrets.GH_APP_PRIVATE_KEY != '' }}
@ -101,16 +157,6 @@ jobs:
with:
key: sccache-v0
path: .
- name: Run Clippy lints
run: |
cargo clippy \
--workspace \
--features full \
--locked \
--no-deps \
--profile test \
-- \
-D warnings
- name: Run Cargo tests
run: |