guard/.github/workflows/ci.yml
loki5512344 1b3ae5e546
fix(ci): ship benches into the edge image and refresh actions
The edge Dockerfile copied Cargo.toml but not benches/, so cargo refused to
parse the manifest over the declared [[bench]] hot_paths target and the image
build died with exit 101 before compiling anything.

Also bump checkout/buildx/build-push to their node24 majors and pin
ubuntu-24.04 to clear the runner deprecation notices.
2026-11-16 14:24:20 +01:00

96 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
rust-check:
name: Rust — check & clippy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install -y libelf-dev libbpf-dev clang linux-libc-dev
- run: cargo fmt --all --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo check --all-features
- run: cargo check --no-default-features --all-targets
- name: XDP — build binaries
run: cargo build --features xdp --bins
- name: XDP — smoke-check BPF compilation (clang)
run: |
mkdir -p target/xdp
# clang with `-target bpf` does not search the glibc multiarch directory,
# so the asm/types.h pulled in by linux/types.h needs an explicit -I.
clang -O2 -g -target bpf -I"/usr/include/$(gcc -print-multiarch)" \
-c xdp/core/universal_filter.c -o target/xdp/universal_filter.o
test -f target/xdp/universal_filter.o
rust-test:
name: Rust — test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# libbpf-sys builds a vendored libbpf (needs libelf/zlib), and build.rs
# compiles the XDP program with clang (needs libbpf-dev/linux-libc-dev).
- run: sudo apt-get update && sudo apt-get install -y libelf-dev zlib1g-dev libbpf-dev clang linux-libc-dev
- run: cargo test --all-features
rust-test-no-default-features:
name: Rust — test (no default features, protocol-http)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install -y libelf-dev zlib1g-dev libbpf-dev clang linux-libc-dev
# Feature-gated code must actually run: without this job the
# `--no-default-features` combination is only type-checked, never tested.
- run: cargo test --no-default-features --features protocol-http
repo-gates:
name: Repo — module size & default secrets
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Module size gate
run: bash scripts/check_module_size.sh
- name: Default secrets gate
run: bash scripts/check_default_secrets.sh
rust-deny:
name: Rust — cargo-deny
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
docker:
name: Docker — build edge image
runs-on: ubuntu-24.04
needs: [rust-test]
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Build edge
uses: docker/build-push-action@v7
with:
context: .
file: deploy/docker/Dockerfile.edge
load: true
tags: rampart/edge:ci