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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
name: Run tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
Test-in-Qemu:
#if: ${{ false }} # disable for now
runs-on: ubuntu-24.04
name: Test in Qemu (${{ matrix.distro }})
strategy:
fail-fast: false
matrix:
include:
- distro: Ubuntu-24.04
image: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
untar: false
format: qcow2
- distro: Ubuntu-22.04
image: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
untar: false
format: qcow2
- distro: Ubuntu-20.04
image: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
untar: false
format: qcow2
- distro: Debian13
image: https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-amd64-daily.tar.xz
untar: true
format: raw
- distro: Debian12
image: https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.tar.xz
untar: true
format: raw
- distro: Debian11
image: https://cdimage.debian.org/images/cloud/bullseye/latest/debian-11-generic-amd64.tar.xz
untar: true
format: raw
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: "accel-ppp"
- name: Install qemu and required tools
run: >
sudo apt update &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install qemu-system-x86 qemu-utils cloud-image-utils cpu-checker cloud-image-utils wget openssh-client screen
- name: Check kvm support
run: sudo kvm-ok
- name: Prepare cloud-init image disk
run: |
ssh-keygen -t ed25519 -q -N "" -f ssh-key
echo "instance-id: $(uuidgen || echo i-abcdefg)" > init-meta
echo "#cloud-config" > init-data
echo "package_update: true" >> init-data
echo "package_upgrade: true" >> init-data
echo "package_reboot_if_required: false" >> init-data
echo "users:" >> init-data
echo " - default" >> init-data
echo " - name: user" >> init-data
echo " shell: /bin/bash" >> init-data
echo " sudo: ALL=(ALL) NOPASSWD:ALL" >> init-data
echo " ssh_authorized_keys:" >> init-data
echo " - "`cat ssh-key.pub` >> init-data
echo "power_state:">> init-data
echo " mode: poweroff">> init-data
cat init-data
cloud-localds init.img init-data init-meta
- name: Download, unpack and resize target OS cloud image
if: ${{ matrix.untar }}
run: |
wget -nv ${{ matrix.image }}
mkdir img
tar -xf *.tar.xz -C img
qemu-img resize -f ${{ matrix.format }} img/`ls -1 img` +2G
- name: Download and resize target OS cloud image
if: ${{ !matrix.untar }}
run: |
mkdir img
wget -nv ${{ matrix.image }} -O img/image
qemu-img resize -f ${{ matrix.format }} img/`ls -1 img` +2G
- name: Run target OS first time (for cloud-init actions)
run: sudo qemu-system-x86_64 -enable-kvm -cpu host -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img` -drive format=raw,file=init.img
- name: Run target OS
run: sudo screen -dmS qemu qemu-system-x86_64 -enable-kvm -cpu host -net nic -net user,hostfwd=tcp::2222-:22 -m 4096 -nographic -drive format=${{ matrix.format }},file=img/`ls -1 img`
- name: Check that target OS is running
run: |
sleep 1
sudo screen -ls
- name: Wait for ssh connection
timeout-minutes: 30
run: >
while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key user@localhost "exit 0";
do
echo "Trying to establish ssh connection";
sleep 5;
done;
cat ~/.ssh/known_hosts
- name: Display free space, current dir, kernel version and test sudo
run: |
ssh -i ssh-key -p2222 user@localhost "df -h"
ssh -i ssh-key -p2222 user@localhost "pwd"
ssh -i ssh-key -p2222 user@localhost "uname -a"
ssh -i ssh-key -p2222 user@localhost "sudo cat /etc/passwd"
- name: Install build tools (on target OS)
run: >
ssh -i ssh-key -p2222 user@localhost "sudo apt -y install
git build-essential cmake gcc linux-headers-\`uname -r\`
libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip
libxml2-dev libxslt1-dev zlib1g-dev
iproute2 ppp pppoe isc-dhcp-client timelimit &&
(sudo pip3 install pytest pytest-dependency pytest-order || sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order)"
- name: Copy source code to target OS
run: |
tar -Jcf accel-ppp.tar.xz accel-ppp
scp -i ssh-key -P2222 accel-ppp.tar.xz user@localhost:
ssh -i ssh-key -p2222 user@localhost "tar -xf accel-ppp.tar.xz"
- name: Build accel-ppp
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp &&
mkdir build && cd build &&
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-\`uname -r\`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. &&
make && sudo make install"
- name: Run tests (not related to ipoe and vlan_mon drivers)
timeout-minutes: 5
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests &&
sudo python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 user@localhost "ps aux | grep accel- &&
sudo dmesg"
- name: Insert ipoe kernel module
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp &&
sudo insmod build/drivers/ipoe/driver/ipoe.ko &&
lsmod | grep ipoe "
- name: Run tests (not related to vlan_mon drivers)
timeout-minutes: 5
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests &&
sudo python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 user@localhost "ps aux | grep accel- &&
sudo dmesg"
- name: Insert vlan_mon kernel module
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp &&
sudo insmod build/drivers/vlan_mon/driver/vlan_mon.ko &&
lsmod | grep vlan_mon"
- name: Run tests (all)
timeout-minutes: 5
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/tests &&
sudo python3 -m pytest -Wall --order-dependencies -v"
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 user@localhost "ps aux | grep accel- &&
sudo dmesg"
Test-in-Alpine:
#if: ${{ false }} # disable for now
runs-on: ubuntu-24.04
name: Test in Qemu (Alpine)
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: "accel-ppp"
- name: Install qemu and required tools
run: >
sudo apt update &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install qemu-system-x86 qemu-utils cloud-image-utils cpu-checker cloud-image-utils wget openssh-client screen
- name: Check kvm support
run: sudo kvm-ok
- name: Prepare cloud-init image disk
run: |
ssh-keygen -t ed25519 -q -N "" -f ssh-key
echo "instance-id: $(uuidgen || echo i-abcdefg)" > init-meta
echo "#cloud-config" > init-data
echo "package_update: true" >> init-data
echo "package_upgrade: true" >> init-data
echo "package_reboot_if_required: false" >> init-data
echo "users:" >> init-data
echo " - default" >> init-data
echo " - name: alpine" >> init-data
echo " shell: /bin/bash" >> init-data
echo " ssh_authorized_keys:" >> init-data
echo " - "`cat ssh-key.pub` >> init-data
echo "power_state:">> init-data
echo " mode: poweroff">> init-data
cat init-data
cloud-localds init.img init-data init-meta
- name: Download and resize target OS cloud image
run: |
mkdir img
# we need to use metal image because virt image doesn't provide pppoe driver (https://gitlab.alpinelinux.org/alpine/aports/-/issues/13739)
wget -nv https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/cloud/nocloud_alpine-3.20.2-x86_64-bios-cloudinit-metal-r0.qcow2 -O img/image
qemu-img resize -f qcow2 img/`ls -1 img` +2G
- name: Run target OS first time (for cloud-init actions)
run: sudo qemu-system-x86_64 -enable-kvm -cpu host -m 4096 -nographic -drive format=qcow2,file=img/`ls -1 img` -drive format=raw,file=init.img
- name: Run target OS
run: sudo screen -dmS qemu qemu-system-x86_64 -enable-kvm -cpu host -net nic -net user,hostfwd=tcp::2222-:22 -m 4096 -nographic -drive format=qcow2,file=img/`ls -1 img`
- name: Check that target OS is running
run: |
sleep 1
sudo screen -ls
- name: Wait for ssh connection
timeout-minutes: 30
run: >
while ! ssh -o StrictHostKeyChecking=accept-new -p2222 -o ConnectTimeout=5 -i ssh-key alpine@localhost "exit 0";
do
echo "Trying to establish ssh connection";
sleep 5;
done;
cat ~/.ssh/known_hosts
- name: Display free space, current dir, kernel version and test doas
run: |
ssh -i ssh-key -p2222 alpine@localhost "df -h"
ssh -i ssh-key -p2222 alpine@localhost "pwd"
ssh -i ssh-key -p2222 alpine@localhost "uname -a"
ssh -i ssh-key -p2222 alpine@localhost "doas cat /etc/passwd"
- name: Install build tools (on target OS)
run: >
ssh -i ssh-key -p2222 alpine@localhost "doas apk add --no-cache git cmake make g++ pcre-dev libressl-dev linux-headers libucontext-dev lua5.1-dev linux-lts-dev py3-pip
ppp ppp-pppoe &&
(doas pip3 install pytest pytest-dependency pytest-order || doas pip3 install --break-system-packages pytest pytest-dependency pytest-order)"
- name: Copy source code to target OS
run: |
tar -Jcf accel-ppp.tar.xz accel-ppp
scp -i ssh-key -P2222 accel-ppp.tar.xz alpine@localhost:
ssh -i ssh-key -p2222 alpine@localhost "tar -xf accel-ppp.tar.xz"
- name: Build accel-ppp
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp &&
mkdir build && cd build &&
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-\`uname -r\`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. &&
make && doas make install"
- name: Run tests (not related to ipoe and vlan_mon drivers)
timeout-minutes: 5
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests &&
doas python3 -m pytest -Wall --order-dependencies -v -m \"not ipoe_driver and not vlan_mon_driver\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- &&
doas dmesg"
- name: Insert ipoe kernel module
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp &&
doas insmod build/drivers/ipoe/driver/ipoe.ko &&
lsmod | grep ipoe "
- name: Run tests (not related to vlan_mon drivers)
timeout-minutes: 5
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests &&
doas python3 -m pytest -Wall --order-dependencies -v -m \"not vlan_mon_driver\""
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- &&
doas dmesg"
- name: Insert vlan_mon kernel module
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp &&
doas insmod build/drivers/vlan_mon/driver/vlan_mon.ko &&
lsmod | grep vlan_mon"
- name: Run tests (all)
timeout-minutes: 5
run: >
ssh -i ssh-key -p2222 alpine@localhost "cd accel-ppp/tests &&
doas python3 -m pytest -Wall --order-dependencies -v"
- name: Display processes and dmesg after tests
if: ${{ always() }}
run: >
ssh -i ssh-key -p2222 alpine@localhost "ps aux | grep accel- &&
doas dmesg"
Test-in-GH:
#if: ${{ false }} # disable for now
strategy:
fail-fast: false
matrix:
distro: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"]
runs-on: ${{ matrix.distro }}
steps:
- name: Install build tools (using apt)
run: >
sudo apt update &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install
git build-essential cmake gcc linux-headers-`uname -r`
libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip
iproute2 ppp pppoe isc-dhcp-client
- name: Install testing tools (using pip)
run: >
sudo pip3 install pytest pytest-dependency pytest-order || sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: mkdir build
run: mkdir build
- name: cmake
working-directory: ./build
run: >
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-`uname -r`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE ..
- name: make && make install
working-directory: ./build
run: make && sudo make install
- name: Insert and check kernel modules (ipoe and vlan-mon)
# if: ${{ false }}
run: |
sudo insmod build/drivers/vlan_mon/driver/vlan_mon.ko
sudo insmod build/drivers/ipoe/driver/ipoe.ko
lsmod | grep ipoe
lsmod | grep vlan_mon
- name: Run tests
timeout-minutes: 5
working-directory: ./tests
run: sudo python3 -m pytest -Wall --order-dependencies -v
Test-in-GH-Coverage:
#if: ${{ false }} # disable for now
strategy:
fail-fast: false
matrix:
distro: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"]
runs-on: ${{ matrix.distro }}
steps:
- name: Install build tools (using apt)
run: >
sudo apt update &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install
git build-essential cmake gcc linux-headers-`uname -r`
libpcre3-dev libssl-dev liblua5.1-0-dev kmod python3-pip
iproute2 ppp pppoe isc-dhcp-client
- name: Install testing tools (using pip)
run: >
sudo pip3 install pytest pytest-dependency pytest-order gcovr || sudo pip3 install --break-system-packages pytest pytest-dependency pytest-order gcovr
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: mkdir build
run: mkdir build
- name: cmake (with coverage)
working-directory: ./build
run: >
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-`uname -r`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE
-DCMAKE_C_FLAGS="--coverage -O0" ..
- name: make && make install
working-directory: ./build
run: make && sudo make install
- name: Insert and check kernel modules (ipoe and vlan-mon)
# if: ${{ false }}
run: |
sudo insmod build/drivers/vlan_mon/driver/vlan_mon.ko
sudo insmod build/drivers/ipoe/driver/ipoe.ko
lsmod | grep ipoe
lsmod | grep vlan_mon
- name: Run tests (for coverage report) (fail is ok)
timeout-minutes: 5
working-directory: ./tests
run: sudo python3 -m pytest -Wall --order-dependencies -v || exit 0
- name: Generate coverage reports (default(txt), csv, html)
run: |
mkdir -p tests/report
gcovr --config=tests/gcovr.conf --output=tests/report/accel-ppp.txt
gcovr --config=tests/gcovr.conf --csv --output=tests/report/accel-ppp.csv
gcovr --config=tests/gcovr.conf --html --html-details --output=tests/report/accel-ppp.html
- name: Show default coverage report
run: cat tests/report/accel-ppp.txt
- name: Upload coverage report
# if: ${{ false }}
uses: actions/upload-artifact@v4
with:
name: coverage-report-on-${{ matrix.distro }}
path: tests/report/
if-no-files-found: error
|