name: Continuous Benchmarking
on:
push:
branches: [ "main" ]
permissions:
contents: write
deployments: write
env:
CARGO_TERM_COLOR: always
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install fastfetch and hyperfine
run: |
sudo apt-get update && sudo apt-get install -y hyperfine
wget https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb
sudo dpkg -i fastfetch-linux-amd64.deb || sudo apt-get install -f -y
- name: Build release binary
run: cargo build --release
- name: Run benchmarks
run: |
cargo bench
hyperfine --warmup 3 --runs 10 './target/release/retch' 'fastfetch' --export-json hyperfine_result.json
python3 scripts/parse_criterion.py
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'customSmallerIsBetter'
output-file-path: benchmark_result.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench
alert-threshold: '200%'
fail-on-alert: true
comment-on-alert: true
alert-comment-cc-users: '@l1a'
max-items-in-chart: 50