]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
ci: fold gcc/clang combinations together
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 3 Jun 2025 21:46:48 +0000 (22:46 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 5 Jun 2025 06:39:11 +0000 (01:39 -0500)
Instead of listing each combination on per-compiler basis, assume we
want both unless annotated otherwise.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/362
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
.github/functions.sh
.github/workflows/main.yml

index f8639e92ff6db76d81f0cd2a4cfe68948cb2dff7..75a0d26aeb71b37dd06efbbac177012fe70ba671 100644 (file)
@@ -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
 }
index bb4d094a3ab96034fad5e265531e61a131a079b1..236a5609ff024849e36222726cf9f6d41b4bf1e9 100644 (file)
@@ -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