napi-rs/.github/workflows/bench.yaml
renovate[bot] b0fd67fae4
chore(deps): update actions/setup-node action to v4 (#1763)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-24 11:03:35 +08:00

74 lines
1.6 KiB
YAML

name: Benchmark
env:
DEBUG: 'napi:*'
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
bench:
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: bench-cargo-cache
- name: 'Install dependencies'
run: yarn install --immutable --mode=skip-build
- name: 'Build bench'
run: yarn build:bench
- name: 'Run benchmark'
run: yarn bench
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
if: github.ref == 'refs/heads/main'
with:
tool: 'benchmarkjs'
output-file-path: bench.txt
github-token: ${{ secrets.GH_TOKEN }}
auto-push: true
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
if: github.ref != 'refs/heads/main'
with:
tool: 'benchmarkjs'
output-file-path: bench.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache