[WIP] Add CI benchmarking #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark | |
permissions: | |
contents: read | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "The commit or branch to benchmark" | |
required: true | |
type: string | |
merge_group: | |
branches: | |
- main | |
jobs: | |
bench: | |
name: Benchmark | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
include: | |
- rust: stable | |
os: [benchmark, X64] | |
target: "x86_64-unknown-linux-gnu" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
persist-credentials: false | |
ref: "${{inputs.ref}}" | |
- name: cargo build | |
run: | | |
. "$HOME/.cargo/env" | |
cargo build --target ${{matrix.target}} -p test-libz-rs-sys --release --examples | |
cd benchmarker && cargo build --release | |
- name: Benchmark | |
run: | | |
benchmarker/target/release/benchmarker "target/${{matrix.target}}/release/examples/blogpost-compress 9 rs silesia-small.tar" "target/${{matrix.target}}/release/examples/blogpost-compress 9 ng silesia-small.tar" > bench_results.json | |
- name: Upload benchmark results to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark-results | |
path: bench_results.json | |
- name: Upload benchmark results to bench repo | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.BENCH_DATA_DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
chmod 700 ~/.ssh | |
git clone --depth 1 [email protected]:trifectatechfoundation/zlib-rs-bench.git | |
cat bench_results.json >> zlib-rs-bench/metrics.json | |
cd metrics | |
git add . | |
git -c user.name=Bot -c [email protected] commit --message 📈 | |
git push origin master |