🐛 fix bench workflow #28
This file contains hidden or 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: Rust Test and Benchmark | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize] | |
| # Allow manual triggering | |
| workflow_dispatch: | |
| jobs: | |
| benchmark: | |
| name: Run tests and benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - 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: stable | |
| 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: Check dependencies | |
| run: just deny | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: Rust Benchmark | |
| tool: "criterion" | |
| output-file-path: target/criterion/**/new/*.json | |
| alert-threshold: "150%" | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| auto-push: true | |
| # Comment the following lines to use GitHub Pages instead | |
| gh-pages-branch: gh-pages | |
| benchmark-data-dir-path: dev/bench/data | |
| # Uncomment the following lines to publish to GitHub Pages | |
| # publish-to-github-pages: true | |
| # github-pages-branch: gh-pages | |
| # static-site-dir: dev/bench/ | |
| - name: Check benchmark results | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| if [ -f 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 |