-
Notifications
You must be signed in to change notification settings - Fork 52
139 lines (118 loc) · 6.7 KB
/
bench.yml
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
on:
workflow_dispatch:
issue_comment:
types: [ created ]
name: Benchmark
jobs:
bench:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || (github.event.issue.pull_request && contains(github.event.comment.body, '!bench'))
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@v2
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@v3
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: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Run MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql')
run: |
echo "## MySQL run" >> 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 >> benchmark.md
- name: Run SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite')
run: |
echo "## SQLite run" >> 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 >> benchmark.md
- name: Run Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis')
run: |
echo "## Redis run" >> 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 >> benchmark.md
- name: Run large MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!large')
run: |
echo "## Large MySQL payload run (1MB)" >> 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 >> benchmark.md
- name: Run large SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!large')
run: |
echo "## Large SQLite payload run (1MB)" >> 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 >> benchmark.md
- name: Run large Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!large')
run: |
echo "## Large Redis payload run (1MB)" >> 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 >> benchmark.md
- name: Run very large MySQL benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipmysql') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large MySQL payload run (5MB)" >> 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 >> benchmark.md
- name: Run very large SQLite benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipsqlite') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large SQLite payload run (5MB)" >> 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 >> benchmark.md
- name: Run very large Redis benchmarks
if: github.event.issue.pull_request && !contains(github.event.comment.body, '!skipredis') && contains(github.event.comment.body, '!verylarge')
run: |
echo "## Very Large Redis payload run (5MB)" >> 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 >> benchmark.md
- run: |
cat ./benchmark.md
- 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: ./benchmark.md