forked from fortuna/ss-example
-
Notifications
You must be signed in to change notification settings - Fork 191
46 lines (36 loc) · 1.1 KB
/
bench.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Benchstat
on:
pull_request:
branches: [ master ]
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
bench:
name: Performance regression check
runs-on: ubuntu-latest
steps:
- name: Checkout (previous)
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: previous
- name: Checkout (new)
uses: actions/checkout@v3
with:
path: new
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: '${{ github.workspace }}/go.mod'
- name: Install dependencies
run: go install golang.org/x/perf/cmd/benchstat@latest
- name: Run Benchmark (previous)
run: |
cd previous
go test -bench=. -benchmem -benchtime=100ms -count=8 > benchmark.txt
- name: Run Benchmark (new)
run: |
cd new
go test -bench=. -benchmem -benchtime=100ms -count=8 > benchmark.txt
- name: Run Benchstat
run: benchstat previous/benchmark.txt new/benchmark.txt