-
Notifications
You must be signed in to change notification settings - Fork 25
50 lines (49 loc) · 1.49 KB
/
benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
id: benchmark-result
run: |
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
cat benchmark.json >> $GITHUB_OUTPUT
- uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: {{ steps.benchmark-result.outputs.stdout | toJSON }}}
})
- 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