Skip to content

ci: bump cargo-dist to 0.34.0 #3032

ci: bump cargo-dist to 0.34.0

ci: bump cargo-dist to 0.34.0 #3032

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel in progress runs if a new one is queued everywhere but on pushes and workflow dispatch events
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
env:
# Fail instead of building valgrind from source on systems we publish no package for
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)
lint:
needs: prime-rust-cache
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
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-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-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
with:
lfs: true
submodules: true
- uses: ./.github/actions/install-rust
with:
shared-key: ubuntu-26.04
save-cache: false
- uses: ./.github/actions/install-bpf-deps
- run: cargo test --all --exclude memtrack --exclude exec-harness
executor-tests:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
arch: [x86_64, arm64]
base-image: ["ubuntu:24.04", "ubuntu:26.04"]
include:
- arch: x86_64
runner: ubuntu-26.04
- arch: arm64
runner: ubuntu-26.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2
with:
tool: just
# No cache for now here, but we could cache either docker volumes or mounted host directories to cache build artifacts
- run: just test-integ
env:
CODSPEED_TEST_BASE_IMAGE: ${{ matrix.base-image }}
# Runs against an unreleased valgrind-codspeed branch, tag or full commit SHA
# CODSPEED_VALGRIND_REF: my-valgrind-branch
exec-harness-tests:
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
matrix:
include:
- os: ubuntu-24.04
extra-args: --skip-upload
- os: ubuntu-26.04
extra-args: ""
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- 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' }}
- 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
macos-basic-run-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Run tests
env:
# Profiling system commands (e.g. `ls`) with samply is not yet supported on MacOS
CODSPEED_PROFILER_ENABLED: "false"
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
matrix:
os:
[
ubuntu-22.04,
ubuntu-24.04,
ubuntu-24.04-arm,
ubuntu-26.04,
ubuntu-26.04-arm,
]
# 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,
dlopen_tests,
rss_tests,
stack_tests,
interpreter_tests,
]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
lfs: true
submodules: true
- uses: ./.github/actions/install-rust
with:
# 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
run: sudo apt-get install -y libmimalloc-dev libjemalloc-dev
# The perf trampoline needs Python 3.12+.
- name: Install Python with perf trampoline support
if: matrix.test == 'interpreter_tests'
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Run tests
env:
RUST_LOG: debug
# Ubuntu 26.04 ships sudo-rs, which ignores `-E`; pass the env the
# rustup shims and the test gate need through `env` instead.
run: |
sudo env \
"HOME=$HOME" \
"PATH=$PATH" \
"CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}" \
"RUSTUP_HOME=${RUSTUP_HOME:-$HOME/.rustup}" \
"CARGO_INCREMENTAL=$CARGO_INCREMENTAL" \
"RUST_LOG=$RUST_LOG" \
"GITHUB_ACTIONS=$GITHUB_ACTIONS" \
$(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
- name: Clean up
run: sudo chown -R $USER:$USER . ~/.cargo
benchmarks:
runs-on: ${{ matrix.mode == 'walltime' && 'codspeed-macro' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
mode: [simulation, walltime, memory]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Install cargo codspeed
uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2
with:
tool: cargo-codspeed
- name: Build benchmarks
run: cargo codspeed build -p runner-shared -m ${{ matrix.mode }}
- name: Run benchmarks
uses: CodSpeedHQ/action@61efe07e57e55bedeab750c434504de272a56e8c # v5.6.1
with:
mode: ${{ matrix.mode }}
run: cargo codspeed run -p runner-shared
memtrack-benchmarks:
runs-on: codspeed-macro
strategy:
fail-fast: false
matrix:
# Both physical variants of a workload live in the same file, so they
# are measured back to back.
workload: [dd, tar]
env:
CODSPEED_REV: ${{ github.event.pull_request.head.sha || github.sha }}
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/install-bpf-deps
- name: Install codspeed-runner
run: cargo install --locked --path .
- name: Verify the installed binary
run: |
which codspeed
codspeed --version
# The benchmarked command is memtrack, a subcommand of the runner binary,
# which needs file capabilities to load its eBPF programs even though the
# runner measures walltime. The capabilities land on a copy of the runner,
# which the benchmarks call as `codspeed-memtrack`.
- name: Grant memtrack file capabilities
run: |
codspeed setup --mode memory
sudo ln -s "$(codspeed setup memtrack-path)" /usr/local/bin/codspeed-memtrack
# The write benchmarks overwrite these files every round; creating them
# inside a measured round would time one-off disk allocation.
- name: Pre-create benchmark archives
run: |
mkdir -p /tmp/codspeed-memtrack-bench
tar -cf /tmp/memtrack-bench.tar /usr/bin
dd if=/dev/zero of=/tmp/memtrack-bench-dd.bin bs=1M count=64 2> /dev/null
- name: Run memtrack walltime benchmarks (${{ matrix.workload }})
uses: CodSpeedHQ/action@61efe07e57e55bedeab750c434504de272a56e8c # v5.6.1
with:
config: crates/memtrack/benchmarks/${{ matrix.workload }}.yml
mode: walltime
runner-version: rev:${{ env.CODSPEED_REV }}
skip-hash-check-warning: true
check:
runs-on: ubuntu-latest
if: always()
needs:
- prime-rust-cache
- lint
- tests
- executor-tests
- exec-harness-tests
- basic-run-test
- macos-basic-run-test
- bpf-tests
- benchmarks
- memtrack-benchmarks
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJson( needs ) }}