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