diff --git a/.github/scripts/matrix.py b/.github/scripts/matrix.py index d62e12a1..8fd97faa 100644 --- a/.github/scripts/matrix.py +++ b/.github/scripts/matrix.py @@ -16,7 +16,8 @@ DEFAULT_SELF_HOSTED_RUNNER_TAGS: Final[List[str]] = ["self-hosted", "docker-noble-main"] DEFAULT_GITHUB_HOSTED_RUNNER: Final[str] = "ubuntu-24.04" -DEFAULT_LLVM_VERSION: Final[int] = 17 +DEFAULT_GCC_VERSION: Final[int] = 14 +DEFAULT_LLVM_VERSION: Final[int] = 18 RUNNERS_BUSY_THRESHOLD: Final[float] = 0.8 @@ -36,31 +37,6 @@ class Compiler(str, Enum): LLVM = "llvm" -@dataclasses.dataclass -class Toolchain: - compiler: Compiler - # This is relevant ONLY for LLVM and should not be required for GCC - version: int - - @property - def short_name(self) -> str: - return str(self.compiler.value) - - @property - def full_name(self) -> str: - if self.compiler == Compiler.GCC: - return self.short_name - - return f"{self.short_name}-{self.version}" - - def to_dict(self) -> Dict[str, Union[str, int]]: - return { - "name": self.short_name, - "fullname": self.full_name, - "version": self.version, - } - - def query_runners_from_github() -> List[Dict[str, Any]]: if "GITHUB_TOKEN" not in os.environ: return [] @@ -150,7 +126,9 @@ def count_by_status(runners: List[Dict[str, Any]]) -> Dict[str, int]: @dataclasses.dataclass class BuildConfig: arch: Arch - toolchain: Toolchain + kernel_compiler: Compiler = Compiler.GCC + gcc_version: int = DEFAULT_GCC_VERSION + llvm_version: int = DEFAULT_LLVM_VERSION kernel: str = "LATEST" run_veristat: bool = False parallel_tests: bool = False @@ -205,7 +183,7 @@ def tests(self) -> Dict[str, Any]: if self.arch.value != "s390x": tests_list.append("test_maps") - if self.toolchain.version >= 18: + if self.llvm_version >= 18: tests_list.append("test_progs_cpuv4") # if self.arch in [Arch.X86_64, Arch.AARCH64]: @@ -224,7 +202,9 @@ def tests(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]: return { "arch": self.arch.value, - "toolchain": self.toolchain.to_dict(), + "kernel_compiler": self.kernel_compiler.value, + "gcc_version": DEFAULT_GCC_VERSION, + "llvm_version": DEFAULT_LLVM_VERSION, "kernel": self.kernel, "run_veristat": self.run_veristat, "parallel_tests": self.parallel_tests, @@ -272,27 +252,19 @@ def generate_test_config(test: str) -> Dict[str, Union[str, int]]: matrix = [ BuildConfig( arch=Arch.X86_64, - toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION), run_veristat=True, parallel_tests=True, ), BuildConfig( arch=Arch.X86_64, - toolchain=Toolchain(compiler=Compiler.LLVM, version=DEFAULT_LLVM_VERSION), - build_release=True, - ), - BuildConfig( - arch=Arch.X86_64, - toolchain=Toolchain(compiler=Compiler.LLVM, version=18), + kernel_compiler=Compiler.LLVM, build_release=True, ), BuildConfig( arch=Arch.AARCH64, - toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION), ), BuildConfig( arch=Arch.S390X, - toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION), ), ] diff --git a/.github/workflows/gcc-bpf.yml b/.github/workflows/gcc-bpf.yml index 8356a0af..5f052343 100644 --- a/.github/workflows/gcc-bpf.yml +++ b/.github/workflows/gcc-bpf.yml @@ -9,7 +9,10 @@ on: arch: required: true type: string - llvm-version: + gcc_version: + required: true + type: string + llvm_version: required: true type: string toolchain: @@ -78,7 +81,8 @@ jobs: uses: libbpf/ci/setup-build-env@v3 with: arch: ${{ inputs.arch }} - llvm-version: ${{ inputs.llvm-version }} + gcc-version: ${{ inputs.gcc_version }} + llvm-version: ${{ inputs.llvm_version }} - name: Download GCC BPF compiler shell: bash @@ -95,6 +99,5 @@ jobs: with: arch: ${{ inputs.arch }} kernel-root: ${{ env.REPO_ROOT }} - llvm-version: ${{ inputs.llvm-version }} + 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 541ef910..37690cef 100644 --- a/.github/workflows/kernel-build-test.yml +++ b/.github/workflows/kernel-build-test.yml @@ -23,10 +23,14 @@ on: required: true type: string description: The runners to run the builds on. This is a json string representing an array of labels. - llvm-version: + gcc_version: required: true type: string - description: The version of LLVM used to build selftest.... for llvm toolchain, this should match the one from toolchain_full, for gcc it is an arbritrary version we decide to build selftests against. + description: GCC version to install + llvm_version: + required: true + type: string + description: LLVM version to install kernel: required: true type: string @@ -67,7 +71,8 @@ jobs: toolchain_full: ${{ inputs.toolchain_full }} toolchain: ${{ inputs.toolchain }} runs_on: ${{ inputs.build_runs_on }} - llvm-version: ${{ inputs.llvm-version }} + gcc_version: ${{ inputs.gcc_version }} + llvm_version: ${{ inputs.llvm_version }} kernel: ${{ inputs.kernel }} download_sources: ${{ inputs.download_sources }} @@ -79,7 +84,8 @@ jobs: toolchain_full: ${{ inputs.toolchain_full }} toolchain: ${{ inputs.toolchain }} runs_on: ${{ inputs.build_runs_on }} - llvm-version: ${{ inputs.llvm-version }} + gcc_version: ${{ inputs.gcc_version }} + llvm_version: ${{ inputs.llvm_version }} kernel: ${{ inputs.kernel }} download_sources: ${{ inputs.download_sources }} release: true @@ -112,7 +118,7 @@ jobs: contents: read with: arch: ${{ inputs.arch }} - toolchain: ${{ inputs.toolchain }} + toolchain_full: ${{ inputs.toolchain_full }} runs_on: ${{ inputs.runs_on }} veristat-meta: @@ -125,7 +131,7 @@ jobs: contents: read with: arch: ${{ inputs.arch }} - toolchain: ${{ inputs.toolchain }} + toolchain_full: ${{ inputs.toolchain_full }} aws_region: ${{ vars.AWS_REGION }} runs_on: ${{ inputs.runs_on }} secrets: @@ -140,7 +146,8 @@ jobs: # GCC BPF does not need /dev/kvm, so use the "build" runners runs_on: ${{ inputs.build_runs_on }} arch: ${{ inputs.arch }} - llvm-version: ${{ inputs.llvm-version }} + gcc_version: ${{ inputs.gcc_version }} + 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 d2866a6c..6a5dba01 100644 --- a/.github/workflows/kernel-build.yml +++ b/.github/workflows/kernel-build.yml @@ -20,10 +20,14 @@ on: required: true type: string description: The runners to run the test on. This is a json string representing an array of labels. - llvm-version: + gcc_version: required: true type: string - description: The version of LLVM used to build selftest.... for llvm toolchain, this should match the one from toolchain_full, for gcc it is an arbritrary version we decide to build selftests against. + description: GCC version to install + llvm_version: + required: true + type: string + description: LLVM version to install kernel: required: true type: string @@ -41,7 +45,7 @@ on: jobs: build: - name: build for ${{ inputs.arch }} with ${{ inputs.toolchain_full }}${{ inputs.release && '-O2' || '' }} + name: build kernel and selftests ${{ inputs.release && '-O2' || '' }} # To run on CodeBuild, runs-on value must correspond to the AWS # CodeBuild project associated with the kernel-patches webhook # However matrix.py passes just a 'codebuild' string @@ -109,7 +113,8 @@ jobs: uses: libbpf/ci/setup-build-env@v3 with: arch: ${{ inputs.arch }} - llvm-version: ${{ inputs.llvm-version }} + gcc-version: ${{ inputs.gcc_version }} + llvm-version: ${{ inputs.llvm_version }} pahole: master # We have to setup qemu+binfmt in order to enable cross-compation of selftests. @@ -131,7 +136,7 @@ jobs: toolchain: ${{ inputs.toolchain }} kbuild-output: ${{ env.KBUILD_OUTPUT }} max-make-jobs: 32 - llvm-version: ${{ inputs.llvm-version }} + llvm-version: ${{ inputs.llvm_version }} - name: Build selftests/bpf uses: libbpf/ci/build-selftests@v3 @@ -141,7 +146,7 @@ jobs: with: arch: ${{ inputs.arch }} kernel-root: ${{ env.KERNEL_ROOT }} - llvm-version: ${{ inputs.llvm-version }} + llvm-version: ${{ inputs.llvm_version }} toolchain: ${{ inputs.toolchain }} - if: ${{ env.BUILD_SCHED_EXT_SELFTESTS }} @@ -152,7 +157,7 @@ jobs: repo-root: ${{ env.REPO_ROOT }} arch: ${{ inputs.arch }} toolchain: ${{ inputs.toolchain }} - llvm-version: ${{ inputs.llvm-version }} + llvm-version: ${{ inputs.llvm_version }} max-make-jobs: 32 - if: ${{ github.event_name != 'push' }} @@ -163,7 +168,7 @@ jobs: toolchain: ${{ inputs.toolchain }} kbuild-output: ${{ env.KBUILD_OUTPUT }} max-make-jobs: 32 - llvm-version: ${{ inputs.llvm-version }} + llvm-version: ${{ inputs.llvm_version }} - name: Tar artifacts id: tar-artifacts uses: libbpf/ci/tar-artifacts@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16421f53..24773459 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: build-and-test: # Setting name to arch-compiler here to avoid lengthy autogenerated names due to matrix # e.g build-and-test x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc - name: "${{ matrix.arch }}-${{ matrix.toolchain.fullname }}" + name: ${{ matrix.arch }} ${{ matrix.kernel_compiler }}-${{ matrix.kernel_compiler == 'gcc' && matrix.gcc_version || matrix.llvm_version }} uses: ./.github/workflows/kernel-build-test.yml needs: [set-matrix] permissions: @@ -55,11 +55,12 @@ jobs: matrix: ${{ fromJSON(needs.set-matrix.outputs.build-matrix) }} with: arch: ${{ matrix.arch }} - toolchain_full: ${{ matrix.toolchain.fullname }} - toolchain: ${{ matrix.toolchain.name }} + toolchain: ${{ matrix.kernel_compiler }} + toolchain_full: ${{ matrix.kernel_compiler }}-${{ matrix.kernel_compiler == 'gcc' && matrix.gcc_version || matrix.llvm_version }} runs_on: ${{ toJSON(matrix.runs_on) }} build_runs_on: ${{ toJSON(matrix.build_runs_on) }} - llvm-version: ${{ matrix.toolchain.version }} + gcc_version: ${{ matrix.gcc_version }} + llvm_version: ${{ matrix.llvm_version }} kernel: ${{ matrix.kernel }} tests: ${{ toJSON(matrix.tests) }} run_veristat: ${{ matrix.run_veristat }} diff --git a/.github/workflows/veristat-kernel.yml b/.github/workflows/veristat-kernel.yml index 0557daeb..99168008 100644 --- a/.github/workflows/veristat-kernel.yml +++ b/.github/workflows/veristat-kernel.yml @@ -7,10 +7,10 @@ on: required: true type: string description: The architecture to build against, e.g x86_64, aarch64, s390x... - toolchain: + toolchain_full: required: true type: string - description: The toolchain, e.g gcc, llvm + description: Toolchain identifier, such as llvm-20 runs_on: required: true type: string @@ -18,7 +18,7 @@ on: jobs: veristat: - name: ${{ inputs.arch }}-${{ inputs.toolchain }} veristat_kernel + name: veristat-kernel runs-on: ${{ fromJSON(inputs.runs_on) }} timeout-minutes: 100 permissions: @@ -29,7 +29,7 @@ jobs: REPO_ROOT: ${{ github.workspace }} REPO_PATH: "" KBUILD_OUTPUT: kbuild-output/ - ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain }} + ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain_full }} steps: diff --git a/.github/workflows/veristat-meta.yml b/.github/workflows/veristat-meta.yml index 00700a82..0b3ebe8f 100644 --- a/.github/workflows/veristat-meta.yml +++ b/.github/workflows/veristat-meta.yml @@ -7,10 +7,10 @@ on: required: true type: string description: The architecture to build against, e.g x86_64, aarch64, s390x... - toolchain: + toolchain_full: required: true type: string - description: The toolchain, e.g gcc, llvm + description: Toolchain identifier, such as llvm-20 runs_on: required: true type: string @@ -26,7 +26,7 @@ on: jobs: veristat: - name: ${{ inputs.arch }}-${{ inputs.toolchain }} veristat_meta + name: veristat-meta runs-on: ${{ fromJSON(inputs.runs_on) }} timeout-minutes: 100 permissions: @@ -37,7 +37,7 @@ jobs: REPO_ROOT: ${{ github.workspace }} REPO_PATH: "" KBUILD_OUTPUT: kbuild-output/ - ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain }} + ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain_full }} steps: