ci: fix iai job (#7544)

This commit is contained in:
DaniPopes
2024-04-10 20:50:41 +02:00
committed by GitHub
parent e48bae9a0e
commit 69355affb8
2 changed files with 18 additions and 35 deletions

View File

@ -8,6 +8,7 @@ on:
env:
CARGO_TERM_COLOR: always
BASELINE: base
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -21,40 +22,33 @@ jobs:
# Only run benchmarks in merge groups
if: github.event_name != 'pull_request'
steps:
- name: Checkout main sources
uses: actions/checkout@v4
with:
ref: main
path: main
- name: Checkout PR sources
uses: actions/checkout@v4
with:
clean: false
path: pr
- uses: actions/checkout@v4
- name: Install Valgrind
run: sudo apt update && sudo apt install valgrind
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
main -> target
pr -> target
cache-on-failure: true
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install iai-callgrind-runner
run: |
version=$(cargo metadata --format-version=1 |\
jq '.packages[] | select(.name == "iai-callgrind").version' |\
tr -d '"'
)
cargo install iai-callgrind-runner --version $version
cargo binstall iai-callgrind-runner --version $version --no-confirm --no-symlinks
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref || 'main' }}
- name: Generate test vectors
run: |
cargo run --bin reth --manifest-path main/Cargo.toml -- test-vectors tables
cp -r testdata main
mv testdata pr
- name: Set main baseline
run: cargo bench --package reth-db --bench iai --features test-utils --manifest-path main/Cargo.toml
- name: Compare PR benchmark
shell: 'script -q -e -c "bash {0}"' # required to workaround /dev/tty not being available
run: .github/scripts/compare_iai.sh
working-directory: pr
run: cargo run --bin reth -- test-vectors tables
- name: Save baseline
run: cargo bench -p reth-db --bench iai --features test-utils -- --save-baseline=$BASELINE
- name: Checkout PR
uses: actions/checkout@v4
with:
clean: false
- name: Compare PR benchmarks
run: cargo bench -p reth-db --bench iai --features test-utils -- --baseline=$BASELINE