Skip to content

Commit 0c602b6

Browse files
committed
Try something.
1 parent b139046 commit 0c602b6

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

.github/workflows/bench.yml

+13-24
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,27 @@ jobs:
1212
bench:
1313
name: Performance regression check
1414
runs-on: ubuntu-latest
15-
timeout-minutes: 5
1615
steps:
17-
- name: Checkout (previous)
18-
uses: actions/checkout@v3
19-
with:
20-
ref: ${{ github.base_ref }}
21-
path: previous
22-
2316
- name: Checkout (new)
2417
uses: actions/checkout@v3
25-
with:
26-
path: new
2718

2819
- name: Set up Go
2920
uses: actions/setup-go@v4
3021
with:
3122
go-version-file: '${{ github.workspace }}/new/go.mod'
3223

33-
- name: Install dependencies
34-
run: go install golang.org/x/perf/cmd/benchstat@latest
24+
- name: Get dependencies
25+
run: go mod download
3526

36-
- name: Run Benchmark (previous)
37-
timeout-minutes: 5
27+
- name: Benchmark against GITHUB_BASE_REF
3828
run: |
39-
cd previous
40-
go test -bench=. -benchmem -benchtime=100ms -count=10 ./... > benchmark.txt
41-
42-
- name: Run Benchmark (new)
43-
timeout-minutes: 5
44-
run: |
45-
cd new
46-
go test -bench=. -benchmem -benchtime=100ms -count=10 ./... > benchmark.txt
47-
48-
- name: Run Benchstat
49-
run: benchstat previous/benchmark.txt new/benchmark.txt
29+
go install golang.org/x/perf/cmd/benchstat@latest
30+
echo "New Commit:"
31+
git log -1 --format="%H"
32+
go test -bench=. -benchmem -benchtime=100ms -count=10 > /tmp/new.txt
33+
git reset --hard HEAD
34+
git checkout $GITHUB_BASE_REF
35+
echo "Base Commit:"
36+
git log -1 --format="%H"
37+
go test -bench=. -benchmem -benchtime=100ms -count=10 > /tmp/old.txt
38+
$GOBIN/benchstat /tmp/old.txt /tmp/new.txt

0 commit comments

Comments
 (0)