Skip to content

eBPF-based security platform

ci: build with gcc in the Build workflow too

Daniel Borkmannbc21bef01ad3
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b97c173d..2226482d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -15,24 +15,31 @@ concurrency:
cancel-in-progress: true
jobs:
- clang:
- name: clang
+ compiler:
+ name: ${{ matrix.cc }}
runs-on: ubuntu-latest
timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ cc:
+ - gcc
+ - clang
+
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- # The packages and every commit build with gcc; clang otherwise
- # compiles only the sanitized build, which leaves out
- # _FORTIFY_SOURCE=3 and the frame size limit. The BPF objects need
- # the BTF of a signed-BPF capable bpf-next kernel, so the build runs
- # in the same LVH VM as the package build.
- - name: Build with clang and run the unit tests in LVH VM
+ # Each compiler at the default flags, then the unit tests. The
+ # sanitized builds leave out _FORTIFY_SOURCE=3 and the frame size
+ # limit, and the package and per-commit builds run no unit tests.
+ # The BPF objects need the BTF of a signed-BPF capable bpf-next
+ # kernel, so the build runs in the same LVH VM as the package build.
+ - name: Build with ${{ matrix.cc }} and run the unit tests in LVH VM
uses: cilium/little-vm-helper@f86d344aca812dda5aef167867a9a0a90ca6cca5 # v0.0.31
with:
- test-name: shirudo-build-clang
+ test-name: shirudo-build-${{ matrix.cc }}
image: kind
image-version: bpf-next-20260603.072225
kernel-version: bpf-next-main
@@ -45,10 +52,10 @@ jobs:
cd /host
.github/scripts/vm-toolchain.sh
. build/vm-toolchain.env
- make -j4 CC=clang
- make CC=clang shirudo-build
- make -C testing CC=clang test-helpers
- make -C testing CC=clang unit
+ make -j4 CC=${{ matrix.cc }}
+ make CC=${{ matrix.cc }} shirudo-build
+ make -C testing CC=${{ matrix.cc }} test-helpers
+ make -C testing CC=${{ matrix.cc }} unit
sh .github/scripts/check-operator-linkage.sh shirudo \
tools/shirudo-build/shirudo-build
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 02c211f4..b03bd404 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -193,9 +193,9 @@ variables change it:
libbpf included. Fix the warning instead of keeping this set.
* - ``CC=clang``
- Compiles the userspace objects with clang rather than ``cc``. CI
- builds with both compilers at the same flags: the packages and
- every commit of a pull request with gcc, and the ``clang`` job of
- the ``Build`` workflow with clang, which also runs the unit tests.
+ builds with both compilers at the same flags and runs the unit
+ tests against each, in the ``gcc`` and ``clang`` jobs of the
+ ``Build`` workflow.
* - ``SHIRUDO_DEBUG=0``
- Leaves out ``-g``.
* - ``SANITIZE=address,undefined``