|
| 1 | +name: kernel-build-test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + arch: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + toolchain: |
| 10 | + type: string |
| 11 | + default: gcc |
| 12 | + distro: |
| 13 | + type: string |
| 14 | + required: true |
| 15 | + runs_on: |
| 16 | + description: 'JSON-encoded runner label array, e.g. ["ubuntu-24.04"]' |
| 17 | + type: string |
| 18 | + default: '["ubuntu-24.04"]' |
| 19 | + timeout_minutes: |
| 20 | + type: number |
| 21 | + default: 90 |
| 22 | + test_suite: |
| 23 | + type: string |
| 24 | + required: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-and-test: |
| 28 | + runs-on: ${{ fromJSON(inputs.runs_on) }} |
| 29 | + timeout-minutes: ${{ inputs.timeout_minutes }} |
| 30 | + env: |
| 31 | + MKOSI_KERNEL: "${{ github.workspace }}/../mkosi-kernel" |
| 32 | + MKOSI_FSTESTS: "${{ github.workspace }}/../fstests" |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v6 |
| 35 | + |
| 36 | + - uses: systemd/mkosi@56d5ed4247deb3d0b11f7a6aec5a1a9f580ccde5 |
| 37 | + |
| 38 | + - name: Clone mkosi-kernel |
| 39 | + run: git clone --depth=1 https://github.com/DaanDeMeyer/mkosi-kernel.git "$MKOSI_KERNEL" |
| 40 | + |
| 41 | + - name: Clone fstests |
| 42 | + if: inputs.test_suite != 'selftests' |
| 43 | + run: | |
| 44 | + git clone --depth=1 https://github.com/kdave/xfstests.git "$MKOSI_FSTESTS" |
| 45 | + if [ "${{ inputs.test_suite }}" = "ovl-fstests" ]; then |
| 46 | + git clone --depth=1 https://github.com/amir73il/unionmount-testsuite.git "$MKOSI_FSTESTS/src/unionmount-testsuite" |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Configure mkosi |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | + cp -av ci/mkosi/mkosi.kernel.config "${MKOSI_KERNEL}/" |
| 53 | + cp -avr ci/mkosi/mkosi.extra/. "${MKOSI_KERNEL}/mkosi.extra/" |
| 54 | + cp -avr ci/mkosi/mkosi.repart "${MKOSI_KERNEL}/" |
| 55 | + mkdir -p "${MKOSI_KERNEL}/mkosi.conf.d" |
| 56 | + cp -av ci/mkosi/mkosi.conf.d/99-vfs.conf "${MKOSI_KERNEL}/mkosi.conf.d/" |
| 57 | + if [ "${{ inputs.test_suite }}" != "selftests" ]; then |
| 58 | + cp -av ci/mkosi/mkosi.conf.d/99-vfs-fstests.conf "${MKOSI_KERNEL}/mkosi.conf.d/" |
| 59 | + fi |
| 60 | +
|
| 61 | + if [ "${{ inputs.test_suite }}" = "ovl-fstests" ]; then |
| 62 | + cp -av ci/mkosi/mkosi.conf.d/99-vfs-ovl.conf "${MKOSI_KERNEL}/mkosi.conf.d/" |
| 63 | + fi |
| 64 | +
|
| 65 | + cat > "${MKOSI_KERNEL}/mkosi.local.conf" <<EOF |
| 66 | + [Distribution] |
| 67 | + Distribution=${{ inputs.distro }} |
| 68 | + EOF |
| 69 | + mkosi --directory="${MKOSI_KERNEL}" genkey |
| 70 | +
|
| 71 | + - name: Run mkosi summary |
| 72 | + run: mkosi --directory="${MKOSI_KERNEL}" summary |
| 73 | + |
| 74 | + - name: Build image and kernel |
| 75 | + run: mkosi --directory="${MKOSI_KERNEL}" build |
| 76 | + |
| 77 | + - name: Run ${{ inputs.test_suite }} |
| 78 | + run: | |
| 79 | + set -euo pipefail |
| 80 | +
|
| 81 | + case "${{ inputs.test_suite }}" in |
| 82 | + selftests) unit=vfs-selftests.service ;; |
| 83 | + xfstests) unit=xfs-fstests.service ;; |
| 84 | + ovl-fstests) unit=ovl-fstests.service ;; |
| 85 | + esac |
| 86 | +
|
| 87 | + rc=0 |
| 88 | + mkosi --directory="${MKOSI_KERNEL}" box -- mkosi --directory="${MKOSI_KERNEL}" --kernel-command-line-extra=systemd.unit="$unit" qemu || rc=$? |
| 89 | +
|
| 90 | + if [ "$rc" -ne 123 ]; then |
| 91 | + echo "::error::Tests failed (exit code $rc)" |
| 92 | + exit 1 |
| 93 | + fi |
0 commit comments