2021-10-01 12:09:20 +02:00
---
# vi: ts=2 sw=2 et:
2021-10-01 12:10:22 +02:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2023-03-29 10:42:23 +02:00
# Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.conf.d/.
2020-11-30 20:57:52 +00:00
name : mkosi
on :
push :
branches :
2021-01-21 13:52:18 +00:00
- main
2021-11-12 17:37:15 +01:00
- v[0-9]+-stable
2022-11-10 15:00:53 +01:00
paths :
- '**'
- '!README*'
- '!LICENSE*'
- '!LICENSES/**'
- '!TODO'
- '!docs/**'
- '!man/**'
- '!catalog/**'
- '!shell-completion/**'
- '!po/**'
- '!.**'
- '.github/**'
2020-11-30 20:57:52 +00:00
pull_request :
branches :
2021-01-21 13:52:18 +00:00
- main
2021-11-12 17:37:15 +01:00
- v[0-9]+-stable
2022-11-10 15:00:53 +01:00
paths :
- '**'
- '!README*'
- '!LICENSE*'
- '!LICENSES/**'
- '!TODO'
- '!docs/**'
- '!man/**'
- '!catalog/**'
- '!shell-completion/**'
- '!po/**'
- '!.**'
- '.github/**'
2020-11-30 20:57:52 +00:00
2021-11-13 22:34:04 +00:00
permissions :
contents : read
2021-11-13 14:40:20 +00:00
2020-11-30 20:57:52 +00:00
jobs :
ci :
2022-06-21 20:53:42 +02:00
runs-on : ubuntu-22.04
2021-11-10 16:45:12 +01:00
concurrency :
2022-03-07 16:18:42 +01:00
group : ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.release }}-${{ github.ref }}
2021-11-10 16:45:12 +01:00
cancel-in-progress : true
2020-11-30 20:57:52 +00:00
strategy :
fail-fast : false
matrix :
2022-02-04 11:10:33 +00:00
include :
2023-09-04 13:26:39 +02:00
- distro : arch
release : rolling
2022-02-04 11:10:33 +00:00
- distro : debian
release : testing
- distro : ubuntu
2024-01-25 22:48:55 +01:00
release : noble
2022-02-04 11:10:33 +00:00
- distro : fedora
2023-09-19 11:47:41 +02:00
release : "39"
2022-07-26 14:53:16 +02:00
- distro : fedora
release : rawhide
2024-03-26 10:42:00 +01:00
- distro : opensuse
release : tumbleweed
2023-01-10 12:04:10 +01:00
- distro : centos
2023-01-24 12:51:31 +01:00
release : "9"
2020-11-30 20:57:52 +00:00
2023-05-09 20:53:02 +02:00
env :
SYSTEMD_LOG_LEVEL : debug
2020-11-30 20:57:52 +00:00
steps :
2024-03-13 16:48:43 +00:00
- uses : actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
2024-04-14 19:53:09 +02:00
- uses : systemd/mkosi@5fd70560a1b1ac854b9e1c5a450df311f9000121
2020-11-30 20:57:52 +00:00
2024-03-15 20:25:01 +01:00
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
# immediately, we remove the files in the background. However, we first move them to a different location
# so that nothing tries to use anything in these directories anymore while we're busy deleting them.
2024-03-01 16:53:50 +00:00
- name : Free disk space
run : |
2024-03-15 20:25:01 +01:00
sudo mv /usr/local /usr/local.trash
sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
2024-03-01 16:53:50 +00:00
2021-09-17 10:57:39 +01:00
- name : Configure
2022-02-04 11:10:33 +00:00
run : |
2024-01-09 11:55:37 +01:00
tee mkosi.local.conf <<EOF
2022-02-04 11:10:33 +00:00
[ Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
2023-12-07 19:52:41 +01:00
[ Output]
# Build a disk image in CI as this logic is much more prone to breakage.
Format=disk
2024-01-09 11:55:37 +01:00
[ Host]
ToolsTree=default
ToolsTreeDistribution=fedora
QemuVsock=yes
2024-03-13 14:18:03 +01:00
QemuKvm=yes
# TODO: Drop once https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2038777 is fixed in Github Actions
QemuFirmware=uefi
2024-01-09 11:55:37 +01:00
Ephemeral=yes
EOF
# These should override the options from mkosi.conf so we put them in a dropin that's ordered later
# instead.
tee mkosi.conf.d/99-ci.conf <<EOF
2023-09-01 13:58:16 +02:00
[ Host]
2023-03-16 18:28:14 +01:00
KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
2024-04-11 19:40:16 +02:00
systemd.log_level=debug
2023-03-16 18:28:14 +01:00
systemd.journald.max_level_console=debug
2023-03-21 10:01:09 +01:00
# udev's debug log output is very verbose, so up it to info in CI.
udev.log_level=info
2023-05-31 16:19:21 +02:00
# Root device can take a long time to appear, so let's bump the timeout.
systemd.default_device_timeout_sec=180
2022-02-04 11:10:33 +00:00
EOF
2021-01-03 16:05:06 +01:00
2023-05-08 16:06:41 +02:00
# For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
# version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
2023-11-28 18:38:22 +01:00
mkdir -p mkosi.images/system/mkosi.repart/10-usr.conf.d
2024-01-09 11:55:37 +01:00
tee mkosi.images/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<EOF
2023-05-08 16:06:41 +02:00
[ Partition]
Format=squashfs
EOF
2023-07-26 12:36:40 +01:00
# The emergency shell is not useful in the CI, as it just blocks for a long time before the job
# eventually times out. Override it to just shutdown immediately.
2023-11-28 18:38:22 +01:00
mkdir -p mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
mkdir -p mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
2024-01-09 11:55:37 +01:00
tee mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<EOF
2023-07-26 12:36:40 +01:00
[ Unit]
FailureAction=exit
[ Service]
ExecStartPre=
ExecStart=
ExecStart=false
EOF
2023-11-28 18:38:22 +01:00
cp mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf
2023-07-26 12:36:40 +01:00
2023-01-31 18:53:28 +01:00
- name : Generate secure boot key
2023-05-09 20:53:02 +02:00
run : mkosi --debug genkey
2023-01-31 18:53:28 +01:00
2023-08-30 19:58:14 +02:00
- name : Show image summary
2023-02-09 09:53:05 +01:00
run : mkosi summary
2021-05-19 21:29:42 +02:00
2023-08-30 19:58:14 +02:00
- name : Build
2023-05-09 20:53:02 +02:00
run : mkosi --debug
2023-04-23 14:53:11 +02:00
2023-08-30 19:58:14 +02:00
- name : Boot systemd-nspawn
2023-06-08 17:50:05 +02:00
run : test "$(sudo mkosi --debug boot 1>&2; echo $?)" -eq 123
2021-12-08 19:31:25 +01:00
2023-08-30 19:58:14 +02:00
- name : Boot QEMU
2023-06-08 17:50:05 +02:00
run : timeout -k 30 10m test "$(mkosi --debug qemu 1>&2; echo $?)" -eq 123