-
Notifications
You must be signed in to change notification settings - Fork 9
289 lines (275 loc) · 13.7 KB
/
test.yaml
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: Test
on:
push:
branches:
- master
- main
- release/**
- dev
pull_request: null
workflow_dispatch:
jobs:
golangci-lint:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- run: sudo apt-get update && sudo apt-get install -y libseccomp-dev
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.56.2
args: --verbose
create-lxc-image:
name: create-lxc-image
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- uses: actions/cache/restore@v4
id: cache-restore
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst
lookup-only: true
- name: setup lxd
id: s1
if: steps.cache-restore.outputs.cache-hit != 'true'
run: ./test/setup_lxd.sh
- name: launch lxc container
id: s2
if: steps.s1.conclusion == 'success'
run: ./test/launch_test_lxc.sh
- name: install dependencies and build
id: s3
if: steps.s2.conclusion == 'success'
run: sudo lxc exec test -- sudo --login --user ubuntu /host/test/init_test.sh
- name: export image
id: s4
if: steps.s3.conclusion == 'success'
run: ./test/export_lxc_image.sh test
- uses: actions/cache/save@v4
id: s5
if: steps.s4.conclusion == 'success'
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst
test:
runs-on: ubuntu-22.04
needs: create-lxc-image
timeout-minutes: 20
steps:
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v4
id: cache-restore
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run test
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/bypass4netns/test/run_test.sh SYNC"
# some source codes may be updated. re-export new image.
- name: export image
run: sudo lxc image alias delete test-export && rm -f /tmp/test-image.tar.zst && ./test/export_lxc_image.sh test
- uses: actions/cache/save@v4
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
#- name: debug
# run: ./debug.sh
benchmark:
runs-on: ubuntu-22.04
needs: test
timeout-minutes: 20
strategy:
matrix:
script: ["iperf3/iperf3_host", "iperf3/iperf3", "postgres/postgres", "redis/redis", "block/block", "memcached/memcached", "rabbitmq/rabbitmq", "etcd/etcd", "mysql/mysql"]
steps:
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v4
id: cache-restore
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run benchmark (${{ matrix.script }})
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}.sh"
- name: upload plot
id: get_plot
if: matrix.script != 'iperf3/iperf3_host'
run: |
mkdir /tmp/benchmark-results
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-rootful-direct.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-rootful-host.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-wo-b4ns-direct.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-wo-b4ns-host.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-w-b4ns.log /tmp/benchmark-results/.
- uses: actions/upload-artifact@v3
if: steps.get_plot.conclusion == 'success'
with:
name: benchmark-results
path: /tmp/benchmark-results
benchmark-multinode:
runs-on: ubuntu-22.04
needs: test
timeout-minutes: 20
strategy:
matrix:
script: ["iperf3/iperf3", "postgres/postgres", "redis/redis", "block/block", "memcached/memcached", "rabbitmq/rabbitmq", "etcd/etcd", "mysql/mysql"]
steps:
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v4
id: cache-restore
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run benchmark (${{ matrix.script }})
run: ./benchmark/${{ matrix.script }}_multinode.sh
- name: upload plot
run: |
mkdir /tmp/benchmark-results
cp benchmark/${{ matrix.script }}-multinode-rootful.log /tmp/benchmark-results/.
cp benchmark/${{ matrix.script }}-multinode-wo-b4ns.log /tmp/benchmark-results/.
cp benchmark/${{ matrix.script }}-multinode-w-b4ns.log /tmp/benchmark-results/.
- uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: /tmp/benchmark-results
plot:
runs-on: ubuntu-22.04
needs: [benchmark, benchmark-multinode]
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- run: sudo apt update && sudo apt install python3 python3-pip
- run: pip3 install matplotlib numpy
- uses: actions/download-artifact@v3
with:
name: benchmark-results
path: ./
- run: mkdir /tmp/benchmark-plots
- run: python3 benchmark/redis/redis_plot.py redis-rootful-direct.log redis-rootful-host.log redis-wo-b4ns-direct.log redis-wo-b4ns-host.log redis-w-b4ns.log /tmp/benchmark-plots/redis.png
- run: python3 benchmark/redis/redis_plot.py redis-multinode-rootful.log redis-multinode-wo-b4ns.log redis-multinode-w-b4ns.log /tmp/benchmark-plots/redis-multinode.png
- run: python3 benchmark/iperf3/iperf3_plot.py iperf3-rootful-direct.log iperf3-rootful-host.log iperf3-wo-b4ns-direct.log iperf3-wo-b4ns-host.log iperf3-w-b4ns.log /tmp/benchmark-plots/iperf3.png
- run: python3 benchmark/iperf3/iperf3_plot.py iperf3-multinode-rootful.log iperf3-multinode-wo-b4ns.log iperf3-multinode-w-b4ns.log /tmp/benchmark-plots/iperf3-multinode.png
- run: python3 benchmark/postgres/postgres_plot.py postgres-rootful-direct.log postgres-rootful-host.log postgres-wo-b4ns-direct.log postgres-wo-b4ns-host.log postgres-w-b4ns.log /tmp/benchmark-plots/postgres.png
- run: python3 benchmark/postgres/postgres_plot.py postgres-multinode-rootful.log postgres-multinode-wo-b4ns.log postgres-multinode-w-b4ns.log /tmp/benchmark-plots/postgres-multinode.png
- run: python3 benchmark/block/block_plot.py block-rootful-direct.log block-rootful-host.log block-wo-b4ns-direct.log block-wo-b4ns-host.log block-w-b4ns.log /tmp/benchmark-plots/block.png
- run: python3 benchmark/block/block_plot.py block-multinode-rootful.log block-multinode-wo-b4ns.log block-multinode-w-b4ns.log /tmp/benchmark-plots/block-multinode.png
- run: python3 benchmark/memcached/memcached_plot.py memcached-rootful-direct.log memcached-rootful-host.log memcached-wo-b4ns-direct.log memcached-wo-b4ns-host.log memcached-w-b4ns.log /tmp/benchmark-plots/memcached.png
- run: python3 benchmark/memcached/memcached_plot.py memcached-multinode-rootful.log memcached-multinode-wo-b4ns.log memcached-multinode-w-b4ns.log /tmp/benchmark-plots/memcached-multinode.png
- run: python3 benchmark/rabbitmq/rabbitmq_plot.py rabbitmq-rootful-direct.log rabbitmq-rootful-host.log rabbitmq-wo-b4ns-direct.log rabbitmq-wo-b4ns-host.log rabbitmq-w-b4ns.log /tmp/benchmark-plots/rabbitmq.png
- run: python3 benchmark/rabbitmq/rabbitmq_plot.py rabbitmq-multinode-rootful.log rabbitmq-multinode-wo-b4ns.log rabbitmq-multinode-w-b4ns.log /tmp/benchmark-plots/rabbitmq-multinode.png
- run: python3 benchmark/etcd/etcd_plot.py etcd-rootful-direct.log etcd-rootful-host.log etcd-wo-b4ns-direct.log etcd-wo-b4ns-host.log etcd-w-b4ns.log /tmp/benchmark-plots/etcd.png
- run: python3 benchmark/etcd/etcd_plot.py etcd-multinode-rootful.log etcd-multinode-wo-b4ns.log etcd-multinode-w-b4ns.log /tmp/benchmark-plots/etcd-multinode.png
- run: python3 benchmark/mysql/mysql_plot.py mysql-rootful-direct.log mysql-rootful-host.log mysql-wo-b4ns-direct.log mysql-wo-b4ns-host.log mysql-w-b4ns.log /tmp/benchmark-plots/mysql.png
- run: python3 benchmark/mysql/mysql_plot.py mysql-multinode-rootful.log mysql-multinode-wo-b4ns.log mysql-multinode-w-b4ns.log /tmp/benchmark-plots/mysql-multinode.png
- uses: actions/upload-artifact@v3
with:
name: benchmark-plots
path: /tmp/benchmark-plots
bench-script:
runs-on: ubuntu-22.04
needs: test
timeout-minutes: 60
steps:
- uses: actions/[email protected]
# thanks to https://github.com/NobuoTsukamoto/my_actions_test/blob/main/.github/workflows/test_contains.yml
- name: cleanup
run: |
sudo rm -rf "/opt/*" || true
sudo rm -rf "/usr/share/dotnet" || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true
sudo rm -rf "/usr/local/lib/android" || true
sudo rm -rf "/usr/local/share/boost" || true
sudo rm -rf "/usr/lib/jvm" || true
sudo rm -rf "/usr/share/swift" || true
sudo rm -rf "/usr/local/julia*" || true
sudo rm -rf "/usr/share/kotlinc" || true
sudo rm -rf "/usr/local/share/edge_driver" || true
sudo rm -rf "/usr/local/share/chromedriver-linux64" || true
sudo rm -rf "/usr/local/share/gecko_driver" || true
sudo rm -rf "/usr/share/miniconda" || true
sudo rm -rf "/usr/local/share/phantomjs*" || true
sudo rm -rf "/usr/share/sbt" || true
sudo rm -rf "/usr/local/sqlpackage" || true
sudo rm -rf "/usr/bin/yq" || true
sudo rm -rf "/usr/local/share/vcpkg" || true
sudo rm -rf "/usr/local/bin/terraform" || true
sudo rm -rf "/usr/local/bin/stack" || true
sudo rm -rf "/usr/local/bin/aliyun" || true
sudo rm -rf "/usr/local/bin/pulumi" || true
sudo rm -rf "/usr/local/bin/pulumi-language-dotnet" || true
sudo rm -rf "/usr/local/bin/azcopy" || true
sudo rm -rf "/usr/local/aws-cli" || true
sudo rm -rf "/usr/local/bin/bicep" || true
sudo rm -rf "/usr/local/bin/rebar3" || true
sudo rm -rf "/usr/local/bin/phpunit" || true
sudo rm -rf "/usr/local/bin/packer" || true
sudo rm -rf "/usr/local/bin/bicep" || true
sudo rm -rf "/usr/local/bin/docker-compose" || true
sudo rm -rf "$HOME/.dotnet/tools" || true
sudo rm -rf "/etc/skel/.dotnet/tools" || true
sudo rm -rf "/usr/local/bin/minikube" || true
sudo rm -rf "/usr/local/bin/kustomize" || true
sudo rm -rf "/usr/local/bin/kubectl" || true
sudo rm -rf "/usr/local/bin/kind" || true
sudo rm -rf "/usr/local/bin/helm"
sudo docker image prune --all --force
sudo npm uninstall bazel
rustup self uninstall -y
sudo apt purge ansible aria2 azure-cli cabal* clang* \
dotnet-sdk* ghc* google-chrome-stable kubectl mysql* \
node* npm* php* powershell rpm ruby* subversion yarn \
firefox mono-complete nuget apache2 moby-engine moby-cli \
moby-buildx moby-compose microsoft-edge-stable mongodb* \
nginx postgresql* libpq-dev r-base sphinxsearch swig \
tcl temurin-* skopeo imagemagick-* mssql-tools* unixodbc-dev \
ubuntu-advantage-tools docker-* fonts-* llvm-* javascript-common \
openjdk-11-jre-headless linux-cloud-tools* linux-azure-6.2-* \
hicolor-icon-theme gcc-9 gcc-10 gcc-11 gcc-12 cloud-initramfs* \
x11-* bind9-* cloud-* gir1.2-* golang-github-* libjs-* libllvm* \
nano podman buildah skopeo \
-yq > /dev/null 2>&1 || true
sudo apt-get autoremove -y > /dev/null 2>&1 || true
sudo apt-get autoclean -y > /dev/null 2>&1 || true
df -h
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v4
id: cache-restore
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run benchmark (all)
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/bypass4netns/benchmark/run_bench.sh"