Something went wrong. Try again.
forked from libbpf/vmlinux.h
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117name: 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@v7 - 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@v7 - 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@v7 - 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@v7 - 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@v7 - name: Checkout libbpf-rs uses: actions/checkout@v7 with: repository: libbpf/libbpf-rs path: libbpf-rs - name: Install development dependencies run: sudo apt-get update -y && 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 generate-headers: name: Generate vmlinux.h headers uses: ./.github/workflows/vmlinux.h.yml check-headers: name: Check headers are up to date runs-on: ubuntu-latest needs: generate-headers steps: - uses: actions/checkout@v7
- name: Download generated headers uses: actions/download-artifact@v8 with: name: vmlinux.h path: generated-headers
- name: Copy headers to include/ directory shell: bash run: | # Copy each vmlinux.h file to the corresponding include/ subdirectory for dir in generated-headers/*/; do arch=$(basename "$dir") cp "$dir"vmlinux.h "include/$arch/" done
- name: Check for differences run: git diff --exit-code || (echo "!!!! CHECKED IN vmlinux.h HEADER IS OUTDATED !!!!" && false) required-checks: needs: [ build, clippy, rustfmt, cargo-doc, test-libbpf-rs, check-headers, ] if: always() runs-on: ubuntu-latest steps: - run: echo '${{ toJSON(needs) }}' | jq -e 'to_entries | all(.value.result == "success")'