Skip to content

ci: benchmark

ci: benchmark #6

Workflow file for this run

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: Build
run: |
pnpm install
cd packages/node
pnpm build
- name: Benchmark result
run: |
if [ -f ./cache/benchmark-main.json ]; then
pnpm run bench --outputJson benchmark.json --compare ./cache/benchmark-main.json > output.txt
else
pnpm run bench --outputJson benchmark.json > output.txt
fi
cat output.txt
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: fs.readFileSync('output.txt', 'utf-8')
})
- 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