diff options
author | Sergey V. Lobanov <sergey@lobanov.in> | 2022-09-01 03:54:15 +0300 |
---|---|---|
committer | Sergey V. Lobanov <sergey@lobanov.in> | 2022-09-01 04:07:13 +0300 |
commit | 785798c6f19863e49a5f061c42ad3331c76055d6 (patch) | |
tree | 34377047de0a3515ae175bce1e822765184951c5 /.github | |
parent | 8d6dec931641b57541f7346f4f8824e2044b4941 (diff) | |
download | accel-ppp-785798c6f19863e49a5f061c42ad3331c76055d6.tar.gz accel-ppp-785798c6f19863e49a5f061c42ad3331c76055d6.zip |
ci: add build jobs (Github CI)
Added build on:
1. Ubuntu 20.04, 22.04 (github runners)
2. Ubuntu 18.04, 20.04, 22.04 (in official containers from dockerhub)
3. Debian 10, 11, 12 (in official containers from dockerub)
Build jobs do:
1. Build (cmake, make)
2. Packaging (cpack)
3. Install
4. Run
5. Check using 'show stat' command
6. Upload built .deb package as artifact
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build-and-run.yml | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/.github/workflows/build-and-run.yml b/.github/workflows/build-and-run.yml new file mode 100644 index 0000000..3794f31 --- /dev/null +++ b/.github/workflows/build-and-run.yml @@ -0,0 +1,167 @@ +name: Build and Run + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + +jobs: + Build-in-VM: + #if: ${{ false }} # disable for now + strategy: + fail-fast: false + matrix: + distro: ["ubuntu-22.04", "ubuntu-20.04"] + runs-on: ${{ matrix.distro }} + steps: + - name: Set vars for Ubuntu 20.04 + if: ${{ matrix.distro == 'ubuntu-20.04' }} + run: | + echo "DISTRO=ubuntu20.04" >> $GITHUB_ENV + echo "CPACK_TYPE=Ubuntu20" >> $GITHUB_ENV + - name: Set vars for Ubuntu 22.04 + if: ${{ matrix.distro == 'ubuntu-22.04' }} + run: | + echo "DISTRO=ubuntu22.04" >> $GITHUB_ENV + echo "CPACK_TYPE=Ubuntu20" >> $GITHUB_ENV + - name: Set common vars + run: | + echo UNAME_R=`uname -r` >> $GITHUB_ENV + echo UNAME_M=`uname -m` >> $GITHUB_ENV; + - name: Install build tools + run: > + sudo apt update && + sudo 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 + 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=FALSE -DRADIUS=TRUE + -DCPACK_TYPE=${{ env.CPACK_TYPE }} .. + - name: make + working-directory: ./build + run: make + - name: Generate debian package + 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 }}_`uname -m`.deb + - name: Install debian package + working-directory: ./build + run: sudo 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 + run: sudo systemctl start accel-ppp + - name: Check accel-ppp running status + 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@v3 + with: + name: deb-package-${{ matrix.distro }}-${{ env.UNAME_M }}-${{ env.UNAME_R }} + path: build/accel-ppp_*.deb + if-no-files-found: error + + Build-in-Container: + #if: ${{ false }} # disable for now + strategy: + fail-fast: false + matrix: + distro: + [ + "debian:10", + "debian:11", + "debian:bookworm", + "ubuntu:18.04", + "ubuntu:20.04", + "ubuntu:22.04", + ] + runs-on: ubuntu-latest + container: + image: ${{ matrix.distro }} + steps: + - name: Set distro-specific vars + run: > + HEADERS_SUFFIX=`uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`; + DISTRO=`echo ${{ matrix.distro }} | sed 's/://'`; + case "${{ matrix.distro }}" in + debian:bookworm) DISTRO=debian12; CPACK_TYPE=Debian12 ;; + debian:11) CPACK_TYPE=Debian11 ;; + debian:10) CPACK_TYPE=Debian10 ;; + ubuntu:22.04) CPACK_TYPE=Ubuntu22 ; HEADERS_SUFFIX=generic ;; + ubuntu:20.04) CPACK_TYPE=Ubuntu20 ; HEADERS_SUFFIX=generic ;; + ubuntu:18.04) CPACK_TYPE=Ubuntu18 ; HEADERS_SUFFIX=generic ;; + esac; + echo HEADERS_SUFFIX=$HEADERS_SUFFIX >> $GITHUB_ENV; + echo DISTRO=$DISTRO >> $GITHUB_ENV; + echo CPACK_TYPE=$CPACK_TYPE >> $GITHUB_ENV; + echo UNAME_M=`uname -m` >> $GITHUB_ENV; + cat $GITHUB_ENV + - 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-${{ env.HEADERS_SUFFIX }} + libpcre3-dev libssl-dev liblua5.1-0-dev kmod + - 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 + 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 + -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 + 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: Install debian package + working-directory: ./build + run: apt -y install ./accel-ppp*.deb + - 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: Upload .deb package as artifact + uses: actions/upload-artifact@v3 + with: + name: deb-package-${{ env.DISTRO }}-${{ env.UNAME_M }}-${{ env.KERNEL_NAME }} + path: build/accel-ppp_*.deb + if-no-files-found: error |