diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b3ece13 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +# Inspired by https://github.com/rust-analyzer/rust-analyzer/blob/master/.github/workflows/ci.yaml +# but tweaked in several ways. If you make changes here, consider doing so across other +# repositories in e.g. ostreedev etc. +name: CI + +permissions: + actions: read + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install deps + run: sudo ./ci/installdeps.sh + - name: Build + run: make -C /usr/src/linux modules M=$PWD + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + path: ostreefs.ko + if-no-files-found: error + integration: + name: "Integration" + needs: build + runs-on: ubuntu-latest + steps: + - name: Download + uses: actions/download-artifact@v3 + with: + name: ostreefs.ko + - name: Run tests + run: sudo ci/tests.sh diff --git a/ci/installdeps.sh b/ci/installdeps.sh new file mode 100755 index 0000000..ccc4b6a --- /dev/null +++ b/ci/installdeps.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -xeuo pipefail +apt update -y +apt install -y linux-source flex bison openssl{,-dev} +cd /usr/src +src=$(ls /usr/src/linux-source*.tar*) +bn=$(basename ${src}) +d=${bn%.tar*} +if test '!' -d linux; then + tar xf "${src}" + cd "${d}" + make olddefconfig + make modules_prepare + cd - + mv ${d} linux +fi diff --git a/ci/tests.sh b/ci/tests.sh new file mode 100755 index 0000000..24c8498 --- /dev/null +++ b/ci/tests.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -xeuo pipefail +insmod ostreefs.ko