Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/actions/install-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ inputs:
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.
description: Extra value appended to the rust-cache key, used to give matrix jobs distinct caches.
required: false
default: ""
shared-key:
description: Cache key shared across jobs, replacing the per-job key. Jobs using it should restore only, leaving the save to the job that primes it.
required: false
default: ""
save-cache:
description: Whether this job saves the rust-cache entry. Jobs sharing a key should let only one of them save.
required: false
default: "true"
outputs:
cache-hit:
description: Whether rust-cache restored an exact key match.
value: ${{ steps.rust-cache.outputs.cache-hit }}
runs:
using: composite
steps:
Expand All @@ -19,8 +31,11 @@ runs:
if: inputs.components != ''
shell: bash
run: echo "${{ inputs.components }}" | tr ',' '\n' | xargs rustup component add
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
- id: rust-cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
with:
key: ${{ inputs.cache-key }}
shared-key: ${{ inputs.shared-key }}
save-if: ${{ inputs.save-cache }}
# https://github.com/Swatinem/rust-cache/issues/341
cache-bin: ${{ runner.os != 'macOS' }}
54 changes: 49 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,59 @@ env:
CODSPEED_VALGRIND_BUILD_FROM_SOURCE: "false"

jobs:
# Builds the dependencies of every ubuntu-26.04 x64 job into one rust-cache
# entry. Those jobs restore it and save nothing; each command below mirrors
# one of theirs, since package selection changes dependency features.
prime-rust-cache:
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- id: rust
uses: ./.github/actions/install-rust
with:
components: clippy
shared-key: ubuntu-26.04
- if: steps.rust.outputs.cache-hit != 'true'
uses: ./.github/actions/install-bpf-deps
- name: Build dependencies
if: steps.rust.outputs.cache-hit != 'true'
run: |
cargo clippy --all-targets
cargo build --bin codspeed --bin generate_config_schema
cargo test --all --exclude memtrack --exclude exec-harness --no-run
cargo test -p exec-harness --no-run
(cd crates/memtrack && cargo test --lib --test c_tests --no-run)
Comment thread
GuillaumeLagrange marked this conversation as resolved.
Resolved

lint:
needs: prime-rust-cache
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-26.04, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
components: rustfmt, clippy
shared-key: ${{ matrix.os == 'ubuntu-26.04' && 'ubuntu-26.04' || '' }}
save-cache: ${{ matrix.os != 'ubuntu-26.04' }}
# Building the runner builds memtrack's vendored libbpf-sys with it.
- uses: ./.github/actions/install-bpf-deps
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-26.04'
- uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0
with:
extra-args: --all-files
- name: Check config schema is up to date
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-26.04'
run: cargo run --bin generate_config_schema && git diff --exit-code schemas/codspeed.schema.json

tests:
needs: prime-rust-cache
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -47,6 +76,9 @@ jobs:
submodules: true

- uses: ./.github/actions/install-rust
with:
shared-key: ubuntu-26.04
save-cache: false

- uses: ./.github/actions/install-bpf-deps

Expand Down Expand Up @@ -79,16 +111,21 @@ jobs:
# CODSPEED_VALGRIND_REF: my-valgrind-branch

exec-harness-tests:
runs-on: ubuntu-latest
needs: prime-rust-cache
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
shared-key: ubuntu-26.04
save-cache: false
- name: Run tests
run: cargo test -p exec-harness

basic-run-test:
needs: prime-rust-cache
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -105,6 +142,8 @@ jobs:
- uses: ./.github/actions/install-rust
with:
cache-key: ${{ matrix.os }}
shared-key: ${{ matrix.os == 'ubuntu-26.04' && 'ubuntu-26.04' || '' }}
save-cache: ${{ matrix.os != 'ubuntu-26.04' }}
Comment thread
GuillaumeLagrange marked this conversation as resolved.
Resolved
- uses: ./.github/actions/install-bpf-deps
- name: Run tests
run: cargo run -- exec ${{ matrix.extra-args }} -m simulation,walltime,memory --warmup-time 0s --max-rounds 5 -- sleep 1
Expand All @@ -123,6 +162,7 @@ jobs:
run: cargo run -- exec -m walltime --skip-upload --warmup-time 0s --max-rounds 5 -- ls -la

bpf-tests:
needs: prime-rust-cache
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -156,7 +196,10 @@ jobs:
submodules: true
- uses: ./.github/actions/install-rust
with:
cache-key: ${{ matrix.os }}-${{ matrix.test }}
# Test shards share their dependencies, so one cache per OS is enough.
cache-key: ${{ matrix.os }}
shared-key: ${{ matrix.os == 'ubuntu-26.04' && 'ubuntu-26.04' || '' }}
save-cache: ${{ matrix.os != 'ubuntu-26.04' && matrix.test == 'c_tests' }}
- uses: ./.github/actions/install-bpf-deps

- name: Install additional allocators
Expand Down Expand Up @@ -297,6 +340,7 @@ jobs:
runs-on: ubuntu-latest
if: always()
needs:
- prime-rust-cache
- lint
- tests
- executor-tests
Expand Down
Loading