.github/workflows/benchmark.yml
name: Benchmark
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/**'
- 'benchmarks/**'
- '.github/workflows/benchmark.yml'
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
node-version: 22
- name: Install dependencies
run: |
npm ci
node --run build
- name: Run benchmark
run: |
cd benchmarks
npm ci
node func.js | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'benchmarkjs'
output-file-path: ./benchmarks/output.txt
external-data-json-path: ./cache/benchmark-data.json
fail-on-alert: true