]> git.ipfire.org Git - thirdparty/systemd.git/blob - .github/workflows/mkosi.yml
Merge pull request #30904 from YHNdnzj/no-selinux-reload
[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: jammy
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 - distro: centos
72 release: "8"
73
74 env:
75 SYSTEMD_LOG_LEVEL: debug
76
77 steps:
78 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
79 - uses: systemd/mkosi@dbce89aabda438ba58080366631b2c242e365f21
80
81 - name: Configure
82 run: |
83 tee mkosi.local.conf <<EOF
84 [Distribution]
85 Distribution=${{ matrix.distro }}
86 Release=${{ matrix.release }}
87
88 [Output]
89 # Build a disk image in CI as this logic is much more prone to breakage.
90 Format=disk
91
92 [Content]
93 Environment=CI_BUILD=1
94 SLOW_TESTS=true
95
96 [Host]
97 ToolsTree=default
98 ToolsTreeDistribution=fedora
99 QemuVsock=yes
100 # Sometimes we run on a host with /dev/kvm, but it is broken, so explicitly disable it
101 QemuKvm=no
102 Ephemeral=yes
103 EOF
104
105 # These should override the options from mkosi.conf so we put them in a dropin that's ordered later
106 # instead.
107 tee mkosi.conf.d/99-ci.conf <<EOF
108 [Host]
109 KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
110 systemd.journald.max_level_console=debug
111 # udev's debug log output is very verbose, so up it to info in CI.
112 udev.log_level=info
113 # Root device can take a long time to appear, so let's bump the timeout.
114 systemd.default_device_timeout_sec=180
115 EOF
116
117 # For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
118 # version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
119
120 mkdir -p mkosi.images/system/mkosi.repart/10-usr.conf.d
121 tee mkosi.images/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<EOF
122 [Partition]
123 Format=squashfs
124 EOF
125
126 # The emergency shell is not useful in the CI, as it just blocks for a long time before the job
127 # eventually times out. Override it to just shutdown immediately.
128 mkdir -p mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
129 mkdir -p mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
130 tee mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<EOF
131 [Unit]
132 FailureAction=exit
133 [Service]
134 ExecStartPre=
135 ExecStart=
136 ExecStart=false
137 EOF
138 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
139
140 - name: Generate secure boot key
141 run: mkosi --debug genkey
142
143 - name: Show image summary
144 run: mkosi summary
145
146 - name: Build
147 run: mkosi --debug
148
149 - name: Boot systemd-nspawn
150 run: test "$(sudo mkosi --debug boot 1>&2; echo $?)" -eq 123
151
152 - name: Boot QEMU
153 run: timeout -k 30 10m test "$(mkosi --debug qemu 1>&2; echo $?)" -eq 123