compile libbpf #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build package | ||
on: [push, workflow_dispatch] | ||
jobs: | ||
build_dkms: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install dpkg-dev debhelper dkms | ||
- name: prepare sources | ||
run: | | ||
rm -rf debian | ||
cp -r debian.dkms debian | ||
- name: make dkms source package | ||
run: | | ||
fakeroot debian/rules binary | ||
mv ../rex-dkms*_all.deb . | ||
- name: upload package artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dkms_package | ||
path: rex-dkms*_all.deb | ||
if-no-files-found: error | ||
# The package contains only sources. Let's check that it's buildable, | ||
# and no surprising errors apeear in the build log. | ||
- name: build module with dkms | ||
run: | | ||
sudo apt-get install -y ./rex-dkms*_all.deb \ | ||
|| ( find /var/lib/dkms -name make.log -exec cat '{}' \; && false ) | ||
# libbpf 1.3+ is requred for functional tests | ||
build_libbpf: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install dpkg-dev debhelper | ||
- name: build package | ||
run: | | ||
git clone https://github.com/sudipm-mukherjee/libbpf | ||
cd libbpf | ||
dpkg-buildpackage -uc -us | ||
mv ../*.deb . | ||
- name: upload package artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libbpf | ||
path: *.deb | ||
if-no-files-found: error | ||
build_library: | ||
runs-on: ubuntu-22.04 | ||
needs: build_libbpf | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: prepare sources | ||
run: | | ||
rm -rf debian | ||
cp -r debian.lib debian | ||
- name: install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libpcap-dev cmake dpkg-dev debhelper libboost-dev po-debconf ragel | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: libbpf | ||
path: libbpf | ||
- name: install libbpf | ||
run: | | ||
cd libbpf | ||
sudo dpkg -i ./libbpf-dev* ./libbpf1_* | ||
- run: | | ||
echo "nproc=$(nproc)" >> $GITHUB_ENV | ||
- name: build package | ||
run: | | ||
dpkg-buildpackage -j${{env.nproc}} -b --no-sign | ||
mv ../libhyperscan*.deb ../libhyperscan*.ddeb . | ||
- name: upload package artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "package_${{ inputs.target }}" | ||
path: libhyperscan*deb | ||
if-no-files-found: error | ||
- name: upload func test artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "func_test_${{ inputs.target }}" | ||
path: obj-x86_64-linux-gnu/bin/unit-xdpscan | ||
if-no-files-found: error |