All checks were successful
Build & Package / build (push) Successful in 8m41s
bpf-linker uses aya-rustc-llvm-proxy which dlopen()s libLLVM from the Rust toolchain. On Alpine/musl, LLVM is statically linked into rustc so no shared lib exists, causing bpf-linker to crash. Switch to container: debian:bookworm for a glibc environment where the Rust toolchain's LLVM shared lib works correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
108 lines
3.3 KiB
YAML
108 lines
3.3 KiB
YAML
name: Build & Package
|
|
|
|
# Build tcptop binary and produce .deb/.rpm packages
|
|
on:
|
|
push:
|
|
branches: ["*"]
|
|
tags: ["v*"]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: linux
|
|
# Run in a Debian container so bpf-linker can load the LLVM shared lib
|
|
# from the Rust toolchain (Alpine/musl statically links LLVM, breaking
|
|
# aya-rustc-llvm-proxy's dlopen).
|
|
container:
|
|
image: debian:bookworm
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y \
|
|
build-essential \
|
|
pkg-config \
|
|
linux-headers-amd64 \
|
|
libelf-dev \
|
|
clang \
|
|
llvm \
|
|
rpm \
|
|
curl \
|
|
git
|
|
# build-essential: gcc, make, etc. for native compilation
|
|
# pkg-config: locates system libraries during cargo build
|
|
# linux-headers-amd64: kernel headers for eBPF program compilation
|
|
# libelf-dev: ELF parsing library required by eBPF toolchain
|
|
# clang + llvm: LLVM backend used by bpf-linker to compile eBPF bytecode
|
|
# rpm: needed by cargo-generate-rpm to build .rpm packages
|
|
shell: bash
|
|
|
|
- name: Checkout code
|
|
run: |
|
|
git clone --depth=1 --branch="${GITHUB_REF_NAME}" \
|
|
"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
|
shell: bash
|
|
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
|
|
. "$HOME/.cargo/env"
|
|
# Install the pinned nightly from rust-toolchain.toml
|
|
rustup toolchain install nightly-2026-03-20 --component rust-src,rustfmt,clippy
|
|
# aya-build invokes `cargo +nightly` to compile eBPF programs
|
|
rustup toolchain install nightly --component rust-src
|
|
rustc --version
|
|
cargo --version
|
|
shell: bash
|
|
|
|
- name: Install bpf-linker
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
if ! command -v bpf-linker &> /dev/null; then
|
|
cargo install bpf-linker
|
|
fi
|
|
bpf-linker --version || true
|
|
shell: bash
|
|
|
|
- name: Install packaging tools
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
if ! command -v cargo-deb &> /dev/null; then
|
|
cargo install cargo-deb
|
|
fi
|
|
if ! command -v cargo-generate-rpm &> /dev/null; then
|
|
cargo install cargo-generate-rpm
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Build release binary
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
# build.rs auto-compiles the eBPF program via aya-build
|
|
cargo build --release -p tcptop
|
|
shell: bash
|
|
|
|
- name: Build .deb package
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
# --no-build: binary already compiled in the previous step
|
|
cargo deb -p tcptop --no-build
|
|
shell: bash
|
|
|
|
- name: Build .rpm package
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
cargo generate-rpm -p tcptop
|
|
shell: bash
|
|
|
|
- name: List built packages
|
|
run: |
|
|
echo "=== Built packages ==="
|
|
ls -lh target/debian/tcptop_*.deb
|
|
ls -lh target/generate-rpm/tcptop-*.rpm
|
|
shell: bash
|