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@v3
24 with:
25 go-version: 1.22.5
26 - uses: actions/checkout@v3
27 # Run benchmark with `go test -bench` and stores the output to a file
28 - name: Run benchmark
29 run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt
30 # Run `github-action-benchmark` action
31 - name: Store benchmark result
32 uses: benchmark-action/github-action-benchmark@v1
33 with:
34 # What benchmark tool the output.txt came from
35 tool: 'go'
36 # Where the output from the benchmark tool is stored
37 output-file-path: output.txt
38 # GitHub API token to make a commit comment
39 github-token: ${{ secrets.GITHUB_TOKEN }}
40 # Enable alert commit comment
41 comment-on-alert: true
42 # Push and deploy GitHub pages branch automatically
43 auto-push: true