diff --git a/.github/workflows/gcc-bpf.yml b/.github/workflows/gcc-bpf.yml new file mode 100644 index 0000000..9ce4c4f --- /dev/null +++ b/.github/workflows/gcc-bpf.yml @@ -0,0 +1,83 @@ +name: Testing GCC BPF compiler + +on: + workflow_call: + inputs: + runs_on: + required: true + type: string + arch: + required: true + type: string + llvm-version: + required: true + type: string + toolchain: + required: true + type: string + toolchain_full: + required: true + type: string + download_sources: + required: true + type: boolean + +jobs: + test: + runs-on: ${{ fromJSON(inputs.runs_on) }} + timeout-minutes: 100 + env: + ARCH: ${{ inputs.arch }} + BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/gcc-bpf + BPF_NEXT_BASE_BRANCH: 'master' + REPO_ROOT: ${{ github.workspace }}/src + KBUILD_OUTPUT: ${{ github.workspace }}/src/kbuild-output + + steps: + + - uses: actions/checkout@v4 + + - if: ${{ inputs.download_sources }} + name: Download bpf-next tree + uses: libbpf/ci/get-linux-source@v3 + with: + dest: ${{ env.REPO_ROOT }} + rev: ${{ env.BPF_NEXT_BASE_BRANCH }} + + - uses: libbpf/ci/patch-kernel@v3 + with: + patches-root: '${{ github.workspace }}/ci/diffs' + repo-root: ${{ env.REPO_ROOT }} + + - uses: actions/download-artifact@v4 + with: + name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }} + path: ${{ env.REPO_ROOT }} + + - name: Untar artifacts + working-directory: ${{ env.REPO_ROOT }} + run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf - + + - name: Setup build environment + uses: libbpf/ci/setup-build-env@v3 + with: + arch: ${{ inputs.arch }} + llvm-version: ${{ inputs.llvm-version }} + + - name: Build GCC BPF compiler + uses: libbpf/ci/build-bpf-gcc@v3 + with: + install-dir: ${{ env.BPF_GCC_INSTALL_DIR }} + + - name: Build selftests/bpf/test_progs-bpf_gcc + uses: libbpf/ci/build-selftests@main + env: + MAX_MAKE_JOBS: 32 + BPF_GCC: ${{ env.BPF_GCC_INSTALL_DIR }} + SELFTESTS_BPF_TARGETS: 'test_progs-bpf_gcc' + with: + arch: ${{ inputs.arch }} + kernel-root: ${{ env.REPO_ROOT }} + llvm-version: ${{ inputs.llvm-version }} + toolchain: ${{ inputs.toolchain }} + diff --git a/.github/workflows/kernel-build-test.yml b/.github/workflows/kernel-build-test.yml index cfe4e46..ac2af9f 100644 --- a/.github/workflows/kernel-build-test.yml +++ b/.github/workflows/kernel-build-test.yml @@ -58,6 +58,7 @@ on: required: true jobs: + # Build kernel and selftest build: uses: ./.github/workflows/kernel-build.yml @@ -69,6 +70,7 @@ jobs: llvm-version: ${{ inputs.llvm-version }} kernel: ${{ inputs.kernel }} download_sources: ${{ inputs.download_sources }} + build-release: if: ${{ inputs.build_release }} uses: ./.github/workflows/kernel-build.yml @@ -81,6 +83,7 @@ jobs: kernel: ${{ inputs.kernel }} download_sources: ${{ inputs.download_sources }} release: true + test: if: ${{ inputs.run_tests }} uses: ./.github/workflows/kernel-test.yml @@ -127,3 +130,17 @@ jobs: runs_on: ${{ inputs.runs_on }} secrets: AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }} + + gcc-bpf: + name: 'GCC BPF' + if: ${{ inputs.arch == 'x86_64' }} + uses: ./.github/workflows/gcc-bpf.yml + needs: [build] + with: + runs_on: ${{ inputs.runs_on }} + arch: ${{ inputs.arch }} + llvm-version: ${{ inputs.llvm-version }} + toolchain: ${{ inputs.toolchain }} + toolchain_full: ${{ inputs.toolchain_full }} + download_sources: ${{ inputs.download_sources }} + diff --git a/.github/workflows/kernel-build.yml b/.github/workflows/kernel-build.yml index 9769dae..7bad108 100644 --- a/.github/workflows/kernel-build.yml +++ b/.github/workflows/kernel-build.yml @@ -46,10 +46,6 @@ jobs: timeout-minutes: 100 env: ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst" - - BUILD_BPF_GCC: ${{ inputs.arch == 'x86_64' && 'true' || '' }} - BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/bpf-gcc - BPF_NEXT_BASE_BRANCH: 'master' BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds # BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }} @@ -111,18 +107,11 @@ jobs: max-make-jobs: 32 llvm-version: ${{ inputs.llvm-version }} - - if: ${{ env.BUILD_BPF_GCC }} - name: Build GCC for BPF selftests - uses: libbpf/ci/build-bpf-gcc@v3 - with: - install-dir: ${{ env.BPF_GCC_INSTALL_DIR }} - - name: Build selftests/bpf - uses: libbpf/ci/build-selftests@v3 + uses: libbpf/ci/build-selftests@main env: MAX_MAKE_JOBS: 32 RELEASE: ${{ inputs.release && '1' || '' }} - BPF_GCC: ${{ env.BUILD_BPF_GCC && env.BPF_GCC_INSTALL_DIR || '' }} with: arch: ${{ inputs.arch }} kernel-root: ${{ env.KERNEL_ROOT }} @@ -151,7 +140,7 @@ jobs: llvm-version: ${{ inputs.llvm-version }} - name: Tar artifacts id: tar-artifacts - uses: libbpf/ci/tar-artifacts@v3 + uses: libbpf/ci/tar-artifacts@main env: ARCHIVE_BPF_SELFTESTS: 'true' ARCHIVE_MAKE_HELPERS: 'true'