| 1 | name: 'Build kernel and selftests/bpf, run selftests via vmtest' |
| 2 | |
| 3 | on: |
| 4 | workflow_call: |
| 5 | inputs: |
| 6 | runs_on: |
| 7 | required: true |
| 8 | default: 'ubuntu-24.04' |
| 9 | type: string |
| 10 | arch: |
| 11 | description: 'what arch to test' |
| 12 | required: true |
| 13 | default: 'x86_64' |
| 14 | type: string |
| 15 | pahole: |
| 16 | description: 'pahole rev or branch' |
| 17 | required: false |
| 18 | default: 'master' |
| 19 | type: string |
| 20 | llvm-version: |
| 21 | description: 'llvm version' |
| 22 | required: false |
| 23 | default: '18' |
| 24 | type: string |
| 25 | jobs: |
| 26 | vmtest: |
| 27 | name: pahole@${{ inputs.pahole }} |
| 28 | runs-on: ${{ inputs.runs_on }} |
| 29 | container: |
| 30 | image: ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64 |
| 31 | options: --privileged |
| 32 | steps: |
| 33 | |
| 34 | - uses: actions/checkout@v4 |
| 35 | |
| 36 | - name: Setup environment |
| 37 | uses: libbpf/ci/setup-build-env@v4 |
| 38 | with: |
| 39 | pahole: ${{ inputs.pahole }} |
| 40 | arch: ${{ inputs.arch }} |
| 41 | llvm-version: ${{ inputs.llvm-version }} |
| 42 | |
| 43 | - name: Get checkpoint commit |
| 44 | shell: bash |
| 45 | run: | |
| 46 | cat CHECKPOINT-COMMIT |
| 47 | echo "CHECKPOINT=$(cat CHECKPOINT-COMMIT)" >> $GITHUB_ENV |
| 48 | |
| 49 | - name: Get kernel source at checkpoint |
| 50 | uses: libbpf/ci/get-linux-source@v4 |
| 51 | with: |
| 52 | repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git' |
| 53 | rev: ${{ env.CHECKPOINT }} |
| 54 | dest: '${{ github.workspace }}/.kernel' |
| 55 | |
| 56 | - name: Patch kernel source |
| 57 | uses: libbpf/ci/patch-kernel@v4 |
| 58 | with: |
| 59 | patches-root: '${{ github.workspace }}/ci/diffs' |
| 60 | repo-root: '.kernel' |
| 61 | |
| 62 | - name: Configure kernel build |
| 63 | shell: bash |
| 64 | run: | |
| 65 | cd .kernel |
| 66 | cat tools/testing/selftests/bpf/config \ |
| 67 | tools/testing/selftests/bpf/config.${{ inputs.arch }} > .config |
| 68 | # this file might or might not exist depending on kernel version |
| 69 | cat tools/testing/selftests/bpf/config.vm >> .config || : |
| 70 | make olddefconfig && make prepare |
| 71 | cd - |
| 72 | |
| 73 | - name: Build kernel image |
| 74 | shell: bash |
| 75 | run: | |
| 76 | cd .kernel |
| 77 | make -j $((4*$(nproc))) all |
| 78 | cp vmlinux $GITHUB_WORKSPACE |
| 79 | cd - |
| 80 | |
| 81 | - name: Build selftests/bpf |
| 82 | uses: libbpf/ci/build-selftests@v4 |
| 83 | env: |
| 84 | MAX_MAKE_JOBS: 32 |
| 85 | VMLINUX_BTF: ${{ github.workspace }}/vmlinux |
| 86 | with: |
| 87 | arch: ${{ inputs.arch }} |
| 88 | kernel-root: ${{ github.workspace }}/.kernel |
| 89 | llvm-version: ${{ inputs.llvm-version }} |
| 90 | |
| 91 | - name: Run selftests |
| 92 | env: |
| 93 | ALLOWLIST_FILE: /tmp/allowlist |
| 94 | DENYLIST_FILE: /tmp/denylist |
| 95 | VMLINUX: ${{ github.workspace }}/vmlinux |
| 96 | LLVM_VERSION: ${{ inputs.llvm-version }} |
| 97 | SELFTESTS_BPF: ${{ github.workspace }}/.kernel/tools/testing/selftests/bpf |
| 98 | VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs |
| 99 | uses: libbpf/ci/run-vmtest@v4 |
| 100 | with: |
| 101 | arch: ${{ inputs.arch }} |
| 102 | kbuild-output: ${{ github.workspace }}/.kernel |
| 103 | kernel-root: ${{ github.workspace }}/.kernel |
| 104 |