-
Notifications
You must be signed in to change notification settings - Fork 531
91 lines (87 loc) · 3.68 KB
/
kmod-compatibility-checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: kmod compatibility checks
on:
pull_request:
branches:
- develop
- main
push:
branches:
- develop
- main
jobs:
get_debuntu_releases:
runs-on: ubuntu-latest
steps:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get -y install curl jq
- name: calculate available releases
# the following does:
# - fetch all available tags for the "buildpack-deps" Docker image
# - fetch all available Ubuntu and Debian releases (that are still hosted on the distros' archive servers)
# - get the intersection of the tags and the releaess
# - drop some releases (e.g. 'oldstable')
# - format as a JSON array
run: |
echo matrix=$(true; (curl -s "https://hub.docker.com/v2/repositories/library/buildpack-deps/tags?page_size=1000" | jq -r '.results[] | .name' | sort -u; for url in http://archive.ubuntu.com/ubuntu; do curl -s "${url}/dists/" | grep "href=" | sed -e 's|.*a href="||' -e 's|".*||' -e 's|/$||'; done | sort -u; for d in unstable testing stable oldstable; do echo $d; done) | sort | uniq -d | while read x; do echo -n '"'${x}'" '; done | sed -e 's|^ *|[|' -e 's| *$|]|' -e 's| *|,|g') | tee -a $GITHUB_OUTPUT
id: set-matrix
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
kmod-compile:
runs-on: ubuntu-latest
needs: get_debuntu_releases
strategy:
matrix:
series: ${{ fromJson(needs.get_debuntu_releases.outputs.matrix) }}
fail-fast: false
container: buildpack-deps:${{ matrix.series }}
env:
JOB_KNOWN_FAILURES: "3.13 3.16 3.19 4.2"
steps:
- uses: actions/checkout@v2
- name: Compile against all available kernel header versions
shell: bash
run: |
arch=$(dpkg --print-architecture)
apt-get update --quiet;
apt-get install --yes --no-install-recommends kmod
for kver in $(apt-cache search 'linux-headers-.*-generic' | cut -d- -f3 | sort -u -V); do
apt-cache search 'linux-headers-'"${kver}"'-.*-generic' | sort -V | awk '{print $1}';
done | xargs apt-get install --yes --no-install-recommends || true
for kver in $(apt-cache search "linux-headers-.*-${arch}" | cut -d- -f3 | sort -u -V); do
apt-cache search 'linux-headers-'"${kver}"'-.*-'"${arch}" | sort -V | awk '{print $1}';
done | xargs apt-get install --yes --no-install-recommends || true
failed=""
succeeded=""
for kver in /lib/modules/*/build; do
test -d $kver || continue
kver=${kver%/build}
kver=${kver##*/}
echo "=== Testing ${kver} ===";
ret=$(make KERNELRELEASE="${kver}" >&2; echo $?);
if [ ${ret} -eq 0 ]; then
succeeded="${succeeded} ${kver}"
modinfo v4l2loopback.ko;
else
case " ${JOB_KNOWN_FAILURES} " in
*" ${kver%.*} "*)
echo "#### Skipped known failure ${kver}";
;;
*)
if grep -qE "^(CONFIG_VIDEO_DEV|CONFIG_VIDEO_V4L2)=" "${kver}/.config"; then
echo "#### Unexpected failure ${kver}";
failed="${failed} ${kver}";
else
echo "#### Skipped failure ${kver} (no v4l2 support)";
fi;
;;
esac;
fi;
make KERNELRELEASE="${kver}" clean || test ${ret} -ne 0
done
if [ "x${failed}" != "x" ]; then
echo "#### Failed kernels: ${failed}";
exit 1
fi
echo "#### Successful builds for kernels: ${succeeded}";