Skip to content

Commit 50c5f61

Browse files
committed
feat: add GH actions for running benchmarks
Signed-off-by: Edmund Ochieng <[email protected]>
1 parent 32f19f7 commit 50c5f61

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Diff for: .github/workflows/benchmark.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: performance
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
benchmark:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version-file: go.mod
16+
17+
- name: Install dependencies
18+
run: go get .
19+
20+
- name: Run golang benchmarks
21+
run: go test -run="^$" -bench=. ./internal/...
22+
23+
- name: Install benchstat
24+
run: go install golang.org/x/perf/cmd/benchstat@latest
25+
26+
- name: Set Golang binaries path
27+
run: echo "`go env GOPATH`/bin" >> $GITHUB_PATH
28+
29+
- name: Download previous benchmarks
30+
id: download
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: benchmark-results
34+
path: stats/benchmark.txt
35+
continue-on-error: true
36+
37+
- name: Compare benchmark results
38+
if: steps.download.outcome == 'success'
39+
run: benchstat benchmark.txt stats/benchmark.txt
40+
41+
- name: Upload artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: benchmark-results
45+
path: benchmark.txt
46+
overwrite: true

0 commit comments

Comments
 (0)