Skip to contentSkip to conversation

Add distros to github CI

PATCH In review Lucas De Marchi 2 participants 7 messages Jul 12, 2024 – Jul 19, 2024

lore
Share & tools
lore
#0 lore raw

cover Add distros to github CI

Add a few distros to CI to improve coverage. This is now executed on Ubuntu 24.04, Ubuntu 22.04, Fedora (latest), Archlinux and Alpine (latest).

For Alpine, the testsuite is disabled as it's currently not working. It can be enabled once fixed.

Results:
https://github.com/kmod-project/kmod/actions/runs/9913631414

Also available as a Github PR:
https://github.com/kmod-project/kmod/pull/44

Lucas De Marchi (5):
ci: Replace package installation with local action
ci: Use a container and expand versions
ci: Add Archlinux
ci: Add Fedora
ci: Add Alpine

 .github/actions/setup-alpine/action.yml    | 22 ++++++++++
 .github/actions/setup-archlinux/action.yml | 16 ++++++++
 .github/actions/setup-fedora/action.yml    | 27 +++++++++++++
 .github/actions/setup-ubuntu/action.yml    | 23 +++++++++++
 .github/workflows/main.yml                 | 47 +++++++++++++---------
 5 files changed, 117 insertions(+), 18 deletions(-)
 create mode 100644 .github/actions/setup-alpine/action.yml
 create mode 100644 .github/actions/setup-archlinux/action.yml
 create mode 100644 .github/actions/setup-fedora/action.yml
 create mode 100644 .github/actions/setup-ubuntu/action.yml
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/5 ci: Replace package installation with local action

Separate the package installation step with a local action so it's easier to support more versions and distros.

---
 .github/actions/setup-ubuntu/action.yml | 22 ++++++++++++++++++++++
 .github/workflows/main.yml              | 18 +-----------------
 2 files changed, 23 insertions(+), 17 deletions(-)
 create mode 100644 .github/actions/setup-ubuntu/action.yml
.github/actions/setup-ubuntu/action.yml new file +22 -0
new file mode 100644
index 0000000..554d261
@@ -0,0 +1,22 @@
+name: 'setup Ubuntu'
+description: 'Setup an Ubuntu container for running CI'
+runs:
+  using: 'composite'
+  steps:
+    - name: Install dependencies
+      shell: bash
+      run: |
+        sudo apt-get update
+        sudo apt-get install --yes \
+          build-essential \
+          autoconf \
+          automake \
+          gtk-doc-tools \
+          libssl-dev \
+          liblzma-dev \
+          libssl-dev \
+          libtool \
+          libzstd-dev \
+          linux-headers-generic \
+          scdoc \
+          zstd
.github/workflows/main.yml +1 -17
index 79eff14..fa9c9b9 100644
@@ -11,23 +11,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
-
-      - name: install dependencies
-        run: |
-          sudo apt-get update
-          sudo apt-get install --yes \
-            build-essential \
-            autoconf \
-            automake \
-            gtk-doc-tools \
-            libssl-dev \
-            liblzma-dev \
-            libssl-dev \
-            libtool \
-            libzstd-dev \
-            linux-headers-generic \
-            scdoc \
-            zstd \
+      - uses: ./.github/actions/setup-ubuntu
 
       - name: configure
         run: |
Signature · 1 line
2.45.2
#2 lore raw

PATCH 2/5 ci: Use a container and expand versions

In reply to Lucas De Marchi

Use containers to build/test so it's not restricted to the OS versions supported by Github runners. A few changes are needed to the workflow to support using containers:

1) No need for sudo, so remove it
2) Explicitly install missing zlib
3) Explicitly pass KDIR= while building kernel modules, since it won't match uname -r. This assumes the container has just one kernel installed and so /usr/lib/modules/*/build can be used as the single symlink to the kernel headers. This should be common to other distros to be added, too.

---
 .github/actions/setup-ubuntu/action.yml |  5 +++--
 .github/workflows/main.yml              | 11 +++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)
.github/actions/setup-ubuntu/action.yml +3 -2
index 554d261..f60cb1d 100644
@@ -6,8 +6,8 @@ runs:
     - name: Install dependencies
       shell: bash
       run: |
-        sudo apt-get update
-        sudo apt-get install --yes \
+        apt-get update
+        apt-get install --yes \
           build-essential \
           autoconf \
           automake \
@@ -19,4 +19,5 @@ runs:
           libzstd-dev \
           linux-headers-generic \
           scdoc \
+          zlib1g-dev \
           zstd
.github/workflows/main.yml +9 -2
index fa9c9b9..a9ad289 100644
@@ -9,6 +9,13 @@ on:
 jobs:
   build:
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        container: ['ubuntu:22.04', 'ubuntu:24.04']
+
+    container:
+      image: ${{ matrix.container }}
+
     steps:
       - uses: actions/checkout@v4
       - uses: ./.github/actions/setup-ubuntu
@@ -27,7 +34,7 @@ jobs:
       - name: test
         run: |
           cd build
-          make -j$(nproc) check
+          make KDIR=/usr/lib/modules/*/build -j$(nproc) check
 
       - name: install
         run: |
@@ -37,4 +44,4 @@ jobs:
       - name: distcheck
         run: |
           cd build
-          make distcheck
+          make KDIR=/usr/lib/modules/*/build distcheck
Signature · 1 line
2.45.2
#3 lore raw

PATCH 3/5 ci: Add Archlinux

In reply to Lucas De Marchi

Add an action to setup Archlinux and use it for the initial setup. The rest of the workflow can stay the same.

---
 .github/actions/setup-archlinux/action.yml | 16 ++++++++++++++++
 .github/workflows/main.yml                 |  6 +++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 .github/actions/setup-archlinux/action.yml
.github/actions/setup-archlinux/action.yml new file +16 -0
new file mode 100644
index 0000000..9b22a9a
@@ -0,0 +1,16 @@
+name: 'setup Archlinux'
+description: 'Setup an Archlinux container for running CI'
+runs:
+  using: 'composite'
+  steps:
+    - name: Install dependencies
+      shell: bash
+      run: |
+        rm -rf /etc/pacman.d/gnupg
+        pacman-key --init
+        pacman-key --populate
+        pacman --noconfirm -Sy archlinux-keyring
+        pacman --noconfirm -Su \
+          linux-headers \
+          scdoc \
+          gtk-doc
.github/workflows/main.yml +5 -1
index a9ad289..3f8eaa6 100644
@@ -11,14 +11,18 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        container: ['ubuntu:22.04', 'ubuntu:24.04']
+        container: ['ubuntu:22.04', 'ubuntu:24.04', 'archlinux:base-devel']
 
     container:
       image: ${{ matrix.container }}
 
     steps:
       - uses: actions/checkout@v4
+
       - uses: ./.github/actions/setup-ubuntu
+        if: ${{ startsWith(matrix.container, 'ubuntu') }}
+      - uses: ./.github/actions/setup-archlinux
+        if: ${{ startsWith(matrix.container, 'archlinux') }}
 
       - name: configure
         run: |
Signature · 1 line
2.45.2
#4 lore raw

PATCH 4/5 ci: Add Fedora

In reply to Lucas De Marchi

Add an action to setup latest Fedora and use it for the initial setup. Add hack on /usr/lib/modules so /usr/lib/modules/*/build can still be used in the rest of the workflow as the KDIR.

---
 .github/actions/setup-fedora/action.yml | 27 +++++++++++++++++++++++++
 .github/workflows/main.yml              |  4 +++-
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 .github/actions/setup-fedora/action.yml
.github/actions/setup-fedora/action.yml new file +27 -0
new file mode 100644
index 0000000..a2612e4
@@ -0,0 +1,27 @@
+name: 'setup Fedora'
+description: 'Setup a Fedora container for running CI'
+runs:
+  using: 'composite'
+  steps:
+    - name: Install dependencies
+      shell: bash
+      run: |
+        dnf update -y
+        dnf install -y \
+          autoconf \
+          automake \
+          make \
+          gcc \
+          kernel-devel \
+          zlib-devel \
+          xz-devel \
+          libzstd-devel \
+          openssl-devel \
+          gtk-doc \
+          libtool \
+          scdoc
+        # CI builds with KDIR pointing to /usr/lib/modules/*/build
+        # so just a foo/build pointing to the right place, assuming
+        # just one kernel installed
+        mkdir -p /usr/lib/modules/foo/
+        ln -s /usr/src/kernels/* /usr/lib/modules/foo/build
.github/workflows/main.yml +3 -1
index 3f8eaa6..4a2fff2 100644
@@ -11,7 +11,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        container: ['ubuntu:22.04', 'ubuntu:24.04', 'archlinux:base-devel']
+        container: ['ubuntu:22.04', 'ubuntu:24.04', 'archlinux:base-devel', 'fedora:latest']
 
     container:
       image: ${{ matrix.container }}
@@ -23,6 +23,8 @@ jobs:
         if: ${{ startsWith(matrix.container, 'ubuntu') }}
       - uses: ./.github/actions/setup-archlinux
         if: ${{ startsWith(matrix.container, 'archlinux') }}
+      - uses: ./.github/actions/setup-fedora
+        if: ${{ startsWith(matrix.container, 'fedora') }}
 
       - name: configure
         run: |
Signature · 1 line
2.45.2
#5 lore raw

PATCH 5/5 ci: Add Alpine

In reply to Lucas De Marchi

Add setup action for Alpine and start building it. Unfortunately the testsuite is not ready yet and fails to build like this:

	../testsuite/path.c:219:14: error: conflicting types for '__xstat64';
	have 'int(int,  const char *, struct stat64 *)'
	  219 | WRAP_VERSTAT(__x,64);
	      |              ^~~

Add everything needed on the setup action, so when the underlying issue is fixed, the testsuite can be enabled in CI.

---
 .github/actions/setup-alpine/action.yml | 22 ++++++++++++++++++++++
 .github/workflows/main.yml              | 16 +++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 .github/actions/setup-alpine/action.yml
.github/actions/setup-alpine/action.yml new file +22 -0
new file mode 100644
index 0000000..1c7eae9
@@ -0,0 +1,22 @@
+name: 'setup Alpine'
+description: 'Setup an Alpine container for running CI'
+runs:
+  using: 'composite'
+  steps:
+    - name: Install dependencies
+      shell: sh
+      run: |
+        apk update
+        apk add \
+          autoconf \
+          automake \
+          bash \
+          build-base \
+          gtk-doc \
+          libtool \
+          linux-edge-dev \
+          openssl-dev \
+          scdoc \
+          xz-dev \
+          zlib-dev \
+          zstd-dev
.github/workflows/main.yml +15 -1
index 4a2fff2..b4ad5cd 100644
@@ -11,7 +11,17 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        container: ['ubuntu:22.04', 'ubuntu:24.04', 'archlinux:base-devel', 'fedora:latest']
+        include:
+          - container: 'ubuntu:22.04'
+            test: 'yes'
+          - container: 'ubuntu:24.04'
+            test: 'yes'
+          - container: 'archlinux:base-devel'
+            test: 'yes'
+          - container: 'fedora:latest'
+            test: 'yes'
+          - container: 'alpine:latest'
+            test: 'no'
 
     container:
       image: ${{ matrix.container }}
@@ -25,6 +35,8 @@ jobs:
         if: ${{ startsWith(matrix.container, 'archlinux') }}
       - uses: ./.github/actions/setup-fedora
         if: ${{ startsWith(matrix.container, 'fedora') }}
+      - uses: ./.github/actions/setup-alpine
+        if: ${{ startsWith(matrix.container, 'alpine') }}
 
       - name: configure
         run: |
@@ -38,6 +50,7 @@ jobs:
           make -j$(nproc)
 
       - name: test
+        if: ${{ matrix.test == 'yes' }}
         run: |
           cd build
           make KDIR=/usr/lib/modules/*/build -j$(nproc) check
@@ -48,6 +61,7 @@ jobs:
           DESTDIR=$PWD/inst make install
 
       - name: distcheck
+        if: ${{ matrix.test == 'yes' }}
         run: |
           cd build
           make KDIR=/usr/lib/modules/*/build distcheck
Signature · 1 line
2.45.2
#6 lore raw
In reply to Lucas De Marchi
Quoted 13 lines · Lucas De Marchi

Add a few distros to CI to improve coverage. This is now executed on Ubuntu 24.04, Ubuntu 22.04, Fedora (latest), Archlinux and Alpine (latest).

For Alpine, the testsuite is disabled as it's currently not working. It can be enabled once fixed.

Results:
https://github.com/kmod-project/kmod/actions/runs/9913631414

Also available as a Github PR:
https://github.com/kmod-project/kmod/pull/44

Quoted 6 lines

Lucas De Marchi (5):
ci: Replace package installation with local action
ci: Use a container and expand versions
ci: Add Archlinux
ci: Add Fedora
ci: Add Alpine

This is now applied. CI results can be seen at
https://github.com/kmod-project/kmod/actions

In future we may work on import patch series submitted via mailing list to make sure all of them go through CI:
https://github.com/kmod-project/kmod/issues/52

I also added a bunch of issues in
https://github.com/kmod-project/kmod/issues, particularly for improvements. Thanks to Emil who also added some. If anyone looking to collaborate, feel free to grab one and submit patches either via mailing list or github.

With this I'm going to remove the TODO file that has been stale for a long time.

Lucas De Marchi

Quoted 15 lines
.github/actions/setup-alpine/action.yml    | 22 ++++++++++
.github/actions/setup-archlinux/action.yml | 16 ++++++++
.github/actions/setup-fedora/action.yml    | 27 +++++++++++++
.github/actions/setup-ubuntu/action.yml    | 23 +++++++++++
.github/workflows/main.yml                 | 47 +++++++++++++---------
5 files changed, 117 insertions(+), 18 deletions(-)

create mode 100644 .github/actions/setup-alpine/action.yml create mode 100644 .github/actions/setup-archlinux/action.yml create mode 100644 .github/actions/setup-fedora/action.yml create mode 100644 .github/actions/setup-ubuntu/action.yml

Signature · 1 line
2.45.2