eBPF-based security platform
ci: build with clang at the default flags and run the unit tests
Daniel Borkmanne541fb16a364
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlnew file mode 100644index 00000000..a746585e--- /dev/null+++ b/.github/workflows/build.yml@@ -0,0 +1,53 @@+name: Build++on:+ push:+ branches:+ - main+ pull_request:++permissions:+ contents: read++# A newer run for the same branch or pull request supersedes this one.+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ cancel-in-progress: true++jobs:+ clang:+ name: clang+ runs-on: ubuntu-latest+ timeout-minutes: 60++ 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+ uses: cilium/little-vm-helper@f86d344aca812dda5aef167867a9a0a90ca6cca5 # v0.0.31+ with:+ test-name: shirudo-build-clang+ image: kind+ image-version: bpf-next-20260603.072225+ kernel-version: bpf-next-main+ host-mount: ${{ github.workspace }}+ images-folder-parent: ${{ github.workspace }}/../lvh+ install-dependencies: true+ cpu: 4+ mem: 8G+ cmd: |+ 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+ sh .github/scripts/check-operator-linkage.sh shirudo \+ tools/shirudo-build/shirudo-builddiff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex cd9a400d..df87d185 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -191,6 +191,11 @@ variables change it:- Lets a compiler newer than the tree finish the build. A warningfails every build by default, the BPF objects and the vendoredlibbpf 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.* - ``SHIRUDO_DEBUG=0``- Leaves out ``-g``.* - ``SANITIZE=address,undefined``