feat(bench): Re-enable cargo bench
#1
Workflow file for this run
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: Run Benchmarks | |
# on: | |
# schedule: | |
# - cron: '0 0 * * 0' # Runs weekly on Sunday at midnight | |
on: | |
pull_request: | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: fetch submodules | |
run: git submodule update --init --recursive | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: rustfmt, clippy | |
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile | |
- run: | |
# needed to run bench in nightly toolchain | |
rustup toolchain install nightly | |
- name: Setup build env | |
run: | | |
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') | |
./scripts/setup-$os.sh | |
shell: bash | |
- name: Run Benchmarks | |
run: cargo +nightly bench -- --output-format bencher | tee output.txt | |
# Download previous benchmark result from cache (if exists) | |
- name: Cache benchmark data | |
uses: actions/cache@v4 | |
with: | |
path: ./cache | |
key: ${{ runner.os }}-benchmark | |
- name: Store benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: Criterion.rs Benchmark | |
tool: 'cargo' | |
output-file-path: output.txt | |
# GitHub API token to make a commit comment | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
# Show alert with commit comment on detecting possible performance regression | |
alert-threshold: '200%' | |
comment-on-alert: true | |
fail-on-alert: true | |
alert-comment-cc-users: '@mossaka' | |
# Enable Job Summary | |
summary-always: true | |
# Where the previous data file is stored | |
external-data-json-path: ./cache/benchmark-data.json |