File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Benchmark Performance
2
+ on :
3
+ pull_request :
4
+ branches :
5
+ - master
6
+ - main
7
+ push :
8
+ branches :
9
+ - master
10
+ - main
11
+ permissions :
12
+ # deployments permission to deploy GitHub pages website
13
+ deployments : write
14
+ # contents permission to update benchmark contents in gh-pages branch
15
+ contents : write
16
+
17
+ jobs :
18
+ benchmark :
19
+ name : Performance regression check
20
+ runs-on : ubuntu-latest
21
+ steps :
22
+ - uses : actions/checkout@v4
23
+ - uses : actions/setup-go@v4
24
+ with :
25
+ go-version : " stable"
26
+ - name : Install dependencies
27
+ run : go mod tidy
28
+ - name : Run benchmark
29
+ run : go test ./... -bench=. -benchmem -count 2 -timeout 1m | tee benchmarks.txt
30
+ # Download previous benchmark result from cache (if exists)
31
+ - name : Download previous benchmark data
32
+ uses : actions/cache@v4
33
+ with :
34
+ path : ./cache
35
+ key : ${{ runner.os }}-benchmark
36
+ # Run `github-action-benchmark` action
37
+ - name : Store benchmark result
38
+ uses : benchmark-action/github-action-benchmark@v1
39
+ with :
40
+ name : Go Benchmark
41
+ tool : ' go'
42
+ output-file-path : benchmarks.txt
43
+ github-token : ${{ secrets.GITHUB_TOKEN }}
44
+ auto-push : true
45
+ # Show alert with commit comment on detecting possible performance regression
46
+ alert-threshold : ' 200%'
47
+ comment-on-alert : true
48
+ fail-on-alert : true
49
+ alert-comment-cc-users : ' @ndyakov'
Original file line number Diff line number Diff line change 19
19
- name : Install dependencies
20
20
run : go mod tidy
21
21
- name : Run tests with coverage
22
- run : go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
22
+ run : go test ./... -coverprofile=./cover.out -covermode=atomic -race -count 2 -timeout 1m
23
23
- name : Upload coverage
24
24
uses : actions/upload-artifact@v4
25
25
with :
You can’t perform that action at this time.
0 commit comments