libbpf-sys 1.7.0+v1.7.0

Rust bindings to libbpf from the Linux kernel
Documentation
name: 'Build kernel and selftests/bpf, run selftests via vmtest'

on:
  workflow_call:
    inputs:
      runs_on:
        required: true
        default: 'ubuntu-24.04'
        type: string
      arch:
        description: 'what arch to test'
        required: true
        default: 'x86_64'
        type: string
      pahole:
        description: 'pahole rev or branch'
        required: false
        default: 'master'
        type: string
      llvm-version:
        description: 'llvm version'
        required: false
        default: '18'
        type: string
jobs:
  vmtest:
    name: pahole@${{ inputs.pahole }}
    runs-on: ${{ inputs.runs_on }}
    container:
      image: ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64
      options: --privileged
    steps:

      - uses: actions/checkout@v4

      - name: Setup environment
        uses: libbpf/ci/setup-build-env@v4
        with:
          pahole: ${{ inputs.pahole }}
          arch: ${{ inputs.arch }}
          llvm-version: ${{ inputs.llvm-version }}

      - name: Get checkpoint commit
        shell: bash
        run: |
          cat CHECKPOINT-COMMIT
          echo "CHECKPOINT=$(cat CHECKPOINT-COMMIT)" >> $GITHUB_ENV

      - name: Get kernel source at checkpoint
        uses: libbpf/ci/get-linux-source@v4
        with:
          repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git'
          rev: ${{ env.CHECKPOINT }}
          dest: '${{ github.workspace }}/.kernel'

      - name: Patch kernel source
        uses: libbpf/ci/patch-kernel@v4
        with:
          patches-root: '${{ github.workspace }}/ci/diffs'
          repo-root: '.kernel'

      - name: Configure kernel build
        shell: bash
        run: |
          cd .kernel
          cat tools/testing/selftests/bpf/config \
              tools/testing/selftests/bpf/config.${{ inputs.arch }} > .config
          # this file might or might not exist depending on kernel version
          cat tools/testing/selftests/bpf/config.vm >> .config || :
          make olddefconfig && make prepare
          cd -

      - name: Build kernel image
        shell: bash
        run: |
          cd .kernel
          make -j $((4*$(nproc))) all
          cp vmlinux $GITHUB_WORKSPACE
          cd -

      - name: Build selftests/bpf
        uses: libbpf/ci/build-selftests@v4
        env:
          MAX_MAKE_JOBS: 32
          VMLINUX_BTF: ${{ github.workspace }}/vmlinux
        with:
          arch: ${{ inputs.arch }}
          kernel-root: ${{ github.workspace }}/.kernel
          llvm-version: ${{ inputs.llvm-version }}

      - name: Run selftests
        env:
          ALLOWLIST_FILE: /tmp/allowlist
          DENYLIST_FILE: /tmp/denylist
          VMLINUX: ${{ github.workspace }}/vmlinux
          LLVM_VERSION: ${{ inputs.llvm-version }}
          SELFTESTS_BPF: ${{ github.workspace }}/.kernel/tools/testing/selftests/bpf
          VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
        uses: libbpf/ci/run-vmtest@v4
        with:
          arch: ${{ inputs.arch }}
          kbuild-output: ${{ github.workspace }}/.kernel
          kernel-root: ${{ github.workspace }}/.kernel