]> git.ipfire.org Git - thirdparty/systemd.git/blob - .github/workflows/mkosi.yml
core: rename SoftRebootStartTimestamp -> ShutdownStartTimestamp and generalize
[thirdparty/systemd.git] / .github / workflows / mkosi.yml
1 ---
2 # vi: ts=2 sw=2 et:
3 # SPDX-License-Identifier: LGPL-2.1-or-later
4 # Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.conf.d/.
5 name: mkosi
6
7 on:
8 push:
9 branches:
10 - main
11 - v[0-9]+-stable
12 paths:
13 - '**'
14 - '!README*'
15 - '!LICENSE*'
16 - '!LICENSES/**'
17 - '!TODO'
18 - '!docs/**'
19 - '!man/**'
20 - '!catalog/**'
21 - '!shell-completion/**'
22 - '!po/**'
23 - '!.**'
24 - '.github/**'
25
26 pull_request:
27 branches:
28 - main
29 - v[0-9]+-stable
30 paths:
31 - '**'
32 - '!README*'
33 - '!LICENSE*'
34 - '!LICENSES/**'
35 - '!TODO'
36 - '!docs/**'
37 - '!man/**'
38 - '!catalog/**'
39 - '!shell-completion/**'
40 - '!po/**'
41 - '!.**'
42 - '.github/**'
43
44 permissions:
45 contents: read
46
47 jobs:
48 ci:
49 runs-on: ubuntu-22.04
50 concurrency:
51 group: ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.release }}-${{ github.ref }}
52 cancel-in-progress: true
53 strategy:
54 fail-fast: false
55 matrix:
56 include:
57 - distro: arch
58 release: rolling
59 - distro: debian
60 release: testing
61 - distro: ubuntu
62 release: noble
63 - distro: fedora
64 release: "39"
65 - distro: fedora
66 release: rawhide
67 - distro: opensuse
68 release: tumbleweed
69 - distro: centos
70 release: "9"
71
72 env:
73 SYSTEMD_LOG_LEVEL: debug
74
75 steps:
76 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
77 - uses: systemd/mkosi@a845d4108ac87ca443bd1ad78ab53520bffd2eda
78
79 # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
80 # immediately, we remove the files in the background. However, we first move them to a different location
81 # so that nothing tries to use anything in these directories anymore while we're busy deleting them.
82 - name: Free disk space
83 run: |
84 sudo mv /usr/local /usr/local.trash
85 sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
86 sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
87
88 - name: Configure
89 run: |
90 tee mkosi.local.conf <<EOF
91 [Distribution]
92 Distribution=${{ matrix.distro }}
93 Release=${{ matrix.release }}
94
95 [Output]
96 # Build a disk image in CI as this logic is much more prone to breakage.
97 Format=disk
98
99 [Host]
100 ToolsTree=default
101 ToolsTreeDistribution=fedora
102 QemuVsock=yes
103 QemuKvm=yes
104 # TODO: Drop once https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2038777 is fixed in Github Actions
105 QemuFirmware=uefi
106 Ephemeral=yes
107 EOF
108
109 # These should override the options from mkosi.conf so we put them in a dropin that's ordered later
110 # instead.
111 tee mkosi.conf.d/99-ci.conf <<EOF
112 [Host]
113 KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
114 systemd.log_level=debug
115 systemd.journald.max_level_console=debug
116 # udev's debug log output is very verbose, so up it to info in CI.
117 udev.log_level=info
118 # Root device can take a long time to appear, so let's bump the timeout.
119 systemd.default_device_timeout_sec=180
120 EOF
121
122 # For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
123 # version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
124
125 mkdir -p mkosi.images/system/mkosi.repart/10-usr.conf.d
126 tee mkosi.images/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<EOF
127 [Partition]
128 Format=squashfs
129 EOF
130
131 # The emergency shell is not useful in the CI, as it just blocks for a long time before the job
132 # eventually times out. Override it to just shutdown immediately.
133 mkdir -p mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
134 mkdir -p mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
135 tee mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<EOF
136 [Unit]
137 FailureAction=exit
138 [Service]
139 ExecStartPre=
140 ExecStart=
141 ExecStart=false
142 EOF
143 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
144
145 - name: Generate secure boot key
146 run: mkosi --debug genkey
147
148 - name: Show image summary
149 run: mkosi summary
150
151 - name: Build
152 run: mkosi --debug
153
154 - name: Boot systemd-nspawn
155 run: test "$(sudo mkosi --debug boot 1>&2; echo $?)" -eq 123
156
157 - name: Boot QEMU
158 run: timeout -k 30 10m test "$(mkosi --debug qemu 1>&2; echo $?)" -eq 123