ci: Use KDIR=any

Drop .github/print-kdir.sh and just use KDIR=any to handle the kernel
headers.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/384
This commit is contained in:
Lucas De Marchi 2025-06-27 12:13:12 -05:00
parent ea67bad278
commit d449664485
4 changed files with 9 additions and 29 deletions

17
.github/print-kdir.sh vendored
View File

@ -1,17 +0,0 @@
#!/bin/bash
set -euo pipefail
for moddir in /usr/lib/modules /lib/modules; do
if [[ -e "$moddir" ]]; then
kernel=$(find "$moddir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
break
fi
done
# There should be one entry - the kernel we installed
if (( $(echo "$kernel" | wc -l) != 1 )); then
echo >&2 "Error: exactly one kernel must be installed"
exit 1
fi
echo "KDIR=$moddir/$kernel/build"

View File

@ -13,6 +13,9 @@ on:
schedule:
- cron: "30 2 * * 0"
env:
KDIR: 'any'
permissions:
contents: read
@ -41,10 +44,6 @@ jobs:
- name: Setup OS
uses: ./.github/actions/setup-os
- name: Set the environment
run: |
.github/print-kdir.sh >> "$GITHUB_ENV"
- name: Initialize CodeQL
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
with:

View File

@ -16,6 +16,9 @@ on:
permissions:
contents: read
env:
KDIR: 'any'
jobs:
analyze:
name: Analyze
@ -38,10 +41,6 @@ jobs:
- name: Setup OS
uses: ./.github/actions/setup-os
- name: Set the environment
run: |
.github/print-kdir.sh >> "$GITHUB_ENV"
- name: Build
run: |
meson setup --native-file build-dev.ini ${{ matrix.meson_setup }} builddir/

View File

@ -20,6 +20,9 @@ defaults:
run:
shell: bash
env:
KDIR: 'any'
jobs:
build:
runs-on: ubuntu-24.04
@ -94,10 +97,6 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set the environment
run: |
.github/print-kdir.sh >> "$GITHUB_ENV"
- name: configure checks
run: |
should_fail() {