Skip to content

Commit 83c4015

Browse files
authored
GCC BPF: factor out into a separate job (#338)
See: libbpf/ci#171
1 parent 64436c0 commit 83c4015

File tree

3 files changed

+101
-11
lines changed

3 files changed

+101
-11
lines changed

.github/workflows/gcc-bpf.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Testing GCC BPF compiler
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runs_on:
7+
required: true
8+
type: string
9+
arch:
10+
required: true
11+
type: string
12+
llvm-version:
13+
required: true
14+
type: string
15+
toolchain:
16+
required: true
17+
type: string
18+
toolchain_full:
19+
required: true
20+
type: string
21+
download_sources:
22+
required: true
23+
type: boolean
24+
25+
jobs:
26+
test:
27+
name: GCC BPF
28+
runs-on: ${{ fromJSON(inputs.runs_on) }}
29+
timeout-minutes: 100
30+
env:
31+
ARCH: ${{ inputs.arch }}
32+
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/gcc-bpf
33+
BPF_NEXT_BASE_BRANCH: 'master'
34+
REPO_ROOT: ${{ github.workspace }}/src
35+
KBUILD_OUTPUT: ${{ github.workspace }}/src/kbuild-output
36+
37+
steps:
38+
39+
- uses: actions/checkout@v4
40+
41+
- if: ${{ inputs.download_sources }}
42+
name: Download bpf-next tree
43+
uses: libbpf/ci/get-linux-source@v3
44+
with:
45+
dest: ${{ env.REPO_ROOT }}
46+
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
47+
48+
- uses: libbpf/ci/patch-kernel@v3
49+
with:
50+
patches-root: '${{ github.workspace }}/ci/diffs'
51+
repo-root: ${{ env.REPO_ROOT }}
52+
53+
- uses: actions/download-artifact@v4
54+
with:
55+
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
56+
path: ${{ env.REPO_ROOT }}
57+
58+
- name: Untar artifacts
59+
working-directory: ${{ env.REPO_ROOT }}
60+
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -
61+
62+
- name: Setup build environment
63+
uses: libbpf/ci/setup-build-env@v3
64+
with:
65+
arch: ${{ inputs.arch }}
66+
llvm-version: ${{ inputs.llvm-version }}
67+
68+
- name: Build GCC BPF compiler
69+
uses: libbpf/ci/build-bpf-gcc@v3
70+
with:
71+
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}
72+
73+
- name: Build selftests/bpf/test_progs-bpf_gcc
74+
uses: libbpf/ci/build-selftests@v3
75+
env:
76+
MAX_MAKE_JOBS: 32
77+
BPF_GCC: ${{ env.BPF_GCC_INSTALL_DIR }}
78+
SELFTESTS_BPF_TARGETS: 'test_progs-bpf_gcc'
79+
with:
80+
arch: ${{ inputs.arch }}
81+
kernel-root: ${{ env.REPO_ROOT }}
82+
llvm-version: ${{ inputs.llvm-version }}
83+
toolchain: ${{ inputs.toolchain }}
84+

.github/workflows/kernel-build-test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ on:
5858
required: true
5959

6060
jobs:
61+
6162
# Build kernel and selftest
6263
build:
6364
uses: ./.github/workflows/kernel-build.yml
@@ -69,6 +70,7 @@ jobs:
6970
llvm-version: ${{ inputs.llvm-version }}
7071
kernel: ${{ inputs.kernel }}
7172
download_sources: ${{ inputs.download_sources }}
73+
7274
build-release:
7375
if: ${{ inputs.build_release }}
7476
uses: ./.github/workflows/kernel-build.yml
@@ -81,6 +83,7 @@ jobs:
8183
kernel: ${{ inputs.kernel }}
8284
download_sources: ${{ inputs.download_sources }}
8385
release: true
86+
8487
test:
8588
if: ${{ inputs.run_tests }}
8689
uses: ./.github/workflows/kernel-test.yml
@@ -127,3 +130,17 @@ jobs:
127130
runs_on: ${{ inputs.runs_on }}
128131
secrets:
129132
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
133+
134+
gcc-bpf:
135+
name: 'GCC BPF'
136+
if: ${{ inputs.arch == 'x86_64' }}
137+
uses: ./.github/workflows/gcc-bpf.yml
138+
needs: [build]
139+
with:
140+
runs_on: ${{ inputs.runs_on }}
141+
arch: ${{ inputs.arch }}
142+
llvm-version: ${{ inputs.llvm-version }}
143+
toolchain: ${{ inputs.toolchain }}
144+
toolchain_full: ${{ inputs.toolchain_full }}
145+
download_sources: ${{ inputs.download_sources }}
146+

.github/workflows/kernel-build.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ jobs:
4646
timeout-minutes: 100
4747
env:
4848
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
49-
50-
BUILD_BPF_GCC: ${{ inputs.arch == 'x86_64' && 'true' || '' }}
51-
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/bpf-gcc
52-
5349
BPF_NEXT_BASE_BRANCH: 'master'
5450
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
5551
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
@@ -111,18 +107,11 @@ jobs:
111107
max-make-jobs: 32
112108
llvm-version: ${{ inputs.llvm-version }}
113109

114-
- if: ${{ env.BUILD_BPF_GCC }}
115-
name: Build GCC for BPF selftests
116-
uses: libbpf/ci/build-bpf-gcc@v3
117-
with:
118-
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}
119-
120110
- name: Build selftests/bpf
121111
uses: libbpf/ci/build-selftests@v3
122112
env:
123113
MAX_MAKE_JOBS: 32
124114
RELEASE: ${{ inputs.release && '1' || '' }}
125-
BPF_GCC: ${{ env.BUILD_BPF_GCC && env.BPF_GCC_INSTALL_DIR || '' }}
126115
with:
127116
arch: ${{ inputs.arch }}
128117
kernel-root: ${{ env.KERNEL_ROOT }}

0 commit comments

Comments
 (0)