Skip to content

🐛 fix bench

🐛 fix bench #34

Workflow file for this run

name: Rust Test and Benchmark
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
# Allow manual triggering
workflow_dispatch:
permissions:
contents: write # Required for pushing to gh-pages
deployments: write
jobs:
benchmark:
name: Run tests and benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
fetch-depth: 0
continue-on-error: true # If the branch doesn't exist, it's okay
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "latest"
- name: Install just
uses: extractions/setup-just@v1
with:
just-version: "1.39"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # Use nightly for Criterion
override: true
components: rustfmt, clippy
targets: wasm32-unknown-unknown
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "benchmark-cache"
cache-directories: |
~/.cargo/registry
~/.cargo/git
target
- name: Check formatting
run: just fmt
- name: Run lints
run: just lint
- name: Run tests
run: just test
- name: Run benchmarks
run: just bench
env:
CARGO_TERM_COLOR: always
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Criterion.rs Benchmark
tool: cargo
output-file-path: target/criterion/**/*.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data
alert-threshold: "200%"
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: "@chriamue"
- name: Check benchmark results
if: github.event_name == 'pull_request'
run: |
if [ -f gh-pages/dev/bench/data/latest.json ]; then
echo "Comparing benchmark results..."
fi
- name: Build documentation
run: just docs
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1