-
-
Notifications
You must be signed in to change notification settings - Fork 138
35 lines (31 loc) · 902 Bytes
/
bench_pr.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
name: bench_pr
on: [pull_request]
jobs:
build:
name: Benchmark (PR)
runs-on: ubuntu-latest
env:
GOBIN: /home/runner/go
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v3
with:
go-version: 1.22
id: go
- name: Check out code
uses: actions/checkout@v1
- name: Get dependencies
run: |
go mod download
- name: Benchmark against GITHUB_BASE_REF
run: |
go install golang.org/x/perf/cmd/benchstat@latest
echo "New Commit:"
git log -1 --format="%H"
go test -bench=. -benchmem -benchtime=10x -count=7 > $HOME/new.txt
git reset --hard HEAD
git checkout $GITHUB_BASE_REF
echo "Base Commit:"
git log -1 --format="%H"
go test -bench=. -benchmem -benchtime=10x -count=7 > $HOME/old.txt
$GOBIN/benchstat $HOME/old.txt $HOME/new.txt