Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 10 additions & 38 deletions .github/scripts/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand All @@ -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,
Expand Down Expand Up @@ -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),
),
]

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/gcc-bpf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}

21 changes: 14 additions & 7 deletions .github/workflows/kernel-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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 }}
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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' }}
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/veristat-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ 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
description: The runners to run the test on. This is a json string representing an array of labels.

jobs:
veristat:
name: ${{ inputs.arch }}-${{ inputs.toolchain }} veristat_kernel
name: veristat-kernel
runs-on: ${{ fromJSON(inputs.runs_on) }}
timeout-minutes: 100
permissions:
Expand All @@ -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:

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/veristat-meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:

Expand Down
Loading