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