-
Notifications
You must be signed in to change notification settings - Fork 0
410 lines (365 loc) · 17.4 KB
/
test_run_ci.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
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
name: Test Run CLI
on:
workflow_dispatch:
inputs:
root_dir:
description: "Enter the root directory for benchmarks"
required: true
default: "/home/runner/work/"
date:
description: "Enter a date (optional, e.g. 20240101)"
required: false
default: ""
clients:
description: "Enter clients to use (e.g., [nethermind,geth,reth,erigon,besu])"
required: true
default: "[nethermind,geth,reth,erigon,besu]"
sizes:
description: "Enter sizes (e.g., [500,1000])"
required: false
default: "[5,10]"
repetitions:
description: "Enter the number of repetitions"
required: true
default: 1
pull_request:
types: [opened, synchronize]
jobs:
setup-environment:
runs-on: ubuntu-latest
env:
ROOT_DIR: ${{ github.event.inputs.root_dir || '/home/runner/work/' }}
DATE: ${{ github.event.inputs.date || '' }}
CLIENTS: ${{ github.event.inputs.clients || '["nethermind","geth","reth","erigon","besu"]' }}
SIZES: ${{ github.event.inputs.sizes || '[5,10]' }}
REPETITIONS: ${{ github.event.inputs.repetitions || 1 }}
outputs:
date: ${{ steps.set-date.outputs.date }}
root_dir: ${{ steps.set-date.outputs.root_dir }}
clients: ${{ steps.set-date.outputs.clients }}
sizes: ${{ steps.set-date.outputs.sizes }}
repetitions: ${{ steps.set-date.outputs.repetitions }}
steps:
- name: Set DATE variable
id: set-date
run: |
if [ -z "${{ env.DATE }}" ]; then
DATE=$(date +%Y%m%d)
else
DATE=${{ env.DATE }}
fi
echo "date=${DATE}" >> $GITHUB_OUTPUT
echo "root_dir=${{ env.ROOT_DIR }}" >> $GITHUB_OUTPUT
echo "clients=${{ env.CLIENTS }}" >> $GITHUB_OUTPUT
echo "sizes=${{ env.SIZES }}" >> $GITHUB_OUTPUT
echo "repetitions=${{ env.REPETITIONS }}" >> $GITHUB_OUTPUT
generate-matrix:
runs-on: ubuntu-latest
needs: setup-environment
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
date: ${{ needs.setup-environment.outputs.date }}
root_dir: ${{ needs.setup-environment.outputs.root_dir }}
clients: ${{ needs.setup-environment.outputs.clients }}
sizes: ${{ needs.setup-environment.outputs.sizes }}
repetitions: ${{ needs.setup-environment.outputs.repetitions }}
steps:
- name: Check Date
id: check-date
run: |
if [ -z "${{ needs.setup-environment.outputs.date }}" ];then
echo "Date is empty, exiting the job."
exit 1
fi
- name: Generate Matrix
id: generate-matrix
run: |
CLIENTS='${{ needs.setup-environment.outputs.clients }}'
SIZES='${{ needs.setup-environment.outputs.sizes }}'
echo "CLIENTS=${CLIENTS}"
echo "SIZES=${SIZES}"
CLIENTS_JSON=$(echo "$CLIENTS" | sed 's/[][]//g' | jq -R 'split(",")')
SIZES_JSON=$(echo "$SIZES" | sed 's/[][]//g' | jq -R 'split(",") | map(tonumber)')
MATRIX_CLIENTS=$(echo '{}' | jq -c --argjson clients "$CLIENTS_JSON" '.Client = $clients')
MATRIX=$(echo $MATRIX_CLIENTS | jq -c --argjson sizes "$SIZES_JSON" '.Size = $sizes')
echo "Updated MATRIX=${MATRIX}"
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
run-gas-benchmarks:
runs-on: ubuntu-latest
needs: generate-matrix
outputs:
matrix: ${{ needs.generate-matrix.outputs.matrix }}
date: ${{ needs.generate-matrix.outputs.date }}
root_dir: ${{ needs.generate-matrix.outputs.root_dir }}
clients: ${{ needs.generate-matrix.outputs.clients }}
sizes: ${{ needs.generate-matrix.outputs.sizes }}
repetitions: ${{ needs.generate-matrix.outputs.repetitions }}
strategy:
max-parallel: 8
matrix:
client: ${{ fromJson(needs.generate-matrix.outputs.matrix).Client }}
fail-fast: false
steps:
- name: Increase swapfile
run: |
sudo swapoff -a
sudo fallocate -l 15G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
- name: Clone gas benchmarks repo
run: |
ROOT_DIR=${{ needs.generate-matrix.outputs.root_dir }}
BRANCH_GAS_BENCHMARKS=rc-1
mkdir -p "${ROOT_DIR}"
cd "${ROOT_DIR}"
git clone -b $BRANCH_GAS_BENCHMARKS https://github.com/OpenFusionist/gas-benchmarks.git gas-benchmarks
- name: Checkout PR branch of benchmarks-data-results
uses: actions/checkout@v3
with:
repository: OpenFusionist/benchmarks-data-results
path: benchmarks-data-result
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy images.yaml
run: |
ROOT_DIR=${{ needs.generate-matrix.outputs.root_dir }}
cp "${GITHUB_WORKSPACE}/benchmarks-data-result/images.yaml" "${ROOT_DIR}/gas-benchmarks/"
- name: Run gas benchmarks
run: |
CLIENT=${{ matrix.client }}
REPETITIONS=${{ needs.generate-matrix.outputs.repetitions }}
ROOT_DIR=${{ needs.generate-matrix.outputs.root_dir }}
DATE=${{ needs.generate-matrix.outputs.date }}
cd "$ROOT_DIR/gas-benchmarks"
./run.sh -t "tests/" -w "" -c "$CLIENT" -r "$REPETITIONS" -o "results-$DATE"
python3 report_metadata.py "$DATE"
sudo apt-get install -y jq
max_value=$(jq -r '.["'"${{ matrix.client }}"'"].GasLimit.max' "results-$DATE/reports/result.json")
if [ "$max_value" = "0" ] || [ -z "$max_value" ]; then
echo "Client '${{ matrix.client }}' has no valid data (max=0 or missing)."
exit 1
else
echo "Client '${{ matrix.client }}' has valid data (max=$max_value)."
fi
- name: Zip the results folder
run: |
ROOT_DIR=${{ needs.generate-matrix.outputs.root_dir }}
DATE=${{ needs.generate-matrix.outputs.date }}
cd "$ROOT_DIR/gas-benchmarks"
zip -r reports-$DATE.zip "results-$DATE/reports"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: gas-benchmarks-${{ matrix.client }}-${{ needs.generate-matrix.outputs.date }}
path: ${{ needs.generate-matrix.outputs.root_dir }}/gas-benchmarks/reports-${{ needs.generate-matrix.outputs.date }}.zip
run-genesis-init-speed-benchmarks:
runs-on: ubuntu-latest
needs: run-gas-benchmarks
outputs:
matrix: ${{ needs.run-gas-benchmarks.outputs.matrix }}
date: ${{ needs.run-gas-benchmarks.outputs.date }}
root_dir: ${{ needs.run-gas-benchmarks.outputs.root_dir }}
clients: ${{ needs.run-gas-benchmarks.outputs.clients }}
sizes: ${{ needs.run-gas-benchmarks.outputs.sizes }}
repetitions: ${{ needs.run-gas-benchmarks.outputs.repetitions }}
strategy:
max-parallel: 8
matrix:
client: ${{ fromJson(needs.run-gas-benchmarks.outputs.matrix).Client }}
size: ${{ fromJson(needs.run-gas-benchmarks.outputs.matrix).Size }}
fail-fast: false
steps:
- name: Clone genesis init benchmarks repo
run: |
ROOT_DIR=${{ needs.run-gas-benchmarks.outputs.root_dir }}
BRANCH_GENESIS_INIT_BENCHMARKS=main
mkdir -p "${ROOT_DIR}"
cd "${ROOT_DIR}"
git clone -b $BRANCH_GENESIS_INIT_BENCHMARKS https://github.com/OpenFusionist/genesis-init-benchmarks.git genesis-init-benchmarks
- name: Checkout PR branch of benchmarks-data-results
uses: actions/checkout@v3
with:
repository: OpenFusionist/benchmarks-data-results
path: benchmarks-data-result
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy images.yaml
run: |
ROOT_DIR=${{ needs.run-gas-benchmarks.outputs.root_dir }}
cp "${GITHUB_WORKSPACE}/benchmarks-data-result/images.yaml" "${ROOT_DIR}/genesis-init-benchmarks/"
- name: Run genesis init speed benchmarks
run: |
CLIENT=${{ matrix.client }}
SIZE=${{ matrix.size }}
REPETITIONS=${{ needs.run-gas-benchmarks.outputs.repetitions }}
ROOT_DIR=${{ needs.run-gas-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-gas-benchmarks.outputs.date }}
cd "$ROOT_DIR/genesis-init-benchmarks"
./runSpeed.sh -t "tests/" -c "$CLIENT" -r "$REPETITIONS" -o "results-$DATE/speed" -s "$SIZE"
python3 report_metadata.py "$DATE" speed
sudo apt-get install -y jq
max_value=$(jq -r '.speed["'"${{ matrix.client }}"'"]["'"${{ matrix.size }}"'"].first.max' "results-$DATE/speed/reports/speed.json")
if [ "$max_value" = "0" ] || [ -z "$max_value" ]; then
echo "Client '${{ matrix.client }}' has no valid data (max=0 or missing)."
exit 1
else
echo "Client '${{ matrix.client }}' has valid data (max=$max_value)."
fi
- name: Zip the results folder
run: |
ROOT_DIR=${{ needs.run-gas-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-gas-benchmarks.outputs.date }}
cd "$ROOT_DIR/genesis-init-benchmarks"
zip -r reports-$DATE-speed.zip "results-$DATE/speed/reports"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: genesis-init-speed-${{ matrix.client }}-${{ matrix.size }}-${{ needs.run-gas-benchmarks.outputs.date }}
path: ${{ needs.run-gas-benchmarks.outputs.root_dir }}/genesis-init-benchmarks/reports-${{ needs.run-gas-benchmarks.outputs.date }}-speed.zip
run-genesis-init-memory-benchmarks:
runs-on: ubuntu-latest
needs: run-genesis-init-speed-benchmarks
outputs:
matrix: ${{ needs.run-genesis-init-speed-benchmarks.outputs.matrix }}
date: ${{ needs.run-genesis-init-speed-benchmarks.outputs.date }}
root_dir: ${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}
clients: ${{ needs.run-genesis-init-speed-benchmarks.outputs.clients }}
sizes: ${{ needs.run-genesis-init-speed-benchmarks.outputs.sizes }}
repetitions: ${{ needs.run-genesis-init-speed-benchmarks.outputs.repetitions }}
strategy:
max-parallel: 8
matrix:
client: ${{ fromJson(needs.run-genesis-init-speed-benchmarks.outputs.matrix).Client }}
size: ${{ fromJson(needs.run-genesis-init-speed-benchmarks.outputs.matrix).Size }}
fail-fast: false
steps:
- name: Clone genesis init benchmarks repo
run: |
ROOT_DIR=${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}
BRANCH_GENESIS_INIT_BENCHMARKS=main
mkdir -p "${ROOT_DIR}"
cd "${ROOT_DIR}"
git clone -b $BRANCH_GENESIS_INIT_BENCHMARKS https://github.com/OpenFusionist/genesis-init-benchmarks.git genesis-init-benchmarks
- name: Checkout PR branch of benchmarks-data-results
uses: actions/checkout@v3
with:
repository: OpenFusionist/benchmarks-data-results
path: benchmarks-data-result
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy images.yaml
run: |
ROOT_DIR=${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}
cp "${GITHUB_WORKSPACE}/benchmarks-data-result/images.yaml" "${ROOT_DIR}/genesis-init-benchmarks/"
- name: Run genesis init memory benchmarks
run: |
CLIENT=${{ matrix.client }}
SIZE=${{ matrix.size }}
REPETITIONS=${{ needs.run-genesis-init-speed-benchmarks.outputs.repetitions }}
ROOT_DIR=${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-genesis-init-speed-benchmarks.outputs.date }}
cd "$ROOT_DIR/genesis-init-benchmarks"
./runMemory.sh -t "tests/" -c "$CLIENT" -r "$REPETITIONS" -o "results-$DATE/memory" -s "$SIZE"
python3 report_metadata.py "$DATE" memory
sudo apt-get install -y jq
max_value=$(jq -r '.memory["'"${{ matrix.client }}"'"]["'"${{ matrix.size }}"'"].first.max' "results-$DATE/memory/reports/memory.json")
if [ "$max_value" = "0" ] || [ -z "$max_value" ]; then
echo "Client '${{ matrix.client }}' has no valid data (max=0 or missing)."
exit 1
else
echo "Client '${{ matrix.client }}' has valid data (max=$max_value)."
fi
max_value=$(jq -r '.memory["'"${{ matrix.client }}"'"]["'"${{ matrix.size }}"'"].second.max' "results-$DATE/memory/reports/memory.json")
if [ "$max_value" = "0" ] || [ -z "$max_value" ]; then
echo "Client '${{ matrix.client }}' has no valid data (max=0 or missing)."
exit 1
else
echo "Client '${{ matrix.client }}' has valid data (max=$max_value)."
fi
- name: Zip the results folder
run: |
ROOT_DIR=${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-genesis-init-speed-benchmarks.outputs.date }}
cd "$ROOT_DIR/genesis-init-benchmarks"
zip -r reports-$DATE-memory.zip "results-$DATE/memory/reports"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: genesis-init-memory-${{ matrix.client }}-${{ matrix.size }}-${{ needs.run-genesis-init-speed-benchmarks.outputs.date }}
path: ${{ needs.run-genesis-init-speed-benchmarks.outputs.root_dir }}/genesis-init-benchmarks/reports-${{ needs.run-genesis-init-speed-benchmarks.outputs.date }}-memory.zip
run-burntpix-benchmarks:
runs-on: ubuntu-latest
needs: run-genesis-init-memory-benchmarks
outputs:
matrix: ${{ needs.run-genesis-init-memory-benchmarks.outputs.matrix }}
date: ${{ needs.run-genesis-init-memory-benchmarks.outputs.date }}
root_dir: ${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}
clients: ${{ needs.run-genesis-init-memory-benchmarks.outputs.clients }}
sizes: ${{ needs.run-genesis-init-memory-benchmarks.outputs.sizes }}
repetitions: ${{ needs.run-genesis-init-memory-benchmarks.outputs.repetitions }}
steps:
- name: Create /tmp/ directory
run: mkdir -p /tmp/
- name: Set permissions for /tmp/
run: sudo chmod -R 777 /tmp/
- name: Clone burntpix benchmarks repo
run: |
ROOT_DIR=${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}
BRANCH_BURNTPIX_BENCHMARKS=burnt-rc-1
mkdir -p "${ROOT_DIR}"
cd "${ROOT_DIR}"
git clone -b $BRANCH_BURNTPIX_BENCHMARKS https://github.com/OpenFusionist/gas-benchmarks.git burntpix-benchmarks
- name: Checkout PR branch of benchmarks-data-results
uses: actions/checkout@v3
with:
repository: OpenFusionist/benchmarks-data-results
path: benchmarks-data-result
ref: ${{ github.event.pull_request.head.sha }}
- name: Copy images.yaml
run: |
ROOT_DIR=${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}
cp "${GITHUB_WORKSPACE}/benchmarks-data-result/images.yaml" "${ROOT_DIR}/burntpix-benchmarks/"
- name: Run burntpix benchmarks
run: |
# Use const due to can't handle ${{ needs.run-genesis-init-memory-benchmarks.outputs.clients }}
CLIENT="nethermind,geth,reth,erigon,besu"
REPETITIONS=${{ needs.run-genesis-init-memory-benchmarks.outputs.repetitions }}
ROOT_DIR=${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-genesis-init-memory-benchmarks.outputs.date }}
cd "$ROOT_DIR/burntpix-benchmarks"
./run.sh -t "testburnt/" -w "./testburntwarm/warm.txt" -c "$CLIENT" -r "$REPETITIONS" -o "results-$DATE"
python3 report_metadata.py "$DATE"
sudo apt-get install -y jq
max_value=$(jq -r '.["'"${{ matrix.client }}"'"].GasLimit.max' "results-$DATE/reports/result.json")
if [ "$max_value" = "0" ] || [ -z "$max_value" ]; then
echo "Client '${{ matrix.client }}' has no valid data (max=0 or missing)."
exit 1
else
echo "Client '${{ matrix.client }}' has valid data (max=$max_value)."
fi
- name: Zip the results folder
run: |
ROOT_DIR=${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}
DATE=${{ needs.run-genesis-init-memory-benchmarks.outputs.date }}
cd "$ROOT_DIR/burntpix-benchmarks"
zip -r reports-$DATE.zip "results-$DATE/reports"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: burntpix-benchmarks-${{ matrix.client }}-${{ needs.run-genesis-init-memory-benchmarks.outputs.date }}
path: ${{ needs.run-genesis-init-memory-benchmarks.outputs.root_dir }}/burntpix-benchmarks/reports-${{ needs.run-genesis-init-memory-benchmarks.outputs.date }}.zip
push-results:
runs-on: ubuntu-latest
needs: run-burntpix-benchmarks
steps:
- name: Clone benchmarks data result repo
run: |
ROOT_DIR=${{ needs.run-burntpix-benchmarks.outputs.root_dir }}
BRANCH_BENCHMARKS_DATA_RESULT=main
mkdir -p "${ROOT_DIR}"
cd "${ROOT_DIR}"
git clone -b $BRANCH_BENCHMARKS_DATA_RESULT https://github.com/OpenFusionist/benchmarks-data-results.git benchmarks-data-result
- name: Push results
run: |
ROOT_DIR=${{ needs.run-burntpix-benchmarks.outputs.root_dir }}
cd "$ROOT_DIR/benchmarks-data-result"
git status