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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@xxxxxxxxx>
---
 .github/actions/setup-ubuntu/action.yml |  5 +++--
 .github/workflows/main.yml              | 11 +++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.github/actions/setup-ubuntu/action.yml b/.github/actions/setup-ubuntu/action.yml
index 554d261..f60cb1d 100644
--- a/.github/actions/setup-ubuntu/action.yml
+++ b/.github/actions/setup-ubuntu/action.yml
@@ -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
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index fa9c9b9..a9ad289 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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
-- 
2.45.2





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux