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 88a1383b..4b794bb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,12 +87,21 @@ 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: 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 @@ -102,7 +111,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