-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (101 loc) · 3.38 KB
/
benchmarks.yaml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: ⏱ Benchmarks
on:
pull_request:
types: [opened, synchronize, labeled]
jobs:
benchmark:
if: contains(github.event.pull_request.labels.*.name, 'CI/Benchmarks')
strategy:
matrix:
job:
- name: master
ref: master
- name: pr
ref: ${{ github.head_ref }}
name: Benchmark on ${{ matrix.job.ref }}
runs-on: ubuntu-latest
env:
DISPLAY: ':99.0'
steps:
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
- name: Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- name: Checkout ${{ matrix.job.ref }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.job.ref }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Run benchmarks on ${{ matrix.job.ref }}
run: go test -run='^$' -bench=. -count=10 test/benchmarks_test.go | grep -v "XGB:" > /tmp/benchmarks-${{ matrix.job.name }}.txt
- name: Archive benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmarks-${{ matrix.job.name }}
path: /tmp/benchmarks-${{ matrix.job.name }}.txt
Benchstat:
runs-on: ubuntu-latest
needs: benchmark
steps:
- name: Download master benchmark
uses: actions/download-artifact@v4
with:
name: benchmarks-master
- name: Download PR benchmark
uses: actions/download-artifact@v4
with:
name: benchmarks-pr
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Setup benchstat
run: go install golang.org/x/perf/cmd/benchstat@latest
- name: Run benchmarks diff
id: benchmarks-diff
run: benchstat benchmarks-master.txt benchmarks-pr.txt > benchmarks-diff.txt
- name: Prepare output
id: prepare-output
run: |
echo "master<<EOF" >> "$GITHUB_OUTPUT"
cat benchmarks-master.txt >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "pr<<EOF" >> "$GITHUB_OUTPUT"
cat benchmarks-pr.txt >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "diff<<EOF" >> "$GITHUB_OUTPUT"
cat benchmarks-diff.txt >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Comment PR with benchmark results
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## Benchmarks
#### Benchstat `master` vs `${{ github.head_ref }}`
<details>
<summary>Results</summary>
```
${{ steps.prepare-output.outputs.diff }}
```
</details>
#### Benchmarks on `${{ github.head_ref }}`
<details>
<summary>Results</summary>
```
${{ steps.prepare-output.outputs.pr }}
```
</details>
#### Benchmarks on `master`
<details>
<summary>Results</summary>
```
${{ steps.prepare-output.outputs.master }}
```
</details>
comment_tag: benchmarks