1
1
on :
2
2
workflow_dispatch :
3
3
issue_comment :
4
- types : [ created ]
4
+ types : [created]
5
5
6
6
name : Benchmark
7
7
8
8
jobs :
9
- bench :
9
+ mysql- bench :
10
10
runs-on : ubuntu-latest
11
- if : github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))
11
+ if : (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipmysql')
12
+ outputs :
13
+ pr-sha : ${{ steps.sha.outputs.result || github.sha }}
12
14
steps :
13
15
- name : Install Hyperfine
14
16
run : |
26
28
return response.data.head.sha;
27
29
28
30
- name : Checkout PR
29
- uses : actions/checkout@v2
31
+ uses : actions/checkout@v4
30
32
with :
31
33
ref : ${{ steps.sha.outputs.result || github.sha }}
32
34
42
44
go build -o bench-pr ./bench
43
45
44
46
- name : Checkout main branch
45
- uses : actions/checkout@v3
47
+ uses : actions/checkout@v4
46
48
with :
47
49
clean : false
48
50
ref : main
@@ -51,89 +53,240 @@ jobs:
51
53
run : |
52
54
go build -o bench-main ./bench
53
55
54
- - name : Start Redis
55
- uses : shogo82148/actions-setup-redis@v1
56
- with :
57
- auto-start : true
58
- redis-port : 6379
59
- redis-version : ' 6.2'
60
- redis-conf : |
61
- requirepass RedisPassw0rd
62
- appendonly yes
63
- appendfsync always
64
-
65
56
- name : Start MySQL
66
57
run : sudo /etc/init.d/mysql start
67
58
68
59
- name : Run MySQL benchmarks
69
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql')
70
60
run : |
71
- echo "## MySQL run" >> benchmark.md
61
+ echo "## MySQL run" > mysql- benchmark.md
72
62
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'
73
- cat bench-mysql.md >> benchmark.md
63
+ cat bench-mysql.md >> mysql- benchmark.md
74
64
75
- - name : Run SQLite benchmarks
76
- if : github.event.issue.pull_request && ! contains(github.event.comment.body, '!skipsqlite ')
65
+ - name : Run large MySQL benchmarks
66
+ if : contains(github.event.comment.body, '!large ')
77
67
run : |
78
- echo "## SQLite run" >> benchmark.md
79
- 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 '
80
- cat bench-sqlite .md >> benchmark.md
68
+ echo "## Large MySQL payload run (1MB) " >> mysql- benchmark.md
69
+ 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 '
70
+ cat bench-mysql-l .md >> mysql- benchmark.md
81
71
82
- - name : Run Redis benchmarks
83
- if : github.event.issue.pull_request && ! contains(github.event.comment.body, '!skipredis ')
72
+ - name : Run very large MySQL benchmarks
73
+ if : contains(github.event.comment.body, '!verylarge ')
84
74
run : |
85
- echo "## Redis run" >> benchmark.md
86
- 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 '
87
- cat bench-redis .md >> benchmark.md
75
+ echo "## Very Large MySQL payload run (5MB) " >> mysql- benchmark.md
76
+ 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 '
77
+ cat bench-mysql-vl .md >> mysql- benchmark.md
88
78
89
- - name : Run large MySQL benchmarks
90
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!large')
79
+ - name : Upload MySQL benchmark results
80
+ uses : actions/upload-artifact@v4
81
+ with :
82
+ name : mysql-results
83
+ path : mysql-benchmark.md
84
+
85
+ sqlite-bench :
86
+ runs-on : ubuntu-latest
87
+ if : (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipsqlite')
88
+ steps :
89
+ - name : Install Hyperfine
91
90
run : |
92
- echo "## Large MySQL payload run (1MB)" >> benchmark.md
93
- 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'
94
- cat bench-mysql-l.md >> benchmark.md
91
+ wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
92
+ sudo dpkg -i hyperfine_1.11.0_amd64.deb
95
93
96
- - name : Run large SQLite benchmarks
97
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!large')
94
+ - name : Get PR SHA
95
+ if : github.event_name == 'issue_comment'
96
+ id : sha
97
+ uses : actions/github-script@v6
98
+ with :
99
+ result-encoding : string
100
+ script : |
101
+ const response = await github.request(context.payload.issue.pull_request.url);
102
+ return response.data.head.sha;
103
+
104
+ - name : Checkout PR
105
+ uses : actions/checkout@v4
106
+ with :
107
+ ref : ${{ steps.sha.outputs.result || github.sha }}
108
+
109
+ - name : Set up Go
110
+ uses : actions/setup-go@v3
111
+ with :
112
+ go-version : 1.21
113
+ check-latest : true
114
+ cache : true
115
+
116
+ - name : Build PR
98
117
run : |
99
- echo "## Large SQLite payload run (1MB)" >> benchmark.md
100
- 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'
101
- cat bench-sqlite-l.md >> benchmark.md
118
+ go build -o bench-pr ./bench
102
119
103
- - name : Run large Redis benchmarks
104
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!large')
120
+ - name : Checkout main branch
121
+ uses : actions/checkout@v4
122
+ with :
123
+ clean : false
124
+ ref : main
125
+
126
+ - name : Build main
105
127
run : |
106
- echo "## Large Redis payload run (1MB)" >> benchmark.md
107
- 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'
108
- cat bench-redis-l.md >> benchmark.md
128
+ go build -o bench-main ./bench
109
129
110
- - name : Run very large MySQL benchmarks
111
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!verylarge')
130
+ - name : Run SQLite benchmarks
112
131
run : |
113
- echo "## Very Large MySQL payload run (5MB)" >> benchmark.md
114
- 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'
115
- cat bench-mysql-vl.md >> benchmark.md
132
+ echo "## SQLite run" > sqlite-benchmark.md
133
+ 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'
134
+ cat bench-sqlite.md >> sqlite-benchmark.md
135
+
136
+ - name : Run large SQLite benchmarks
137
+ if : contains(github.event.comment.body, '!large')
138
+ run : |
139
+ echo "## Large SQLite payload run (1MB)" >> sqlite-benchmark.md
140
+ 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'
141
+ cat bench-sqlite-l.md >> sqlite-benchmark.md
116
142
117
143
- name : Run very large SQLite benchmarks
118
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!verylarge')
144
+ if : contains(github.event.comment.body, '!verylarge')
119
145
run : |
120
- echo "## Very Large SQLite payload run (5MB)" >> benchmark.md
146
+ echo "## Very Large SQLite payload run (5MB)" >> sqlite- benchmark.md
121
147
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'
122
- cat bench-sqlite-vl.md >> benchmark.md
148
+ cat bench-sqlite-vl.md >> sqlite-benchmark.md
149
+
150
+ - name : Upload SQLite benchmark results
151
+ uses : actions/upload-artifact@v4
152
+ with :
153
+ name : sqlite-results
154
+ path : sqlite-benchmark.md
155
+
156
+ redis-bench :
157
+ runs-on : ubuntu-latest
158
+ if : (github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))) && !contains(github.event.comment.body, '!skipredis')
159
+ steps :
160
+ - name : Install Hyperfine
161
+ run : |
162
+ wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
163
+ sudo dpkg -i hyperfine_1.11.0_amd64.deb
164
+
165
+ - name : Get PR SHA
166
+ if : github.event_name == 'issue_comment'
167
+ id : sha
168
+ uses : actions/github-script@v6
169
+ with :
170
+ result-encoding : string
171
+ script : |
172
+ const response = await github.request(context.payload.issue.pull_request.url);
173
+ return response.data.head.sha;
174
+
175
+ - name : Checkout PR
176
+ uses : actions/checkout@v4
177
+ with :
178
+ ref : ${{ steps.sha.outputs.result || github.sha }}
179
+
180
+ - name : Set up Go
181
+ uses : actions/setup-go@v3
182
+ with :
183
+ go-version : 1.21
184
+ check-latest : true
185
+ cache : true
186
+
187
+ - name : Build PR
188
+ run : |
189
+ go build -o bench-pr ./bench
190
+
191
+ - name : Checkout main branch
192
+ uses : actions/checkout@v4
193
+ with :
194
+ clean : false
195
+ ref : main
196
+
197
+ - name : Build main
198
+ run : |
199
+ go build -o bench-main ./bench
200
+
201
+ - name : Start Redis
202
+ uses : shogo82148/actions-setup-redis@v1
203
+ with :
204
+ auto-start : true
205
+ redis-port : 6379
206
+ redis-version : " 6.2"
207
+ redis-conf : |
208
+ requirepass RedisPassw0rd
209
+ appendonly yes
210
+ appendfsync always
211
+
212
+ - name : Run Redis benchmarks
213
+ run : |
214
+ echo "## Redis run" > redis-benchmark.md
215
+ 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'
216
+ cat bench-redis.md >> redis-benchmark.md
217
+
218
+ - name : Run large Redis benchmarks
219
+ if : contains(github.event.comment.body, '!large')
220
+ run : |
221
+ echo "## Large Redis payload run (1MB)" >> redis-benchmark.md
222
+ 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'
223
+ cat bench-redis-l.md >> redis-benchmark.md
123
224
124
225
- name : Run very large Redis benchmarks
125
- if : github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!verylarge')
226
+ if : contains(github.event.comment.body, '!verylarge')
126
227
run : |
127
- echo "## Very Large Redis payload run (5MB)" >> benchmark.md
228
+ echo "## Very Large Redis payload run (5MB)" >> redis- benchmark.md
128
229
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'
129
- cat bench-redis-vl.md >> benchmark.md
230
+ cat bench-redis-vl.md >> redis-benchmark.md
231
+
232
+ - name : Upload Redis benchmark results
233
+ uses : actions/upload-artifact@v4
234
+ with :
235
+ name : redis-results
236
+ path : redis-benchmark.md
237
+
238
+ combine-results :
239
+ runs-on : ubuntu-latest
240
+ needs : [mysql-bench, sqlite-bench, redis-bench]
241
+ if : always() && (needs.mysql-bench.result == 'success' || needs.sqlite-bench.result == 'success' || needs.redis-bench.result == 'success') && github.event.issue.pull_request
242
+ steps :
243
+ - name : Download MySQL results
244
+ if : needs.mysql-bench.result == 'success'
245
+ uses : actions/download-artifact@v4
246
+ with :
247
+ name : mysql-results
248
+ path : ./results
249
+ continue-on-error : true
250
+
251
+ - name : Download SQLite results
252
+ if : needs.sqlite-bench.result == 'success'
253
+ uses : actions/download-artifact@v4
254
+ with :
255
+ name : sqlite-results
256
+ path : ./results
257
+ continue-on-error : true
258
+
259
+ - name : Download Redis results
260
+ if : needs.redis-bench.result == 'success'
261
+ uses : actions/download-artifact@v4
262
+ with :
263
+ name : redis-results
264
+ path : ./results
265
+ continue-on-error : true
266
+
267
+ - name : Combine benchmark results
268
+ run : |
269
+ echo "# Benchmark Results" > combined-benchmark.md
270
+ echo "" >> combined-benchmark.md
271
+
272
+ if [ -f "./results/mysql-benchmark.md" ]; then
273
+ cat ./results/mysql-benchmark.md >> combined-benchmark.md
274
+ echo "" >> combined-benchmark.md
275
+ fi
276
+
277
+ if [ -f "./results/sqlite-benchmark.md" ]; then
278
+ cat ./results/sqlite-benchmark.md >> combined-benchmark.md
279
+ echo "" >> combined-benchmark.md
280
+ fi
130
281
131
- - run : |
132
- cat ./benchmark.md
282
+ if [ -f "./results/redis-benchmark.md" ]; then
283
+ cat ./results/redis-benchmark.md >> combined-benchmark.md
284
+ echo "" >> combined-benchmark.md
285
+ fi
133
286
134
287
- name : Write a new comment
135
288
uses : peter-evans/create-or-update-comment@v2
136
289
continue-on-error : true
137
290
with :
138
291
issue-number : ${{ github.event.issue.number }}
139
- body-file : ./benchmark.md
292
+ body-file : ./combined- benchmark.md
0 commit comments