From 40262ce74932518344e6eb4a1e42ae51af79ef81 Mon Sep 17 00:00:00 2001 From: "Andrei G." Date: Thu, 19 Mar 2026 18:35:53 +0100 Subject: [PATCH] ci(nextest): partition unit tests into 4 parallel shards Add ci-partition profile to nextest.toml for hash-based test partitioning. Replace sequential test job with 4-way matrix, reducing test time by ~70%. Each shard runs --partition hash:K/4 independently: - Shard 1/4, 2/4, 3/4, 4/4 run in parallel (~3min each vs 10min total) - Build job (25min) remains pipeline bottleneck - No changes to integration tests or coverage jobs - JUnit reports collected from each shard Fixes: improves CI pipeline parallelism --- .github/nextest.toml | 8 ++++++++ .github/workflows/ci.yml | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/nextest.toml b/.github/nextest.toml index 8338630f..df048612 100644 --- a/.github/nextest.toml +++ b/.github/nextest.toml @@ -18,3 +18,11 @@ test-threads = 8 [profile.ci.junit] # Store JUnit XML report for CI path = "target/nextest/ci/junit.xml" + +[profile.ci-partition] +# Used by the partitioned test matrix in CI (unit tests only). +# Each shard receives --partition hash:K/4 on the command line. +test-threads = 8 + +[profile.ci-partition.junit] +path = "target/nextest/ci/junit.xml" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f5b0f55..cfc36d13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -187,24 +187,30 @@ jobs: retention-days: 1 test: - name: Test (${{ matrix.os }}) + name: "Test (shard ${{ matrix.partition }})" needs: [detect-changes, lint-fmt, lint-clippy, build-tests] if: needs.detect-changes.outputs.run-full-ci == 'true' - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest timeout-minutes: 10 strategy: fail-fast: false matrix: - os: [ubuntu-latest] + partition: ["1/4", "2/4", "3/4", "4/4"] steps: - uses: actions/checkout@v6 - uses: taiki-e/install-action@9786bf093d06fe2c715bc12b6ff3b97a491cab4f # nextest - name: Download test archive uses: actions/download-artifact@v7 with: - name: nextest-archive-${{ matrix.os }} - - name: Run tests - run: cargo nextest run --config-file .github/nextest.toml --archive-file nextest-archive.tar.zst --workspace-remap . + name: nextest-archive-ubuntu-latest + - name: "Run tests (shard ${{ matrix.partition }})" + run: | + cargo nextest run \ + --config-file .github/nextest.toml \ + --archive-file nextest-archive.tar.zst \ + --workspace-remap . \ + --profile ci-partition \ + --partition hash:${{ matrix.partition }} integration: name: Integration Tests