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

91 lines
2.2 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:
jobs:
bench:
name: Bench
2021-01-04 18:50:04 +09:00
if: "!contains(github.event.head_commit.message, 'bump')"
2020-10-14 01:18:12 +09:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node
2021-01-06 00:53:23 +09:00
uses: actions/setup-node@v2
2020-10-14 01:18:12 +09:00
with:
node-version: 14
2020-11-10 12:09:25 +09:00
check-latest: true
2020-10-14 01:18:12 +09:00
- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: default
override: true
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: bench-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: bench-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: bench-${{ hashFiles('yarn.lock') }}
- name: 'Install dependencies'
2020-12-09 12:03:59 +09:00
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
2020-10-14 01:18:12 +09:00
- name: 'Build ts'
run: yarn build
- 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