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

91 lines
2.1 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:
- master
2020-10-14 01:18:12 +09:00
pull_request:
jobs:
bench:
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
- 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') }}
restore-keys: |
npm-cache-
- name: 'Install dependencies'
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
- 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-10-14 23:08:16 +09:00
if: github.ref == 'refs/heads/master'
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
if: github.ref != 'refs/heads/master'
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