From 3bc1cdc049b2944ba16d9226c881d8d52ed98dfe Mon Sep 17 00:00:00 2001 From: not-matthias Date: Sat, 16 May 2026 14:25:54 -0700 Subject: [PATCH 1/2] ci: shard bpf-tests by integration test binary Each memtrack integration test binary runs its cases serially because the eBPF tracker can't overlap with itself in one process. Sharding at the test-binary level lets the four binaries build and run in parallel across jobs, dropping the critical path from ~13min to ~5min. --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88a1383b..b8979347 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,13 @@ jobs: bpf-tests: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Each memtrack integration test binary runs its cases serially + # (eBPF tracker can't overlap with itself in one process), so we + # shard at the test-binary level to parallelize across jobs. + test: [c_tests, cpp_tests, rust_tests, spawn_tests] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -102,7 +109,7 @@ jobs: - name: Run tests env: RUST_LOG: debug - run: sudo -E $(which cargo) test -- --test-threads 1 --nocapture + run: sudo -E $(which cargo) test --lib --test ${{ matrix.test }} -- --test-threads 1 --nocapture working-directory: crates/memtrack # Since we ran the tests with sudo, the build artifacts will have root ownership From 4eac647797a5b836ef780d498e494c34f001ede2 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Wed, 20 May 2026 10:32:57 +0200 Subject: [PATCH 2/2] ci: give each bpf-tests shard its own cache key Previously all four matrix shards shared one rust-cache key and raced to save, leaving three failed reservations per run and only one entry that quickly aged out. Per-shard keys eliminate the race. --- .github/actions/install-rust/action.yml | 6 ++++++ .github/workflows/ci.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index 04bee8af..e4c7a777 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -5,6 +5,10 @@ inputs: description: Comma-separated list of additional rustup components to install (e.g. "rustfmt, clippy"). required: false default: "" + cache-key: + description: Extra value appended to the rust-cache key, used to give matrix shards distinct caches and avoid concurrent save races. + required: false + default: "" runs: using: composite steps: @@ -16,3 +20,5 @@ runs: shell: bash run: echo "${{ inputs.components }}" | tr ',' '\n' | xargs rustup component add - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 + with: + key: ${{ inputs.cache-key }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8979347..4b794bb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,6 +100,8 @@ jobs: lfs: true submodules: true - uses: ./.github/actions/install-rust + with: + cache-key: ${{ matrix.test }} - name: Install dependencies required for libbpf-sys (vendored feature) run: sudo apt-get update && sudo apt-get install -y autopoint bison flex