Fix passing multiple kernel versions #897
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
# Build at 23:00 every Sunday | |
schedule: | |
- cron: "0 23 * * 1" | |
pull_request: | |
push: | |
jobs: | |
test-distributions: | |
name: Build in containers | |
strategy: | |
matrix: | |
distro: | |
- {name: "almalinux", tag: "9"} | |
- {name: "almalinux", tag: "8"} | |
- {name: "alpine", tag: "3.20", variant: "-lts"} | |
- {name: "alpine", tag: "3.20", variant: "-virt"} | |
- {name: "alpine", tag: "3.19", variant: "-lts"} | |
- {name: "alpine", tag: "3.19", variant: "-virt"} | |
- {name: "alpine", tag: "3.18", variant: "-lts"} | |
- {name: "alpine", tag: "3.18", variant: "-virt"} | |
- {name: "alpine", tag: "3.17", variant: "-lts"} | |
- {name: "alpine", tag: "3.17", variant: "-virt"} | |
- {name: "archlinux", tag: "latest"} | |
- {name: "archlinux", tag: "latest", variant: "-lts"} | |
- {name: "archlinux", tag: "latest", variant: "-zen"} | |
- {name: "centos/centos", tag: "stream9", url: "quay.io/"} | |
- {name: "debian", tag: "testing"} | |
- {name: "debian", tag: "12"} | |
- {name: "fedora/fedora", tag: "rawhide", url: "quay.io/"} | |
- {name: "fedora/fedora", tag: "41", url: "quay.io/"} | |
- {name: "fedora/fedora", tag: "40", url: "quay.io/"} | |
- {name: "fedora/fedora", tag: "39", url: "quay.io/"} | |
- {name: "opensuse/tumbleweed", tag: "latest", variant: "-default", url: "registry.opensuse.org/"} | |
- {name: "opensuse/leap", tag: "15.5", variant: "-default", url: "registry.opensuse.org/"} | |
- {name: "opensuse/leap", tag: "15.6", variant: "-default", url: "registry.opensuse.org/"} | |
- {name: "ubuntu", tag: "24.10"} | |
- {name: "ubuntu", tag: "24.04"} | |
- {name: "ubuntu", tag: "22.04"} | |
- {name: "ubuntu", tag: "20.04"} | |
runs-on: ubuntu-24.04 | |
container: | |
image: ${{ matrix.distro.url }}${{ matrix.distro.name }}:${{ matrix.distro.tag }} | |
steps: | |
- name: Install git for checkout action | |
if: contains(matrix.distro.name, 'opensuse') | |
run: | | |
zypper --non-interactive install git | |
- uses: actions/checkout@v4 | |
- name: Install dependencies for Red Hat based distributions | |
if: matrix.distro.name == 'almalinux' || contains(matrix.distro.name, 'centos') || contains(matrix.distro.name, 'fedora') | |
run: | | |
yum install -y diffutils elfutils-libelf gcc kernel kernel-devel make openssl | |
- name: Install Alpine dependencies | |
if: matrix.distro.name == 'alpine' | |
run: | | |
apk --no-cache --update add bash gcc linux${{ matrix.distro.variant }} linux${{ matrix.distro.variant }}-dev make openssl coreutils | |
- name: Install Arch Linux dependencies | |
if: matrix.distro.name == 'archlinux' | |
run: | | |
pacman -Syu --noconfirm diffutils gcc make linux${{ matrix.distro.variant }} linux${{ matrix.distro.variant }}-headers openssl | |
- name: Install Debian dependencies | |
if: matrix.distro.name == 'debian' | |
run: | | |
apt-get update -q | |
apt-get install -qy make linux-headers-amd64 linux-image-amd64 openssl xz-utils | |
- name: Install openSUSE leap dependencies | |
if: contains(matrix.distro.name, 'opensuse') | |
run: | | |
zypper --non-interactive install diffutils elfutils gcc kernel${{ matrix.distro.variant }} kernel${{ matrix.distro.variant }}-devel make openssl | |
- name: Install Ubuntu dependencies | |
if: matrix.distro.name == 'ubuntu' | |
run: | | |
apt-get update -q | |
apt-get install -qy gcc make linux-headers-generic linux-image-generic openssl shim-signed | |
- name: Install dkms | |
run: | | |
sed -i -e '/echo -en "."/d' dkms.in | |
make install | |
- name: Run tests | |
run: | | |
for moddir in /usr/lib/modules/ /lib/modules/; do | |
if [ -e "$moddir" ]; then | |
kernels=$(find "$moddir" -maxdepth 1 -type d -exec basename {} \;) | |
break | |
fi | |
done | |
# There should be two entries - "modules" and the kernel we installed | |
if [ $(echo "${kernels}" | wc -l) -ne 2 ]; then | |
echo >&2 "Error: invalid number of kernels installed" | |
fi | |
KERNEL_VER=$(echo "${kernels}" | tail -n1) | |
if [ -z "${KERNEL_VER}" ] ; then | |
echo >&2 "Error: no kernel package found" | |
exit 1 | |
fi | |
echo "Found kernel ${KERNEL_VER}" | |
export KERNEL_VER | |
echo "Module search paths" | |
for depmod in /etc/depmod.d/ /usr/lib/depmod.d/ /lib/depmod.d/; do | |
[ -e "$depmod" ] && grep -r ^search "$depmod" || true | |
done | |
if [ "${{ matrix.distro.name }}" = alpine ] && [ "${{ matrix.distro.variant }}" = "-lts" ]; then | |
if [ "${{ matrix.distro.tag }}" = "3.17" ]; then | |
./run_test.sh --no-signing-tool | |
else | |
./run_test.sh | |
fi | |
else | |
./run_test.sh | |
fi |