Add CI job testing against libbpf-rs #1
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: Test | |
on: | |
push: | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: '-D warnings' | |
jobs: | |
build: | |
name: Build & test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build & test | |
run: | | |
cargo build --lib | |
cargo test | |
clippy: | |
name: Lint with clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo clippy --no-deps --all-targets -- -A unknown_lints -D clippy::todo | |
rustfmt: | |
name: Check code formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo +nightly fmt --all -- --check | |
cargo-doc: | |
name: Generate documentation | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: '-D warnings' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo doc --no-deps | |
test-libbpf-rs: | |
# check that libbpf-rs, one of the main consumers of the library, works with | |
# this version | |
name: Test libbpf-rs integration | |
runs-on: ubuntu-latest | |
# This test is just informative; certain failures *may* be expected. | |
continue-on-error: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Checkout libbpf-rs | |
uses: actions/checkout@v4 | |
with: | |
repository: libbpf/libbpf-rs | |
path: libbpf-rs | |
- name: Install development dependencies | |
run: sudo apt-get install -y gcc-multilib libelf-dev zlib1g-dev | |
- name: Build libbpf-rs | |
run: | | |
dir=$(pwd) | |
cd libbpf-rs | |
# Patch the vmlinux.h version in use. | |
cat >> Cargo.toml <<EOF | |
[patch."https://github.com/libbpf/vmlinux.h.git"] | |
vmlinux = { path = "${dir}" } | |
EOF | |
cargo update | |
cargo check --tests |