From aa197d50cf1817ba5b7936807051a7b2fb00120f Mon Sep 17 00:00:00 2001 From: Jacob Stephens Date: Thu, 8 Oct 2026 08:18:30 -0400 Subject: [PATCH] Shard macOS CI tests across four runners (#570) --- .github/workflows/ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7fe4b7e..e61ab0a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,12 @@ jobs: # which the tests build from tests/fakes.rs with rustc. - run: cargo test - test-macos: + test-macos-shard: runs-on: macos-26 + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4] steps: - uses: actions/checkout@v7 - name: Install the Rust version rust-toolchain.toml names @@ -31,10 +35,25 @@ jobs: rustup toolchain install rustc --version - uses: Swatinem/rust-cache@v2 + with: + shared-key: test-macos + save-if: ${{ matrix.shard == 1 }} # nextest runs tests from every test binary in parallel, where cargo test # runs the binaries one after another; that matters on the slower macOS # runners. Without a lib target there are no doctests for it to miss. # The Linux job keeps plain cargo test, so the suite also runs the way # a contributor runs it locally. - uses: taiki-e/install-action@nextest - - run: cargo nextest run + # Hash partitions cover the same suite once across all four runners. + - run: cargo nextest run --partition hash:${{ matrix.shard }}/${{ strategy.job-total }} + + # Keep one stable check name and reject failed, cancelled or skipped shards. + test-macos: + needs: test-macos-shard + if: ${{ always() }} + runs-on: ubuntu-24.04 + steps: + - name: Require every macOS shard to pass + env: + RESULT: ${{ needs.test-macos-shard.result }} + run: test "$RESULT" = success