napi-rs/.github/workflows/bench.yaml

75 lines
1.6 KiB
YAML
Raw Normal View History

2020-10-14 01:18:12 +09:00
name: Benchmark
env:
DEBUG: 'napi:*'
2020-10-14 01:18:12 +09:00
on:
2020-10-14 23:08:16 +09:00
push:
branches:
2020-12-03 17:30:14 +09:00
- main
2020-10-14 01:18:12 +09:00
pull_request:
2023-03-12 19:31:13 +09:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2020-10-14 01:18:12 +09:00
jobs:
bench:
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2020-10-14 01:18:12 +09:00
- name: Setup node
uses: actions/setup-node@v3
2020-10-14 01:18:12 +09:00
with:
2022-12-09 18:29:03 +09:00
node-version: 18
2021-11-19 15:58:21 +09:00
cache: 'yarn'
2020-10-14 01:18:12 +09:00
- name: Install
2023-03-12 19:24:48 +09:00
uses: dtolnay/rust-toolchain@stable
2020-10-14 01:18:12 +09:00
with:
toolchain: stable
2022-04-01 15:29:51 +09:00
- name: Cache cargo
uses: actions/cache@v3
2020-10-14 01:18:12 +09:00
with:
2022-04-01 15:29:51 +09:00
path: |
~/.cargo/registry
~/.cargo/git
2022-04-15 22:22:04 +09:00
target
2022-04-01 15:29:51 +09:00
key: bench-cargo-cache
2020-10-14 01:18:12 +09:00
- name: 'Install dependencies'
2022-04-01 15:29:51 +09:00
run: yarn install --immutable --mode=skip-build
2020-10-14 01:18:12 +09:00
- name: 'Build bench'
run: yarn build:bench
- name: 'Run benchmark'
run: yarn bench
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
2020-12-03 17:30:14 +09:00
if: github.ref == 'refs/heads/main'
2020-10-14 01:18:12 +09:00
with:
tool: 'benchmarkjs'
output-file-path: bench.txt
github-token: ${{ secrets.GH_TOKEN }}
auto-push: true
2020-10-14 23:08:16 +09:00
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
2020-12-03 17:30:14 +09:00
if: github.ref != 'refs/heads/main'
2020-10-14 23:08:16 +09:00
with:
tool: 'benchmarkjs'
output-file-path: bench.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
2020-10-14 01:18:12 +09:00
comment-always: true
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache