-
Notifications
You must be signed in to change notification settings - Fork 119
252 lines (214 loc) · 7.39 KB
/
netbench.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
on:
push:
branches:
- main
pull_request:
branches:
- main
name: netbench
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2022-09-15
CDN: https://dnglbrstg7yg.cloudfront.net
# By default depandabot only receives read permissions. Explicitly give it write
# permissions which is needed by the ouzi-dev/commit-status-updater task.
#
# Updating status is relatively safe (doesnt modify source code) and caution
# should we taken before adding more permissions.
permissions:
statuses: write
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
profile: minimal
override: true
components: rustfmt
- name: Run cargo fmt
uses: actions-rs/[email protected]
with:
command: fmt
args: --manifest-path netbench/Cargo.toml --all -- --check
clippy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- toolchain: stable
# fail on stable warnings
args: "-D warnings"
- toolchain: beta
steps:
- uses: actions/checkout@v3
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
components: clippy
- uses: camshaft/rust-cache@v1
# TODO translate json reports to in-action warnings
- name: Run cargo clippy
uses: actions-rs/[email protected]
with:
command: clippy
# deriving Eq may break API compatibility so we disable it
# See https://github.com/rust-lang/rust-clippy/issues/9063
args: --manifest-path netbench/Cargo.toml --all-features --all-targets -- -A clippy::derive_partial_eq_without_eq ${{ matrix.args }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: 1.67.0
override: true
- uses: camshaft/rust-cache@v1
- name: Restore fuzz corpus
shell: bash
run: |
find . -name 'corpus.tar.gz' -exec dirname {} ';' | xargs -L 1 bash -c 'cd "$0" && rm -rf corpus && tar xf corpus.tar.gz'
- name: Run cargo build
uses: actions-rs/[email protected]
with:
command: build
args: --manifest-path netbench/Cargo.toml --tests
- name: Run cargo test
uses: actions-rs/[email protected]
with:
command: test
args: --manifest-path netbench/Cargo.toml
build:
runs-on: ubuntu-latest
outputs:
scenarios: ${{ steps.scenarios.outputs.scenarios }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: 1.67.0
override: true
- uses: camshaft/rust-cache@v1
- name: Run cargo build
uses: actions-rs/[email protected]
with:
command: build
args: --manifest-path netbench/Cargo.toml --release
- name: Generate scenarios
id: scenarios
run: |
./netbench/target/release/netbench-scenarios \
--request_response.response_size=8GiB
SCENARIOS=$(find target/netbench -type f -exec basename -s .json {} \; | jq -Rcs 'rtrimstr("\n") | split("\n")')
echo "::set-output name=scenarios::$SCENARIOS"
- name: Prepare artifact
run: |
mkdir -p artifact
cp -r target/netbench artifact/scenarios
cp netbench/target/release/netbench* artifact
- uses: actions/upload-artifact@v3
with:
name: netbench
path: artifact
run-localhost:
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
driver:
- s2n-quic
- native-tls
- tcp
- s2n-tls
scenario: ${{ fromJson(needs.build.outputs.scenarios) }}
env:
SCENARIO: scenarios/${{ matrix.scenario }}.json
steps:
- uses: actions/download-artifact@v3
with:
name: netbench
path: .
- name: Prepare artifact
run: |
chmod +x ./netbench*
mkdir -p results/${{ matrix.scenario }}/${{ matrix.driver }}
- name: Install bpftrace
run: |
sudo docker pull quay.io/iovisor/bpftrace:master-vanilla_llvm_clang_glibc2.27
sudo docker run -v $(pwd):/output quay.io/iovisor/bpftrace:master-vanilla_llvm_clang_glibc2.27 \
/bin/bash -c "cp /usr/bin/bpftrace /output"
sudo chown root:root bpftrace
sudo chmod +x bpftrace
sudo mv bpftrace /usr/bin/
- name: Setup environment
run: |
# set larger socket buffers
sudo sysctl -w net.core.wmem_default=2000000
sudo sysctl -w net.core.rmem_default=2000000
- name: Run server
run: |
sudo SCENARIO=$SCENARIO S2N_UNSTABLE_CRYPTO_OPT_TX=1 S2N_UNSTABLE_CRYPTO_OPT_RX=1 ./netbench-collector \
./netbench-driver-${{ matrix.driver }}-server > results/${{ matrix.scenario }}/${{ matrix.driver }}/server.json &
- name: Run client
run: |
export SERVER_0=localhost:4433
sudo SCENARIO=$SCENARIO SERVER_0=$SERVER_0 S2N_UNSTABLE_CRYPTO_OPT_TX=1 S2N_UNSTABLE_CRYPTO_OPT_RX=1 ./netbench-collector \
./netbench-driver-${{ matrix.driver }}-client > results/${{ matrix.scenario }}/${{ matrix.driver }}/client.json
- uses: actions/upload-artifact@v3
with:
name: netbench-${{ matrix.driver }}-results
path: results
report:
runs-on: ubuntu-latest
needs: [run-localhost]
steps:
- uses: actions/download-artifact@v3
with:
path: .
- name: Generate reports
run: |
chmod +x ./netbench/netbench*
mkdir -p results
cp -R netbench-*-results/* results/
./netbench/netbench-cli report-tree results reports
- uses: actions/upload-artifact@v3
with:
name: netbench-report
path: reports
- uses: aws-actions/[email protected]
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-1
- name: Upload results
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
id: s3
run: |
TARGET="${{ github.sha }}/netbench"
aws s3 sync reports "s3://s2n-quic-ci-artifacts/$TARGET" --acl private --follow-symlinks
URL="$CDN/$TARGET/index.html"
echo "::set-output name=URL::$URL"
- uses: ouzi-dev/[email protected]
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
with:
name: "netbench / report"
status: "success"
url: "${{ steps.s3.outputs.URL }}"