Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey V. Lobanov <[email protected]>
  • Loading branch information
svlobanov committed May 29, 2024
1 parent bf7b43e commit 8272fb2
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 80 deletions.
110 changes: 42 additions & 68 deletions .github/workflows/build-and-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ jobs:
- name: Set common vars
run: |
echo UNAME_R=`uname -r` >> $GITHUB_ENV
echo UNAME_M=`uname -m` >> $GITHUB_ENV;
echo UNAME_M=`uname -m` >> $GITHUB_ENV
echo NEEDRESTART_SUSPEND=1 >> $GITHUB_ENV
echo DEBIAN_FRONTEND=noninteractive >> $GITHUB_ENV
echo DEBCONF_NONINTERACTIVE_SEEN=true >> $GITHUB_ENV
- name: Install build tools
run: >
sudo apt update &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install
sudo apt update && sudo -E apt -y install
git build-essential cmake gcc linux-headers-`uname -r`
libpcre3-dev libssl-dev liblua5.1-0-dev kmod
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: mkdir build
Expand All @@ -61,7 +63,7 @@ jobs:
accel-ppp_`git describe --tags --long | sed 's/^v//' | sed 's/-/+/' | sed 's/-/~/'`-1+${{ matrix.pkg-distro }}_`uname -m`.deb
- name: Install debian package
working-directory: ./build
run: NEEDRESTART_SUSPEND=1 sudo -E apt -y install ./accel-ppp*.deb
run: sudo -E apt -y install ./accel-ppp*.deb
- name: Copy default config
run: sudo cp /etc/accel-ppp.conf.dist /etc/accel-ppp.conf
- name: Start accel-ppp
Expand All @@ -70,12 +72,6 @@ jobs:
run: sudo systemctl status accel-ppp
- name: Check accel-ppp stat
run: accel-cmd show stat
- name: Upload .deb package as artifact
uses: actions/upload-artifact@v4
with:
name: deb-package-${{ matrix.distro }}-${{ env.UNAME_M }}-${{ env.UNAME_R }}
path: build/accel-ppp_*.deb
if-no-files-found: error

# Debian based distros
Build-in-Container-Debian:
Expand All @@ -91,7 +87,7 @@ jobs:
"debian:trixie",
"ubuntu:20.04",
"ubuntu:22.04",
"ubuntu:24.04"
"ubuntu:24.04",
]
runs-on: ubuntu-24.04
container:
Expand All @@ -114,20 +110,25 @@ jobs:
echo DISTRO=$DISTRO >> $GITHUB_ENV;
echo CPACK_TYPE=$CPACK_TYPE >> $GITHUB_ENV;
echo UNAME_M=`uname -m` >> $GITHUB_ENV;
echo NEEDRESTART_SUSPEND=1 >> $GITHUB_ENV
echo DEBIAN_FRONTEND=noninteractive >> $GITHUB_ENV
echo DEBCONF_NONINTERACTIVE_SEEN=true >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Install build tools
run: >
apt update && apt -y upgrade && apt -y dist-upgrade &&
NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc
apt -y install git build-essential cmake gcc
linux-headers-${{ env.HEADERS_SUFFIX }}
libpcre3-dev libssl-dev liblua5.1-0-dev kmod
libpcre3-dev libssl-dev liblua5.1-0-dev kmod dkms debhelper devscripts
- name: Install additional build tools (using apt) (for some OS)
run: apt -y install dh-dkms || exit 0
- name: Get kernel name from headers
run: >
echo KERNEL_NAME=`ls -1 /usr/src/ | grep 'linux-headers.*${{ env.HEADERS_SUFFIX }}' |
sed 's/linux-headers-//'` >> $GITHUB_ENV;
cat $GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: mkdir build
Expand All @@ -137,22 +138,38 @@ jobs:
- name: cmake
working-directory: ./build
run: >
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
cmake -DBUILD_IPOE_DRIVER=FALSE -DBUILD_VLAN_MON_DRIVER=FALSE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-${{ env.KERNEL_NAME }}
-DMODULES_KDIR=${{ env.KERNEL_NAME }}
-DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE
-DCPACK_TYPE=${{ env.CPACK_TYPE }} ..
- name: make
working-directory: ./build
run: make
- name: Generate debian package
- name: Generate debian package (without drivers)
working-directory: ./build
run: cpack -G DEB
- name: Rename accel-ppp deb package
working-directory: ./build
run: >
mv -v accel-ppp.deb
accel-ppp_`git describe --tags --long | sed 's/^v//' | sed 's/-/+/' | sed 's/-/~/'`-1+${{ env.DISTRO }}_${{ env.UNAME_M }}.deb
- name: build dkms package for ipoe
working-directory: ./drivers/dkms/ipoe
run: |
cp -f ../../../build/version.h src/
debuild -us -uc -tc -b
- name: build dkms package for vlan_mon
working-directory: ./drivers/dkms/vlan_mon
run: |
cp -f ../../../build/version.h src/
debuild -us -uc -tc -b
- name: install ipoe and vlan_mon via dkms
working-directory: ./drivers/dkms
run: apt -y install ./*.deb
- name: install ipoe and vlan_mon via dkms
working-directory: ./drivers/dkms
run: apt -y install ./*.deb
- name: Install debian package
working-directory: ./build
run: apt -y install ./accel-ppp*.deb
Expand All @@ -162,60 +179,18 @@ jobs:
run: sleep 1
- name: Check accel-ppp stat
run: accel-cmd show stat
- name: Upload .deb package as artifact
- name: Upload accel-ppp .deb package as artifact
uses: actions/upload-artifact@v4
with:
name: deb-package-${{ env.DISTRO }}-${{ env.UNAME_M }}-${{ env.KERNEL_NAME }}
name: deb-accel-ppp-${{ env.DISTRO }}-${{ env.UNAME_M }}
path: build/accel-ppp_*.deb
if-no-files-found: error

Build-in-Container-Mainline:
if: ${{ false }} # disable for now
runs-on: ubuntu-latest
container:
image: ubuntu:devel
steps:
- name: Install build tools
run: >
apt update && apt -y upgrade && apt -y dist-upgrade &&
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc
linux-headers-generic libpcre3-dev libssl-dev liblua5.1-0-dev kmod software-properties-common
pkexec dbus linux-base &&
add-apt-repository -y ppa:cappelikan/ppa && apt update &&
service dbus start &&
apt -y install mainline &&
mainline --include-rc install-latest &&
apt -y purge linux-headers-generic && apt -y autoremove
- name: Get kernel name from headers
run: >
echo KERNEL_NAME=`ls -1 /usr/src/ | grep 'linux-headers.*generic' |
sed 's/linux-headers-//'` >> $GITHUB_ENV;
cat $GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v3
- name: Upload driver .deb packages as artifact
uses: actions/upload-artifact@v4
with:
fetch-depth: 0
- name: mkdir build
run: mkdir build
- name: Disable git security warnings
run: git config --global --add safe.directory '*'
- name: cmake
working-directory: ./build
run: >
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_SYSCONFDIR=/etc
-DKDIR=/usr/src/linux-headers-${{ env.KERNEL_NAME }}
-DMODULES_KDIR=${{ env.KERNEL_NAME }}
-DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE ..
- name: make and install
working-directory: ./build
run: make && make install
- name: Start accel-ppp with default config
run: accel-pppd -d -c /etc/accel-ppp.conf.dist
- name: Sleep for 1 sec
run: sleep 1
- name: Check accel-ppp stat
run: accel-cmd show stat
name: deb-accel-ppp-drivers-dkms-${{ env.DISTRO }}
path: drivers/dkms/accel-ppp*.deb
if-no-files-found: error

Build-in-Container-Alpine:
runs-on: ubuntu-24.04
Expand All @@ -226,7 +201,7 @@ jobs:
run: >
apk update && apk add --no-cache git cmake make g++ pcre-dev libressl-dev linux-headers libucontext-dev lua5.1-dev
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: mkdir build
Expand All @@ -250,4 +225,3 @@ jobs:
run: sleep 1
- name: Check accel-ppp stat
run: accel-cmd show stat

78 changes: 66 additions & 12 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ jobs:
with:
fetch-depth: 0
path: "accel-ppp"
- name: Set common vars
run: |
echo NEEDRESTART_SUSPEND=1 >> $GITHUB_ENV
echo DEBIAN_FRONTEND=noninteractive >> $GITHUB_ENV
echo DEBCONF_NONINTERACTIVE_SEEN=true >> $GITHUB_ENV
- 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
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 (fail is ok)
run: sudo kvm-ok || exit 0
- name: Prepare cloud-init image disk
Expand Down Expand Up @@ -124,8 +129,11 @@ jobs:
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
dkms debhelper devscripts
iproute2 ppp pppoe isc-dhcp-client timelimit &&
(sudo pip3 install pytest pytest-dependency || sudo pip3 install --break-system-packages pytest pytest-dependency)"
- name: Install additional build tools (using apt) (for some OS)
run: ssh -i ssh-key -p2222 user@localhost "sudo -E apt -y install dh-dkms || exit 0"
- name: Copy source code to target OS
run: |
tar -Jcf accel-ppp.tar.xz accel-ppp
Expand All @@ -135,11 +143,28 @@ jobs:
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
cmake -DBUILD_IPOE_DRIVER=FALSE -DBUILD_VLAN_MON_DRIVER=FALSE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-\`uname -r\`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE .. &&
make && sudo make install"
- name: build dkms package for ipoe
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/drivers/dkms/ipoe &&
cp -f ../../../build/version.h src/ &&
debuild -us -uc -tc -b"
- name: build dkms package for vlan_mon
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/drivers/dkms/vlan_mon &&
cp -f ../../../build/version.h src/ &&
debuild -us -uc -tc -b"
- name: install ipoe and vlan_mon via dkms
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp/drivers/dkms &&
sudo -E apt -y install ./*.deb"
- name: Run tests (not related to ipoe and vlan_mon drivers)
timeout-minutes: 5
run: >
Expand All @@ -154,7 +179,7 @@ jobs:
- name: Insert ipoe kernel module
run: >
ssh -i ssh-key -p2222 user@localhost "cd accel-ppp &&
sudo insmod build/drivers/ipoe/driver/ipoe.ko &&
sudo modprobe ipoe &&
lsmod | grep ipoe "
- name: Run tests (not related to vlan_mon drivers)
Expand All @@ -172,7 +197,7 @@ jobs:
- 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 &&
modprobe vlan_mon &&
lsmod | grep vlan_mon"
- name: Run tests (all)
Expand All @@ -197,13 +222,21 @@ jobs:

runs-on: ${{ matrix.distro }}
steps:
- name: Set common vars
run: |
echo NEEDRESTART_SUSPEND=1 >> $GITHUB_ENV
echo DEBIAN_FRONTEND=noninteractive >> $GITHUB_ENV
echo DEBCONF_NONINTERACTIVE_SEEN=true >> $GITHUB_ENV
- 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
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
iproute2 ppp pppoe isc-dhcp-client dkms debhelper devscripts
- name: Install additional build tools (using apt) (for some OS)
run: sudo -E apt -y install dh-dkms || exit 0

- name: Install testing tools (using pip)
run: >
Expand All @@ -217,22 +250,38 @@ jobs:
- name: mkdir build
run: mkdir build

- name: cmake
- name: cmake (without drivers)
working-directory: ./build
run: >
cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
cmake -DBUILD_IPOE_DRIVER=FALSE -DBUILD_VLAN_MON_DRIVER=FALSE -DCMAKE_INSTALL_PREFIX=/usr
-DKDIR=/usr/src/linux-headers-`uname -r`
-DLUA=TRUE -DSHAPER=TRUE -DRADIUS=TRUE ..
- name: make && make install
- name: make && make install (without drivers)
working-directory: ./build
run: make && sudo make install

- name: build dkms package for ipoe
working-directory: ./drivers/dkms/ipoe
run: |
cp -f ../../../build/version.h src/
debuild -us -uc -tc -b
- name: build dkms package for vlan_mon
working-directory: ./drivers/dkms/vlan_mon
run: |
cp -f ../../../build/version.h src/
debuild -us -uc -tc -b
- name: install ipoe and vlan_mon via dkms
working-directory: ./drivers/dkms
run: sudo -E apt -y install ./*.deb

- 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
sudo modprobe vlan_mon
sudo modprobe ipoe
lsmod | grep ipoe
lsmod | grep vlan_mon
Expand All @@ -250,10 +299,15 @@ jobs:

runs-on: ${{ matrix.distro }}
steps:
- name: Set common vars
run: |
echo NEEDRESTART_SUSPEND=1 >> $GITHUB_ENV
echo DEBIAN_FRONTEND=noninteractive >> $GITHUB_ENV
echo DEBCONF_NONINTERACTIVE_SEEN=true >> $GITHUB_ENV
- 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
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
Expand Down
8 changes: 8 additions & 0 deletions drivers/dkms/ipoe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Building Debian DKMS pacakge

Build accel-ppp without drivers, then from this level directory, execute:

```
cp ../../../build/version.h src/
debuild -us -uc -tc -b
```
5 changes: 5 additions & 0 deletions drivers/dkms/ipoe/debian/accel-ppp-ipoe-dkms.dkms
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PACKAGE_NAME="accel-ppp-ipoe"
PACKAGE_VERSION="#MODULE_VERSION"
AUTOINSTALL=yes
BUILT_MODULE_NAME="ipoe"
DEST_MODULE_LOCATION="/updates/dkms"
5 changes: 5 additions & 0 deletions drivers/dkms/ipoe/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accel-ppp-ipoe-dkms (1.13.0) unstable; urgency=low

* First ipoe dkms package

-- Sergey V. Lobanov <[email protected]> Wed, 29 May 2024 11:30:13 +0200
1 change: 1 addition & 0 deletions drivers/dkms/ipoe/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
Loading

0 comments on commit 8272fb2

Please sign in to comment.