Add a GitHub Actions workflow that exercises the daemon-only build and the structural eBPF check, so the maintained-fork build path stays green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
107 lines
3.7 KiB
YAML
107 lines
3.7 KiB
YAML
name: Daemon and eBPF build contracts
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'Makefile'
|
|
- 'proto/**'
|
|
- 'daemon/**'
|
|
- 'ebpf_prog/**'
|
|
- 'utils/packaging/test_install.sh'
|
|
- 'utils/packaging/arch/**'
|
|
- '.github/workflows/check_daemon_build.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'Makefile'
|
|
- 'proto/**'
|
|
- 'daemon/**'
|
|
- 'ebpf_prog/**'
|
|
- 'utils/packaging/test_install.sh'
|
|
- 'utils/packaging/arch/**'
|
|
- '.github/workflows/check_daemon_build.yml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
install-contracts:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
persist-credentials: false
|
|
- name: Check unprivileged staging and readonly build contracts
|
|
run: sh utils/packaging/test_install.sh
|
|
|
|
current-arch-bpf:
|
|
runs-on: ubuntu-24.04
|
|
container:
|
|
image: archlinux:base-devel
|
|
options: --cpus 1 --memory 2g --memory-swap 2g --pids-limit 128 --ulimit core=0:0
|
|
timeout-minutes: 30
|
|
env:
|
|
GOMAXPROCS: '1'
|
|
GOMEMLIMIT: 512MiB
|
|
GOFLAGS: -p=1
|
|
steps:
|
|
- name: Install signed distribution build dependencies
|
|
run: pacman -Syu --noconfirm --needed git clang llvm linux-headers go protobuf fakeroot libnetfilter_queue libnfnetlink libmnl iptables nftables systemd
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
persist-credentials: false
|
|
- name: Record exact candidate and toolchain versions
|
|
run: |
|
|
git rev-parse HEAD
|
|
pacman -Q clang llvm linux-headers
|
|
clang --version
|
|
llc --version
|
|
opt --version
|
|
- name: Compile and check all three objects against packaged headers
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
ulimit -c 0
|
|
kernel_dir="$(find /usr/lib/modules -mindepth 2 -maxdepth 2 -name build -print)"
|
|
test -n "$kernel_dir"
|
|
test "$(printf '%s\n' "$kernel_dir" | wc -l)" -eq 1
|
|
kernel_ver="$(basename "$(dirname "$kernel_dir")")"
|
|
make -C ebpf_prog -j1 check \
|
|
KERNEL_VER="$kernel_ver" \
|
|
KERNEL_DIR="$kernel_dir" \
|
|
KERNEL_HEADERS="$kernel_dir"
|
|
llvm-strip -g ebpf_prog/opensnitch.o ebpf_prog/opensnitch-dns.o ebpf_prog/opensnitch-procs.o
|
|
make -C ebpf_prog -j1 check \
|
|
KERNEL_VER="$kernel_ver" \
|
|
KERNEL_DIR="$kernel_dir" \
|
|
KERNEL_HEADERS="$kernel_dir"
|
|
- name: Build checksum-pinned daemon-only package without root privileges
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
GOBIN=/usr/local/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.1
|
|
GOBIN=/usr/local/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
|
|
useradd -m builder
|
|
chown -R builder:builder "$GITHUB_WORKSPACE"
|
|
runuser -u builder -- bash -euo pipefail <<'BUILDER'
|
|
cd "$GITHUB_WORKSPACE"
|
|
sh utils/packaging/arch/prepare.sh /tmp/opensnitch-native-package
|
|
cd /tmp/opensnitch-native-package
|
|
makepkg --nosign --noconfirm
|
|
BUILDER
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: candidate-arch-native-package
|
|
path: |
|
|
/tmp/opensnitch-native-package/*.pkg.tar.zst
|
|
/tmp/opensnitch-native-package/opensnitch-native-*.tar.gz
|
|
/tmp/opensnitch-native-package/PKGBUILD
|
|
if-no-files-found: error
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: candidate-arch-bpf-objects
|
|
path: ebpf_prog/opensnitch*.o
|
|
if-no-files-found: error
|