diff --git a/.github/workflows/Makefile b/.github/workflows/Makefile new file mode 100644 index 0000000..3d38687 --- /dev/null +++ b/.github/workflows/Makefile @@ -0,0 +1,9 @@ +MODULENAME=kmod + +obj-m += $(MODULENAME).o + +module: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean diff --git a/.github/workflows/kmod.c b/.github/workflows/kmod.c new file mode 100644 index 0000000..b04f058 --- /dev/null +++ b/.github/workflows/kmod.c @@ -0,0 +1,16 @@ +#include + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("test"); + +static int devnode_dev_const_init(void) +{ + return 0; +} + +static void devnode_dev_const_exit(void) +{ +} + +module_init(devnode_dev_const_init); +module_exit(devnode_dev_const_exit); diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adfba91..126e999 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,38 +9,40 @@ jobs: test-composite-action: runs-on: ubuntu-latest steps: - - name: Echo kernelrelease - run: uname -a - + - uses: actions/checkout@v4 + - name: Test action uses: ./ with: cache: 'true' - - name: Check kernel sources - run: ls -la /usr/src + - name: Check that a fake module can be built + working-directory: .github/workflows + run: make test-composite-action-cached: runs-on: ubuntu-latest needs: test-composite-action steps: - - name: Echo kernelrelease - run: uname -a - + - uses: actions/checkout@v4 + - name: Store KERNEL_RELEASE shell: bash run: | - echo "KERNEL_RELEASE=$(uname -r)" >> $GITHUB_ENV - - - name: Check kernel sources (empty) - run: ls -la /usr/src + echo "KERNEL_RELEASE=$(uname -r)" >> $GITHUB_ENV - - name: Retrieve cached kernel sources + - name: Test that kernel sources are cached uses: actions/cache@v4 with: path: | /usr/src/linux - key: ${{ runner.os }}-${{ runner.arch }}-${{env.KERNEL_RELEASE}} + key: ${{ runner.os }}-${{ runner.arch }}-${{env.KERNEL_RELEASE}} + + - name: Fully restore through action + uses: ./ + with: + cache: 'true' - - name: Check kernel sources again - run: ls -la /usr/src + - name: Check that a fake module can be built again + working-directory: .github/workflows + run: make