-
Notifications
You must be signed in to change notification settings - Fork 11
290 lines (248 loc) · 8.62 KB
/
perf.yml
File metadata and controls
290 lines (248 loc) · 8.62 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
name: Performance Tests
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
compare_upstream:
type: boolean
default: true
description: Compare against upstream quinn
publish_metrics:
type: boolean
default: false
description: Publish metrics to perf.iroh.computer
concurrency:
group: perf-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build:
name: Build ${{ matrix.impl }} perf
runs-on: [self-hosted, linux, X64]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- impl: noq
artifact: noq-perf
- impl: upstream-quinn
artifact: quinn-perf-upstream
steps:
- uses: actions/checkout@v6
if: matrix.impl == 'noq'
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Get latest quinn release tag
if: matrix.impl == 'upstream-quinn'
id: quinn-release
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/quinn-rs/quinn/releases/latest | jq -r '.tag_name')
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "Using upstream quinn release: $LATEST_TAG"
- name: Clone upstream quinn
if: matrix.impl == 'upstream-quinn'
run: |
rm -rf /tmp/upstream-quinn
git clone --depth 1 --branch ${{ steps.quinn-release.outputs.tag }} \
https://github.com/quinn-rs/quinn.git /tmp/upstream-quinn
- name: Build perf binary
run: cargo build --release -p perf --features json-output
working-directory: ${{ matrix.impl == 'upstream-quinn' && '/tmp/upstream-quinn' || '.' }}
- name: Upload binary
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.impl == 'upstream-quinn' && '/tmp/upstream-quinn/target/release/quinn-perf' || 'target/release/noq-perf' }}
retention-days: 1
raw-perf:
name: Raw perf ${{ matrix.impl }}
needs: build
runs-on: [self-hosted, linux, X64]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
impl: [noq, upstream-quinn]
include:
- impl: noq
artifact: noq-perf
- impl: upstream-quinn
artifact: quinn-perf-upstream
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
name: ${{ matrix.artifact }}
path: ./bin
- name: Run benchmarks
run: |
PERF_BIN=$(ls ./bin/noq-perf ./bin/quinn-perf 2>/dev/null | head -1)
chmod +x "$PERF_BIN"
./.github/scripts/run_perf.sh "$PERF_BIN" results/${{ matrix.impl }}
- uses: actions/upload-artifact@v5
with:
name: raw-results-${{ matrix.impl }}
path: results/
retention-days: 3
netsim-perf:
name: Netsim perf ${{ matrix.impl }}
needs: build
runs-on: [self-hosted, linux, X64]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
impl: [noq, upstream-quinn]
include:
- impl: noq
artifact: noq-perf
- impl: upstream-quinn
artifact: quinn-perf-upstream
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
name: ${{ matrix.artifact }}
path: ./bin
- name: Fetch netsim
run: |
rm -rf /tmp/chuck
git clone --depth 1 https://github.com/n0-computer/chuck.git /tmp/chuck
- name: Install netsim deps
run: |
cd /tmp/chuck/netsim
sudo apt-get update
./setup.sh || true
./cleanup.sh || true
- name: Setup netsim bins
run: |
mkdir -p /tmp/chuck/netsim/bins
if [ -f ./bin/noq-perf ]; then
chmod +x ./bin/noq-perf
cp ./bin/noq-perf /tmp/chuck/netsim/bins/noq-perf
else
chmod +x ./bin/quinn-perf
cp ./bin/quinn-perf /tmp/chuck/netsim/bins/noq-perf
fi
- name: Run netsim perf test
id: run_netsim
continue-on-error: true
run: |
./.github/scripts/run_netsim_perf.sh ${{ matrix.impl }} /tmp/chuck/netsim
- name: Collect results
if: always()
run: |
mkdir -p results/${{ matrix.impl }}
cp /tmp/chuck/netsim/report/*.json results/${{ matrix.impl }}/ 2>/dev/null || true
cp /tmp/chuck/netsim/logs/*.log results/${{ matrix.impl }}/ 2>/dev/null || true
- uses: actions/upload-artifact@v5
if: always()
with:
name: netsim-results-${{ matrix.impl }}
path: results/
retention-days: 3
- name: Cleanup netsim
if: always()
run: |
cd /tmp/chuck/netsim
./cleanup.sh || true
compare:
name: Compare results
needs: [raw-perf, netsim-perf]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
pattern: raw-results-*
merge-multiple: true
path: raw-results/
- uses: actions/download-artifact@v5
with:
pattern: netsim-results-*
merge-multiple: true
path: netsim-results/
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Generate comparison report
id: compare
run: |
python .github/scripts/compare_results.py raw-results/ netsim-results/ > comparison.md
echo "COMPARISON<<EOF" >> $GITHUB_OUTPUT
cat comparison.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Convert to Metro format
run: |
python .github/scripts/perf_to_metro.py raw-results/ netsim-results/ \
--commit ${{ github.sha }} > metro.json
- name: Show results
run: |
echo "=== Comparison Report ==="
cat comparison.md
echo ""
echo "=== Metro Metrics ==="
cat metro.json
- name: Upload comparison report
uses: actions/upload-artifact@v5
with:
name: perf-comparison-report
path: |
comparison.md
metro.json
retention-days: 7
- name: Publish metrics to Metro
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
if [[ -n "${{ secrets.METRO_TOKEN }}" && -n "${{ secrets.METRO_ENDPOINT }}" ]]; then
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.METRO_TOKEN }}" \
--data @metro.json \
"${{ secrets.METRO_ENDPOINT }}"
else
echo "Metro secrets not configured, skipping publish"
fi
- name: Find existing comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- perf-report -->'
- name: Create new PR comment
if: github.event_name == 'pull_request' && steps.find-comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- perf-report -->
## Performance Comparison Report
<details>
<summary><code>${{ github.event.pull_request.head.sha }}</code> - <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">artifacts</a></summary>
${{ steps.compare.outputs.COMPARISON }}
</details>
- name: Update existing PR comment
if: github.event_name == 'pull_request' && steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: append
body: |
---
<details>
<summary><code>${{ github.event.pull_request.head.sha }}</code> - <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">artifacts</a></summary>
${{ steps.compare.outputs.COMPARISON }}
</details>