-
Notifications
You must be signed in to change notification settings - Fork 80
292 lines (248 loc) · 10.9 KB
/
bench.yml
File metadata and controls
292 lines (248 loc) · 10.9 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
on:
workflow_dispatch:
issue_comment:
types: [created]
name: Benchmark
jobs:
mysql-bench:
runs-on: ubuntu-latest
if: (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipmysql')
outputs:
pr-sha: ${{ steps.sha.outputs.result || github.sha }}
steps:
- name: Install Hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
- name: Get PR SHA
if: github.event_name == 'issue_comment'
id: sha
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.request(context.payload.issue.pull_request.url);
return response.data.head.sha;
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ steps.sha.outputs.result || github.sha }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
cache: true
- name: Build PR
run: |
go build -o bench-pr ./bench
- name: Checkout main branch
uses: actions/checkout@v4
with:
clean: false
ref: main
- name: Build main
run: |
go build -o bench-main ./bench
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Run MySQL benchmarks
run: |
echo "## MySQL run" > mysql-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql.md -n 'mysql-main' './bench-main -runs 2 -backend mysql' -n 'mysql-pr' './bench-pr -runs 2 -backend mysql'
cat bench-mysql.md >> mysql-benchmark.md
- name: Run large MySQL benchmarks
if: contains(github.event.comment.body, '!large')
run: |
echo "## Large MySQL payload run (1MB)" >> mysql-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql-l.md -n 'mysql-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend mysql -timeout 240s' -n 'mysql-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend mysql -timeout 240s'
cat bench-mysql-l.md >> mysql-benchmark.md
- name: Run very large MySQL benchmarks
if: contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large MySQL payload run (5MB)" >> mysql-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-mysql-vl.md -n 'mysql-main' './bench-main -resultsize 5000000 -runs 2 -backend mysql -timeout 240s' -n 'mysql-pr' './bench-pr -resultsize 5000000 -runs 2 -backend mysql -timeout 240s'
cat bench-mysql-vl.md >> mysql-benchmark.md
- name: Upload MySQL benchmark results
uses: actions/upload-artifact@v3
with:
name: mysql-results
path: mysql-benchmark.md
sqlite-bench:
runs-on: ubuntu-latest
if: (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipsqlite')
steps:
- name: Install Hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
- name: Get PR SHA
if: github.event_name == 'issue_comment'
id: sha
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.request(context.payload.issue.pull_request.url);
return response.data.head.sha;
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ steps.sha.outputs.result || github.sha }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
cache: true
- name: Build PR
run: |
go build -o bench-pr ./bench
- name: Checkout main branch
uses: actions/checkout@v4
with:
clean: false
ref: main
- name: Build main
run: |
go build -o bench-main ./bench
- name: Run SQLite benchmarks
run: |
echo "## SQLite run" > sqlite-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite.md -n 'sqlite-main' './bench-main -runs 2 -backend sqlite' -n 'sqlite-pr' './bench-pr -runs 2 -backend sqlite'
cat bench-sqlite.md >> sqlite-benchmark.md
- name: Run large SQLite benchmarks
if: contains(github.event.comment.body, '!large')
run: |
echo "## Large SQLite payload run (1MB)" >> sqlite-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite-l.md -n 'sqlite-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend sqlite -timeout 240s' -n 'sqlite-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend sqlite -timeout 240s'
cat bench-sqlite-l.md >> sqlite-benchmark.md
- name: Run very large SQLite benchmarks
if: contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large SQLite payload run (5MB)" >> sqlite-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-sqlite-vl.md -n 'sqlite-main' './bench-main -resultsize 5000000 -runs 2 -backend sqlite -timeout 240s' -n 'sqlite-pr' './bench-pr -resultsize 5000000 -runs 2 -backend sqlite -timeout 240s'
cat bench-sqlite-vl.md >> sqlite-benchmark.md
- name: Upload SQLite benchmark results
uses: actions/upload-artifact@v3
with:
name: sqlite-results
path: sqlite-benchmark.md
redis-bench:
runs-on: ubuntu-latest
if: (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipredis')
steps:
- name: Install Hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
- name: Get PR SHA
if: github.event_name == 'issue_comment'
id: sha
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.request(context.payload.issue.pull_request.url);
return response.data.head.sha;
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ steps.sha.outputs.result || github.sha }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
cache: true
- name: Build PR
run: |
go build -o bench-pr ./bench
- name: Checkout main branch
uses: actions/checkout@v4
with:
clean: false
ref: main
- name: Build main
run: |
go build -o bench-main ./bench
- name: Start Redis
uses: shogo82148/actions-setup-redis@v1
with:
auto-start: true
redis-port: 6379
redis-version: "6.2"
redis-conf: |
requirepass RedisPassw0rd
appendonly yes
appendfsync always
- name: Run Redis benchmarks
run: |
echo "## Redis run" > redis-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis.md -n 'redis-main' './bench-main -runs 2 -backend redis' -n 'redis-pr' './bench-pr -runs 2 -backend redis'
cat bench-redis.md >> redis-benchmark.md
- name: Run large Redis benchmarks
if: contains(github.event.comment.body, '!large')
run: |
echo "## Large Redis payload run (1MB)" >> redis-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis-l.md -n 'redis-main' './bench-main -resultsize 1000000 -activities 10 -runs 2 -backend redis -timeout 240s' -n 'redis-pr' './bench-pr -resultsize 1000000 -activities 10 -runs 2 -backend redis -timeout 240s'
cat bench-redis-l.md >> redis-benchmark.md
- name: Run very large Redis benchmarks
if: contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large Redis payload run (5MB)" >> redis-benchmark.md
hyperfine --show-output --warmup 1 --export-markdown bench-redis-vl.md -n 'redis-main' './bench-main -resultsize 5000000 -runs 2 -backend redis -timeout 240s' -n 'redis-pr' './bench-pr -resultsize 5000000 -runs 2 -backend redis -timeout 240s'
cat bench-redis-vl.md >> redis-benchmark.md
- name: Upload Redis benchmark results
uses: actions/upload-artifact@v3
with:
name: redis-results
path: redis-benchmark.md
combine-results:
runs-on: ubuntu-latest
needs: [mysql-bench, sqlite-bench, redis-bench]
if: always() && (needs.mysql-bench.result == 'success' || needs.sqlite-bench.result == 'success' || needs.redis-bench.result == 'success') && github.event.issue.pull_request
steps:
- name: Download MySQL results
if: needs.mysql-bench.result == 'success'
uses: actions/download-artifact@v3
with:
name: mysql-results
path: ./results
continue-on-error: true
- name: Download SQLite results
if: needs.sqlite-bench.result == 'success'
uses: actions/download-artifact@v3
with:
name: sqlite-results
path: ./results
continue-on-error: true
- name: Download Redis results
if: needs.redis-bench.result == 'success'
uses: actions/download-artifact@v3
with:
name: redis-results
path: ./results
continue-on-error: true
- name: Combine benchmark results
run: |
echo "# Benchmark Results" > combined-benchmark.md
echo "" >> combined-benchmark.md
if [ -f "./results/mysql-benchmark.md" ]; then
cat ./results/mysql-benchmark.md >> combined-benchmark.md
echo "" >> combined-benchmark.md
fi
if [ -f "./results/sqlite-benchmark.md" ]; then
cat ./results/sqlite-benchmark.md >> combined-benchmark.md
echo "" >> combined-benchmark.md
fi
if [ -f "./results/redis-benchmark.md" ]; then
cat ./results/redis-benchmark.md >> combined-benchmark.md
echo "" >> combined-benchmark.md
fi
- name: Write a new comment
uses: peter-evans/create-or-update-comment@v2
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body-file: ./combined-benchmark.md