1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ paths :
8
+ - ' src/drivers/**'
9
+ pull_request :
10
+ types : [opened, synchronize]
11
+ paths :
12
+ - ' src/drivers/**'
13
+
14
+ env :
15
+ WORKSPACE : /home/runner
16
+
17
+ jobs :
18
+ build :
19
+ strategy :
20
+ matrix :
21
+ env :
22
+ - { RPI_LINUX_VER: rpi-4.1.y, CONFIG_FILE: config-4.1.21-v7+, RPI_LINUX_COMMIT_HASH: ff45bc0 }
23
+ - { RPI_LINUX_VER: rpi-4.4.y, CONFIG_FILE: config-4.4.38-v7+, RPI_LINUX_COMMIT_HASH: c95b7f1 }
24
+ - { RPI_LINUX_VER: rpi-4.14.y, CONFIG_FILE: config-4.14.34-v7+, RPI_LINUX_COMMIT_HASH: f70eae4 }
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v2
28
+
29
+ - name : Cache
30
+ uses : actions/cache@v1
31
+ with :
32
+ path : ${HOME}/repo/raspberrypi
33
+ key : ${{ runner.os }}-raspberrypi-cross-build-${{ matrix.env }}
34
+ restore-keys : |
35
+ ${{ runner.os }}-raspberrypi-cross-build-
36
+
37
+ - name : Install cross-build settings
38
+ id : cross-build
39
+ run : |
40
+ echo "::set-output name=driver-src-dir::$(echo ${GITHUB_WORKSPACE}/src/drivers)"
41
+ echo "::set-output name=repository-dir::$(echo ${GITHUB_WORKSPACE})"
42
+ mkdir -p ${HOME}/repo/raspberrypi
43
+ if [ -e ${HOME}/repo/raspberrypi/tools ]; then (cd ${HOME}/repo/raspberrypi/tools && git pull); else (cd ${HOME}/repo/raspberrypi && git clone --depth 1 https://github.com/raspberrypi/tools.git); fi
44
+
45
+ - name : Install kernel headers
46
+ env :
47
+ REPOSITORY_DIR : ${{ steps.cross-build.outputs.repository-dir }}
48
+ DRIVER_SRC_DIR : ${{ steps.cross-build.outputs.driver-src-dir }}
49
+ RPI_LINUX_VER : ${{ matrix.env.RPI_LINUX_VER }}
50
+ CONFIG_FILE : ${{ matrix.env.CONFIG_FILE }}
51
+ RPI_LINUX_COMMIT_HASH : ${{ matrix.env.RPI_LINUX_COMMIT_HASH }}
52
+ run : |
53
+ if [ -e ${HOME}/repo/raspberrypi/linux ]; then (cd ${HOME}/repo/raspberrypi/linux && git fetch origin && git checkout ${RPI_LINUX_VER} && git pull); else (cd ${HOME}/repo/raspberrypi && git clone -b ${RPI_LINUX_VER} https://github.com/raspberrypi/linux.git); fi
54
+ cd ${HOME}/repo/raspberrypi/linux && make clean && git reset --hard HEAD && git checkout $RPI_LINUX_COMMIT_HASH
55
+ cp "${REPOSITORY_DIR}/.test/${CONFIG_FILE}" ${HOME}/repo/raspberrypi/linux/.config
56
+ make CROSS_COMPILE=$HOME/repo/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- ARCH=arm oldconfig
57
+ make CROSS_COMPILE=$HOME/repo/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- ARCH=arm -j 8
58
+
59
+ - name : Build kernel module
60
+ env :
61
+ REPOSITORY_DIR : ${{ steps.cross-build.outputs.repository-dir }}
62
+ DRIVER_SRC_DIR : ${{ steps.cross-build.outputs.driver-src-dir }}
63
+ run : |
64
+ cd $DRIVER_SRC_DIR
65
+ make -f $REPOSITORY_DIR/.test/Makefile.crosscompile
66
+ make -f $REPOSITORY_DIR/.test/Makefile.crosscompile clean
0 commit comments