From: Emil Velikov Date: Tue, 3 Jun 2025 21:46:48 +0000 (+0100) Subject: ci: fold gcc/clang combinations together X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59b46aa53ca32d06f67515642c08ed296b39bce0;p=thirdparty%2Fkmod.git ci: fold gcc/clang combinations together Instead of listing each combination on per-compiler basis, assume we want both unless annotated otherwise. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/362 Signed-off-by: Lucas De Marchi --- diff --git a/.github/functions.sh b/.github/functions.sh index f8639e92..75a0d26a 100644 --- a/.github/functions.sh +++ b/.github/functions.sh @@ -2,23 +2,26 @@ # Allowed values are 32, 64 and help. # -# Simple helper executing the given function for all bit combinations +# Simple helper executing the given function for all compiler/bit combinations # for_each_config() { - [[ -n $1 ]] && bits="$1" || bits="32 64" - [[ -n $2 ]] && suffix="-$2" || suffix="" - meson_cmd=$3 + [[ -n $1 ]] && compilers="$1" || compilers="gcc clang" + [[ -n $2 ]] && bits="$2" || bits="32 64" + [[ -n $3 ]] && suffix="-$3" || suffix="" + meson_cmd=$4 - for bit in ${bits[@]}; do - echo "::group::$bit bit" - builddir="builddir-$bit$suffix/" + for compiler in ${compilers[@]}; do + for bit in ${bits[@]}; do + echo "::group::$compiler, $bit bit" + builddir="builddir-$compiler-$bit$suffix/" - if [[ "$bit" == "32" ]]; then - CC="$CC -m32" $meson_cmd "$builddir" "$bit" - else - $meson_cmd "$builddir" "$bit" - fi + if [[ "$bit" == "32" ]]; then + CC="$compiler -m32" $meson_cmd "$builddir" "$bit" + else + CC=$compiler $meson_cmd "$builddir" "$bit" + fi - echo "::endgroup::" + echo "::endgroup::" + done done } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb4d094a..236a5609 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,101 +22,57 @@ defaults: jobs: build: - env: - CC: ${{ matrix.compiler }} runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: include: - - compiler: 'gcc' - container: 'alpine:latest' + - container: 'alpine:latest' meson_setup: '-Ddocs=false -Db_sanitize=none' only_bits: '64' - - compiler: 'gcc' - container: 'archlinux:multilib-devel' + - container: 'archlinux:multilib-devel' skip_test: '32' - - compiler: 'gcc' - container: 'debian:bullseye-slim' + - container: 'debian:bullseye-slim' meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=enabled -Dtools=true' + only_compiler: 'gcc' skip_test: '32' - - compiler: 'gcc' - container: 'debian:unstable' + - container: 'debian:unstable' skip_test: '32' - - compiler: 'gcc' - container: 'fedora:latest' + - container: 'fedora:latest' only_bits: '64' - - compiler: 'gcc' - container: 'fedora:latest' + - container: 'fedora:latest' meson_setup: '-Dxz=disabled -Ddlopen=all' only_bits: '64' custom: 'no-xz-dlopen-all' - - compiler: 'gcc' - container: 'ubuntu:22.04' + - container: 'ubuntu:22.04' skip_test: '32' - - compiler: 'gcc' - container: 'ubuntu:22.04' + - container: 'ubuntu:22.04' meson_setup: '-Ddlopen=zstd,zlib' only_bits: '64' custom: 'dlopen-zstd-zlib' - - compiler: 'gcc' - container: 'ubuntu:24.04' - skip_test: '32' - - # clang variations of the same builds - - - compiler: 'clang' - container: 'alpine:latest' - meson_setup: '-Ddocs=false -Db_sanitize=none' - only_bits: '64' - - compiler: 'clang' - container: 'archlinux:multilib-devel' - skip_test: '32' - - compiler: 'clang' - container: 'debian:unstable' - skip_test: '32' - # Disabled because it doesn't work - # - compiler: 'clang' - # container: 'debian:bullseye-slim' - # meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=enabled -Dtools=true' - # skip_test: '32' - - compiler: 'clang' - container: 'fedora:latest' - only_bits: '64' - - compiler: 'clang' - container: 'fedora:latest' - meson_setup: '-Dxz=disabled -Ddlopen=all' - only_bits: '64' - custom: 'no-xz-dlopen-all' - - compiler: 'clang' - container: 'ubuntu:22.04' - skip_test: '32' - - compiler: 'clang' - container: 'ubuntu:22.04' - meson_setup: '-Ddlopen=zstd,zlib' - only_bits: '64' - custom: 'dlopen-zstd-zlib' - - compiler: 'clang' - container: 'ubuntu:24.04' + - container: 'ubuntu:24.04' skip_test: '32' # Special configurations # Variant with lld as linker - - compiler: 'clang' - container: 'archlinux:multilib-devel' + - container: 'archlinux:multilib-devel' only_bits: '64' + only_compiler: 'clang' + custom: 'ldd-as-linker' linker: 'lld' # Variants with moduledir - - compiler: 'gcc' - container: 'archlinux:multilib-devel' + - container: 'archlinux:multilib-devel' meson_setup: '-Dmoduledir=/usr/lib/modules' only_bits: '64' - - compiler: 'gcc' - container: 'archlinux:multilib-devel' + only_compiler: 'gcc' + custom: 'usr-moduledir' + - container: 'archlinux:multilib-devel' meson_setup: '-Dmoduledir=/kernel-modules' only_bits: '64' + only_compiler: 'gcc' + custom: 'custom-moduledir' container: image: ${{ matrix.container }} @@ -182,7 +138,7 @@ jobs: } source .github/functions.sh - for_each_config "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_setup + for_each_config "${{ matrix.only_compiler }}" "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_setup - name: build run: | @@ -190,7 +146,7 @@ jobs: meson compile -C "$1" } source .github/functions.sh - for_each_config "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_build + for_each_config "${{ matrix.only_compiler }}" "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_build - name: test run: | @@ -202,7 +158,7 @@ jobs: meson test -C "$1" || meson test -C "$1" --verbose } source .github/functions.sh - for_each_config "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_test + for_each_config "${{ matrix.only_compiler }}" "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_test - name: install run: | @@ -210,7 +166,7 @@ jobs: DESTDIR=$PWD/inst meson install -C "$1" } source .github/functions.sh - for_each_config "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_install + for_each_config "${{ matrix.only_compiler }}" "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_install - name: distcheck run: | @@ -222,4 +178,4 @@ jobs: meson dist -C "$1" } source .github/functions.sh - for_each_config "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_distcheck + for_each_config "${{ matrix.only_compiler }}" "${{ matrix.only_bits }}" "${{ matrix.custom }}" do_distcheck