ci: benchmark #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
benchmark: | |
name: Performance regression check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Download previous benchmark data | |
uses: actions/cache@v4 | |
with: | |
path: ./cache | |
key: benchmark | |
- name: Run benchmark | |
run: | | |
pnpm install | |
cd packages/node | |
pnpm build | |
cd ../.. | |
if [ -f ./cache/benchmark-main.json ]; then | |
pnpm run bench --outputJson benchmark.json --compare ./cache/benchmark-main.json | |
else | |
pnpm run bench --outputJson benchmark.json | |
fi | |
- name: Benchmark result | |
run: | | |
pnpm run bench --compare ./cache/benchmark-main.json > output.txt | |
cat output.txt | |
- run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: branch | |
- name: Store benchmark dataq | |
if: steps.branch.outputs.branch == 'main' | |
run: cp benchmark.json ./cache/benchmark-main.json |