-
Notifications
You must be signed in to change notification settings - Fork 4.4k
70 lines (58 loc) · 2.33 KB
/
ca-benchmark.yaml
File metadata and controls
70 lines (58 loc) · 2.33 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Cluster Autoscaler Benchmark
on:
pull_request:
paths:
- 'cluster-autoscaler/**'
permissions:
contents: read
jobs:
benchmark:
name: Run and Compare Benchmarks
runs-on: ubuntu-latest
# Do not block valid PRs on benchmark issues as we are still stabilizing.
continue-on-error: true
steps:
- name: Checkout PR
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: pr
- name: Checkout Base
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: pr/cluster-autoscaler/go.mod
cache-dependency-path: pr/cluster-autoscaler/go.sum
- name: Apt-get dependencies
run: sudo apt-get install libseccomp-dev -qq
- name: Run Benchmark (Base)
shell: bash
run: |
cd base/cluster-autoscaler
go test -v -bench=BenchmarkRunOnce -benchmem -count=8 ./core/bench/... -args -gc true | tee ../../base.txt
- name: Run Benchmark (PR)
shell: bash
run: |
cd pr/cluster-autoscaler
go test -v -bench=BenchmarkRunOnce -benchmem -count=8 ./core/bench/... -args -gc true | tee ../../pr.txt
- name: Install benchstat
run: go install golang.org/x/perf/cmd/benchstat@latest
- name: Compare Results
shell: bash
run: |
echo "### Cluster Autoscaler Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "Comparing PR branch against \`${{ github.event.pull_request.base.ref }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -s base.txt ] && [ -s pr.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
$(go env GOPATH)/bin/benchstat base.txt pr.txt | tee benchstat.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
# Fail if any regression is > 10%
grep -qE '\+[1-9][0-9].*%' benchstat.txt && { echo "Regression detected > 10%"; exit 1; } || true
else
echo "Error: Benchmark results not found or empty." >> $GITHUB_STEP_SUMMARY
exit 1
fi