From: Emil Velikov Date: Mon, 2 Sep 2024 17:58:35 +0000 (+0100) Subject: ci: add KDIR to the environment X-Git-Tag: v34~458 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55b5629ca4263e47c2ee3657b06910d70da04775;p=thirdparty%2Fkmod.git ci: add KDIR to the environment The environment variable is used in multiple places, so just set it once. While in there, check that only a single kernel is installed. It's better to error out with a clear message. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/86 Signed-off-by: Lucas De Marchi --- diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9115588..6e25c26f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,6 +59,19 @@ jobs: # doesn't quite work. Perhaps our double/sparse checkout is to blame? git config --global --add safe.directory '*' + 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) -ne 1 ]; then + echo >&2 "Error: exactly one kernel must be installed" + fi + echo "KDIR=$moddir/$kernel/build" >> "$GITHUB_ENV" + - name: configure run: | mkdir build @@ -74,7 +87,7 @@ jobs: if: ${{ matrix.test == 'yes' }} run: | cd build - make KDIR=/usr/lib/modules/*/build -j$(nproc) check + make -j$(nproc) check - name: install run: | @@ -85,4 +98,4 @@ jobs: if: ${{ matrix.test == 'yes' }} run: | cd build - make KDIR=/usr/lib/modules/*/build distcheck + make distcheck