Some checks failed
Build & Package / build (push) Failing after 1s
The runner starts with an empty workspace — need to git clone rather than fetch into an existing repo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
119 lines
4.0 KiB
YAML
119 lines
4.0 KiB
YAML
name: Build & Package
|
|
|
|
# Build tcptop binary and produce .deb/.rpm packages
|
|
on:
|
|
push:
|
|
branches: ["*"]
|
|
tags: ["v*"]
|
|
|
|
jobs:
|
|
build:
|
|
# NOTE: Adjust the runner label to match your Gitea runner configuration.
|
|
# Common labels: "linux", "ubuntu-latest", "debian", or a custom label.
|
|
runs-on: linux
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# Ensure cargo binaries are on PATH for all steps
|
|
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ runner.home }}/.cargo/bin
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
run: |
|
|
# Clone the repo since this runner has no Node.js for actions/checkout.
|
|
# GITEA_SERVER_URL and GITEA_REPOSITORY are set by the Gitea runner.
|
|
git clone --depth=1 --branch="${GITHUB_REF_NAME}" \
|
|
"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
|
shell: bash
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
build-essential \
|
|
pkg-config \
|
|
linux-headers-$(uname -r) \
|
|
libelf-dev \
|
|
clang \
|
|
llvm \
|
|
rpm
|
|
# build-essential: gcc, make, etc. for native compilation
|
|
# pkg-config: locates system libraries during cargo build
|
|
# linux-headers: 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: Install Rust toolchain
|
|
run: |
|
|
# Install rustup if not already present (bare runners may not have it)
|
|
if ! command -v rustup &> /dev/null; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
|
|
source "$HOME/.cargo/env"
|
|
fi
|
|
# rust-toolchain.toml in the repo root will auto-select the pinned
|
|
# nightly (nightly-2026-03-20) with rust-src, rustfmt, clippy on
|
|
# the first cargo invocation. Just verify it works:
|
|
rustc --version
|
|
cargo --version
|
|
shell: bash
|
|
|
|
- name: Install bpf-linker
|
|
run: |
|
|
# bpf-linker is the LLVM-based linker for eBPF object files.
|
|
# Skip install if already cached.
|
|
if ! command -v bpf-linker &> /dev/null; then
|
|
cargo install bpf-linker
|
|
fi
|
|
bpf-linker --version || true
|
|
shell: bash
|
|
|
|
- name: Install packaging tools
|
|
run: |
|
|
# cargo-deb: builds Debian .deb packages from Cargo metadata
|
|
# cargo-generate-rpm: builds RPM packages from Cargo metadata
|
|
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: |
|
|
# build.rs in the tcptop crate auto-compiles the tcptop-ebpf
|
|
# program via aya-build before linking the userspace binary.
|
|
cargo build --release -p tcptop
|
|
shell: bash
|
|
|
|
- name: Build .deb package
|
|
run: |
|
|
# --no-build: binary already compiled in the previous step
|
|
cargo deb -p tcptop --no-build
|
|
shell: bash
|
|
|
|
- name: Build .rpm package
|
|
run: |
|
|
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
|
|
|
|
# TODO: Add artifact upload action when available on your Gitea instance.
|
|
# Example (if using a compatible action):
|
|
#
|
|
# - name: Upload packages
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: tcptop-packages
|
|
# path: |
|
|
# target/debian/tcptop_*.deb
|
|
# target/generate-rpm/tcptop-*.rpm
|