1name: Benchmarks
2on:
3 workflow_dispatch:
4 push:
5 branches:
6 - master
7
8concurrency:
9 group: benchmark-${{ github.ref }}
10 cancel-in-progress: true
11
12permissions:
13 # deployments permission to deploy GitHub pages website
14 deployments: write
15 # contents permission to update benchmark contents in gh-pages branch
16 contents: write
17
18jobs:
19 benchmark:
20 name: Performance regression check
21 runs-on: ubuntu-latest
22 steps:
23 - uses: actions/setup-go@v5
24 with:
25 go-version: 1.22.5
26
27 - uses: actions/checkout@v4
28
29 # Run benchmark with `go test -bench` and stores the output to a file
30 - name: Run benchmark
31 run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt
32
33 # Run `github-action-benchmark` action
34 - name: Store benchmark result
35 uses: benchmark-action/github-action-benchmark@v1
36 with:
37 # What benchmark tool the output.txt came from
38 tool: 'go'
39 # Where the output from the benchmark tool is stored
40 output-file-path: output.txt
41 # GitHub API token to make a commit comment
42 github-token: ${{ secrets.GITHUB_TOKEN }}
43 # Enable alert commit comment
44 comment-on-alert: true
45 # Push and deploy GitHub pages branch automatically
46 auto-push: true