Skip to content

Commit

Permalink
kernel-build, kernel-test: merge libbpf/ci#150 (#301)
Browse files Browse the repository at this point in the history
Also set pahole to master instead of a hardcoded commit.

Signed-off-by: Ihor Solodrai <[email protected]>
  • Loading branch information
theihor authored Nov 19, 2024
1 parent f68f2b7 commit 0f62cd3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 29 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,13 @@ jobs:
timeout-minutes: 100
env:
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
BASE_BRANCH: >-
${{ github.event_name == 'push' && github.ref_name
|| github.base_ref
|| 'bpf-next'
}}
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
CACHED_KERNEL_BUILD: ${{ github.event_name == 'push' || github.repository == 'libbpf/ci' && 'true' || '' }}
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
KERNEL: ${{ inputs.kernel }}
REPO_PATH: ""
REPO_ROOT: ${{ github.workspace }}
KERNEL_ROOT: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
# We fetch an actual bit of history here to facilitate incremental
Expand All @@ -64,24 +61,33 @@ jobs:
fetch-depth: 50
- if: ${{ inputs.download_sources }}
name: Download bpf-next tree
uses: libbpf/ci/get-linux-source@v1
env:
FETCH_DEPTH: ${{ env.CACHED_KERNEL_BUILD && 16 || 0 }}
uses: libbpf/ci/get-linux-source@v2
with:
dest: '.kernel'
- if: ${{ inputs.download_sources }}
name: Move linux source in place
shell: bash
run: |
rm -rf .kernel/.git
cp -rf .kernel/. .
rm -rf .kernel
- uses: libbpf/ci/prepare-incremental-build@v1
- if: ${{ env.CACHED_KERNEL_BUILD }}
uses: libbpf/ci/prepare-incremental-build@v1
with:
repo-root: ${{ env.REPO_ROOT }}
base-branch: ${{ env.BASE_BRANCH }}
repo-root: ${{ inputs.download_sources && '.kernel' || env.REPO_ROOT }}
base-branch: >-
${{ github.repository == 'kernel-patches/bpf' && github.event_name == 'push' && github.ref_name
|| github.repository == 'kernel-patches/bpf' && github.event_name != 'push' && github.base_ref
|| 'master'
}}
arch: ${{ inputs.arch }}
toolchain_full: ${{ inputs.toolchain_full }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
- uses: libbpf/ci/patch-kernel@v1
- if: ${{ inputs.download_sources }}
name: Move linux source in place
shell: bash
run: |
cd .kernel
rm -rf .git
mv -t .. $(ls -A)
cd ..
rmdir .kernel
- uses: libbpf/ci/patch-kernel@v2
with:
patches-root: '${{ github.workspace }}/ci/diffs'
repo-root: ${{ env.REPO_ROOT }}
Expand All @@ -90,7 +96,7 @@ jobs:
with:
arch: ${{ inputs.arch }}
llvm-version: ${{ inputs.llvm-version }}
pahole: c2f89dab3f2b0ebb53bab3ed8be32f41cb743c37
pahole: master
- name: Print toolchain version used
shell: bash
run: |
Expand All @@ -108,18 +114,16 @@ jobs:
max-make-jobs: 32
llvm-version: ${{ inputs.llvm-version }}
- name: Build selftests/bpf
uses: libbpf/ci/build-selftests@v1
uses: libbpf/ci/build-selftests@v2
env:
MAX_MAKE_JOBS: 32
RELEASE: ${{ inputs.release && '1' || '' }}
with:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
kernel-root: ${{ env.KERNEL_ROOT }}
llvm-version: ${{ inputs.llvm-version }}
env:
# RELEASE= disables all optimizaions
# RELEASE=0 adds -O0 make flag
# RELEASE=1 adds -O2 make flag
RELEASE: ${{ inputs.release && '1' || '' }}
toolchain: ${{ inputs.toolchain }}

- if: ${{ env.BUILD_SCHED_EXT_SELFTESTS }}
name: Build selftests/sched_ext
uses: libbpf/ci/build-scx-selftests@v1
Expand Down Expand Up @@ -151,7 +155,7 @@ jobs:
archive: ${{ env.ARTIFACTS_ARCHIVE }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
repo-root: ${{ env.REPO_ROOT }}
- if: ${{ github.event_name != 'push' }}
- if: ${{ ! env.CACHED_KERNEL_BUILD }}
name: Remove KBUILD_OUTPUT content
shell: bash
run: |
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/kernel-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,48 @@ jobs:
runs-on: ${{ fromJSON(inputs.runs_on) }}
timeout-minutes: 100
env:
ARCH: ${{ inputs.arch }}
KERNEL: ${{ inputs.kernel }}
REPO_ROOT: ${{ github.workspace }}
REPO_PATH: ""
# https://github.com/actions/runner/issues/1483#issuecomment-1031671517
# booleans are weird in GH.
CONTINUE_ON_ERROR: ${{ inputs.continue_on_error }}
DEPLOYMENT: ${{ github.repository == 'kernel-patches/bpf' && 'prod' || 'rc' }}
ALLOWLIST_FILE: /tmp/allowlist
DENYLIST_FILE: /tmp/denylist
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
path: .

- name: Untar artifacts
# zstd is installed by default in the runner images.
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- name: Prepare ALLOW/DENYLIST
env:
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
run: |
cat "${SELFTESTS_BPF}/ALLOWLIST" \
"${SELFTESTS_BPF}/ALLOWLIST.${ARCH}" \
"${VMTEST_CONFIGS}/ALLOWLIST" \
"${VMTEST_CONFIGS}/ALLOWLIST.${ARCH}" \
2> /dev/null > "${ALLOWLIST_FILE}" || true
cat "${SELFTESTS_BPF}/DENYLIST" \
"${SELFTESTS_BPF}/DENYLIST.${ARCH}" \
"${VMTEST_CONFIGS}/DENYLIST" \
"${VMTEST_CONFIGS}/DENYLIST.${ARCH}" \
"${VMTEST_CONFIGS}/DENYLIST.${DEPLOYMENT}" \
2> /dev/null > "${DENYLIST_FILE}" || true
- name: Run selftests
uses: libbpf/ci/run-vmtest@v1
uses: libbpf/ci/run-vmtest@v2
# https://github.com/actions/runner/issues/1483#issuecomment-1031671517
# booleans are weird in GH.
continue-on-error: ${{ fromJSON(env.CONTINUE_ON_ERROR) }}
Expand Down

0 comments on commit 0f62cd3

Please sign in to comment.