mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
ci: fix iai job (#7544)
This commit is contained in:
11
.github/scripts/compare_iai.sh
vendored
11
.github/scripts/compare_iai.sh
vendored
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script should be run on the main branch, after running the iai benchmarks on the target branch.
|
||||
# If the main branch has a better iai performance, exits in error.
|
||||
# It ignores L2 differences, since they seem hard to stabilize across runs.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
cargo bench -p reth-db --bench iai -F test-utils \
|
||||
| tee /dev/tty \
|
||||
| awk '/((L1)|(Ins)|(RAM)|(Est))+.*\(\+[1-9]+[0-9]*\..*%\)/{f=1} END{exit f}'
|
||||
42
.github/workflows/bench.yml
vendored
42
.github/workflows/bench.yml
vendored
@ -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
|
||||
|
||||
Reference in New Issue
Block a user