-
Notifications
You must be signed in to change notification settings - Fork 1
343 lines (338 loc) · 13.5 KB
/
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
on:
push:
branches:
- '**'
#pull_request:
# branches:
# - master
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: true
jobs:
tests:
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- displayTargetName: ubuntu-22.04
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: defconfig
add_configs: CONFIG_UML_NET_VECTOR=y CFLAGS+="-DCONFIG_UML_NET_VECTOR"
testname: um-mmu
- displayTargetName: ubuntu-22.04 (nommu)
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: x86_64_nommu_defconfig
add_configs: CONFIG_UML_NET_VECTOR=y CFLAGS+="-DCONFIG_UML_NET_VECTOR"
kunit_opts: --kconfig_add CONFIG_MMU=n
testname: um-nommu
timeout-minutes: 100
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
detached: true
- name: Set env
shell: bash
run: |
echo "/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.defconfig }}-ccache-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.defconfig }}-ccache-build-
- name: Install packages
run: |
sudo apt update -y
sudo apt install -y ccache iperf3
- name: Setup latest Alpine Linux
uses: jirutka/setup-alpine@v1
with:
branch: v3.20
packages: >
alpine-sdk
doas
libtirpc-dev
linux-headers
- name: build bench tools
run: |
git clone https://github.com/ricarkol/lmbench2.git
cd lmbench2
touch src/Makefile
touch Makefile
make
cd ..
make -C .github/workflows/
shell: alpine.sh {0}
# --root {0}
- name: Setup faketty
uses: Yuri6037/Action-FakeTTY@v1.1
- name: setup tap interface
run: |
set -x
sudo ip tuntap add dev tap100 mode tap user ${USER}
sudo ip add add 192.168.122.1/24 dev tap100
sudo ip link set up dev tap100
iperf3 -s &
- name: build-0 (static)
run: |
make ARCH=um ${{ matrix.defconfig }} O=build
cat build/.config | sed "s/.*CONFIG_STATIC_LINK.*/CONFIG_STATIC_LINK=y/" > /tmp/a; mv /tmp/a build/.config
make -j8 ARCH=um O=build ${{ matrix.add_configs }}
- name: prep for docker build
run: |
cp build/vmlinux .github/workflows/
cp -rpf lmbench2 .github/workflows/
- name: Build and push Docker image (no push)
uses: docker/build-push-action@v6
with:
context: .github/workflows
build-args: "MODE=${{ matrix.testname }}"
push: false
tags: |
ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
- name: image for test
run: |
docker create --name alpine-nommu ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
docker start alpine-nommu
docker wait alpine-nommu
docker logs alpine-nommu
docker export alpine-nommu > alpine.tar
docker rm alpine-nommu
mnt=$(mktemp -d)
dd if=/dev/zero of=alpine.ext4 bs=1 count=0 seek=1G
sudo chmod og+wr "alpine.ext4"
yes 2>/dev/null | mkfs.ext4 "alpine.ext4" || true
sudo mount "alpine.ext4" $mnt
sudo tar -xf alpine.tar -C $mnt
sudo umount $mnt
mkdir -p rootfs
sudo tar -xf alpine.tar -C rootfs
sudo chown -R ${USER} rootfs
- name: test-0 (static)
run: |
sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr"
faketty ./build/vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt &
sleep 10 && pkill vmlinux
echo "========="
cat /tmp/log.txt
- name: kunit test
run: |
for config in `find ./ -name .kunitconfig | grep -v -E "kfence|sunrpc|handshake|kcsan|gpu|damon" `; do \
echo "==" $config "==" ; \
./tools/testing/kunit/kunit.py run --kunitconfig=$config ${{ matrix.kunit_opts }}
done
- name: build-1
run: |
make ARCH=um ${{ matrix.defconfig }}
make -j8 ARCH=um ${{ matrix.add_configs }}
- name: test-1
run: |
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 init=/sbin/init 2>&1 | tee /tmp/log.txt &
sleep 10 && pkill vmlinux
echo "========="
cat /tmp/log.txt
- name: benchmark-0
if: matrix.testname == 'um-nommu'
run: |
mkdir -p output
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty zpoline=1 init=/bench.sh \
| tee output/${{ matrix.testname }}-zpoline.dat || true # XXX: until 6.12 pulled
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty zpoline=0 init=/bench.sh \
| tee output/${{ matrix.testname }}-seccomp.dat || true # XXX: until 6.12 pulled
- name: benchmark-1
if: matrix.testname == 'um-mmu'
run: |
mkdir -p output
faketty ./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=0 console=tty init=/bench.sh \
| tee output/${{ matrix.testname }}.dat
- name: benchmark-2-iperf3
run: |
mkdir -p output
if [ "${{ matrix.testname }}" == "um-nommu" ] ; then
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
loglevel=0 console=tty init=/root/iperf3.sh \
| tee output/${{ matrix.testname }}-seccomp-iperf3.dat
## disable zpoline test for a while
# faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
# root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
# loglevel=0 console=tty zpoline=1 init=/root/iperf3.sh \
# | tee output/${{ matrix.testname }}-zpoline-iperf3.dat
else
faketty ./vmlinux vec0:transport=tap,ifname=tap100,depth=128,gro=1 mem=1024m \
root=/dev/root rootflags=`pwd`/rootfs rootfstype=hostfs rw \
loglevel=0 console=tty init=/root/iperf3.sh \
| tee output/${{ matrix.testname }}-iperf3.dat
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Log in to the ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .github/workflows
build-args: "MODE=${{ matrix.testname }}"
push: true
tags: |
ghcr.io/thehajime/alpine:3.20.3-${{ matrix.testname }}
- uses: actions/upload-artifact@v4
with:
name: bench-result-${{ matrix.testname }}
path: output/${{ matrix.testname }}*
checkpatch:
runs-on: ubuntu-22.04
name: checkpatch and co
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
steps:
- name: Set env
shell: bash
run: |
echo "/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc
- name: Checkout
with:
fetch-depth: 0
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-checkpatch-ccache-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-checkpatch-ccache-build-
- name: Install packages
run: |
sudo pip install ply GitPython mypy
sudo apt update -y
sudo apt install -y aspell ccache sparse
git clone https://github.com/daxtens/smart-sparse-diff
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
- name: checkout trees
run: |
#git remote add linus git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
#git fetch linus
#git format-patch -o p1 linus/master..HEAD~1
git remote add uml git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux.git
git fetch uml
git checkout uml/next
git checkout zpoline-nommu-v6.10
#- name: build (sparse)
# run: |
# make ARCH=um W=1 C=2 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__ -fmax-errors=unlimited -fmax-warnings=unlimited' defconfig O=build-sparse
# make ARCH=um W=1 C=2 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__ -fmax-errors=unlimited -fmax-warnings=unlimited' O=build-sparse clean
# make ARCH=um W=1 C=2 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__ -fmax-errors=unlimited -fmax-warnings=unlimited' O=build-sparse -j8 2> old-sparse.log 1> /dev/null
# git checkout zpoline-nommu-v6.10
# git checkout HEAD~1
# make ARCH=um W=1 C=2 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__ -fmax-errors=unlimited -fmax-warnings=unlimited' O=build-sparse -j8 2> new-sparse.log 1> /dev/null
# ./smart-sparse-diff/smart-sparse-diff.py old-sparse.log new-sparse.log
- name: check coding style
run: |
git format-patch -o p1 uml/next..HEAD~1
./scripts/checkpatch.pl --summary-file --ignore FILE_PATH_CHANGES \
--ignore AVOID_EXTERNS p1/*.patch
- name: check spells on commit message
continue-on-error: true
run: |
git log uml/next..HEAD |grep -v -E "^commit" > /tmp/a
aspell list /tmp/a
exit 1
bench-result:
runs-on: ubuntu-22.04
name: bench-result
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: output
pattern: bench-result-*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R output
- name: Install packages
run: |
sudo apt update -y
sudo apt install -y gnuplot lmbench iperf3
- name: benchmark-host
run: |
mkdir -p output
sudo ln -s /usr/include/x86_64-linux-gnu/sys /usr/include/sys
sudo mkdir -p /var/tmp/lmbench/
sudo chown ${USER} /var/tmp/lmbench/
sh .github/workflows/lmbench_run.sh |& tee output/native.dat
gcc -o do_getpid .github/workflows/do_getpid.c
./do_getpid -c 100 | tee -a output/native.dat
iperf3 -s &
iperf3 -c localhost -fm | tee output/native-iperf3.dat
iperf3 -c localhost -fm -R | tee -a output/native-iperf3.dat
- name: bench data parse/out
run: |
export TMP_OUTPUT=$(bash .github/workflows/um-nommu-plot.sh output)
echo "TMP_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$TMP_OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo ${{env.TMP_OUTPUT}}
- uses: actions/upload-artifact@v4
with:
name: bench-result-all
path: output/out/lmbench.*
- name: publish to imgur
uses: devicons/public-upload-to-imgur@v2.2.2
id: lmbench-imgur
with:
path: "output/out/lmbench.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: publish to imgur-iperf
uses: devicons/public-upload-to-imgur@v2.2.2
id: iperf3-imgur
with:
path: "output/out/iperf3.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: bench data parse/out
run: |
export SCRIPT_OUTPUT="${{ join(fromJSON(steps.lmbench-imgur.outputs.markdown_urls)) }} ${{ join(fromJSON(steps.iperf3-imgur.outputs.markdown_urls)) }}"
echo "SCRIPT_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$TMP_OUTPUT" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "$SCRIPT_OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo ${{env.SCRIPT_OUTPUT}}
- uses: actions/github-script@v7
env:
COMMENT_BODY: ${{env.SCRIPT_OUTPUT}}
with:
script: |
github.rest.issues.createComment({
issue_number: 1,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.COMMENT_BODY
})