]> git.ipfire.org Git - thirdparty/systemd.git/blame - .github/workflows/mkosi.yml
mkosi: Restore job for F40
[thirdparty/systemd.git] / .github / workflows / mkosi.yml
CommitLineData
43d6fcc0
ZJS
1---
2# vi: ts=2 sw=2 et:
186b9041 3# SPDX-License-Identifier: LGPL-2.1-or-later
94c9855a 4# Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.conf.d/.
448d3462
DDM
5name: mkosi
6
448d3462
DDM
7on:
8 push:
9 branches:
9b25429c 10 - main
c76a8385 11 - v[0-9]+-stable
976ceafe
ZJS
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
448d3462
DDM
26 pull_request:
27 branches:
9b25429c 28 - main
c76a8385 29 - v[0-9]+-stable
976ceafe
ZJS
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/**'
448d3462 43
e7a96691
EV
44permissions:
45 contents: read
311956cc 46
448d3462
DDM
47jobs:
48 ci:
f304d038 49 runs-on: ubuntu-22.04
38848376 50 concurrency:
3a2f1d19 51 group: ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.release }}-${{ github.ref }}
38848376 52 cancel-in-progress: true
448d3462
DDM
53 strategy:
54 fail-fast: false
55 matrix:
24a0df5c 56 include:
16173ab1
DDM
57 - distro: arch
58 release: rolling
24a0df5c
DDM
59 - distro: debian
60 release: testing
61 - distro: ubuntu
4d0f1451 62 release: noble
f222ef10
ZJS
63 - distro: fedora
64 release: "40"
2d625795
DDM
65 - distro: fedora
66 release: rawhide
c2720fa5
DDM
67 - distro: opensuse
68 release: tumbleweed
9d2e4cee 69 - distro: centos
c8943ce8 70 release: "9"
448d3462
DDM
71
72 steps:
e065f1c4 73 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
23d79a84 74 - uses: systemd/mkosi@55f17a8ae67ece9712324c3107804daad94ad0d9
448d3462 75
e48c170f
DDM
76 # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
77 # immediately, we remove the files in the background. However, we first move them to a different location
78 # so that nothing tries to use anything in these directories anymore while we're busy deleting them.
5e39dc2f
LB
79 - name: Free disk space
80 run: |
e48c170f
DDM
81 sudo mv /usr/local /usr/local.trash
82 sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
83 sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
5e39dc2f 84
42212407
DDM
85 - name: Btrfs
86 run: |
87 truncate --size=100G btrfs.raw
88 mkfs.btrfs btrfs.raw
89 sudo mkdir /mnt/mkosi
90 LOOP="$(sudo losetup --find --show --direct-io=on btrfs.raw)"
91 sudo mount "$LOOP" /mnt/mkosi --options compress=zstd:1,user_subvol_rm_allowed,noatime,discard=async,space_cache=v2
92 sudo chown "$(id -u):$(id -g)" /mnt/mkosi
93 mkdir /mnt/mkosi/tmp
94 echo "TMPDIR=/mnt/mkosi/tmp" >>"$GITHUB_ENV"
95 ln -s /mnt/mkosi/build build
96
7e99216c 97 - name: Configure
24a0df5c 98 run: |
8c018edb 99 tee mkosi.local.conf <<EOF
24a0df5c
DDM
100 [Distribution]
101 Distribution=${{ matrix.distro }}
102 Release=${{ matrix.release }}
103
52842bb2
DDM
104 [Output]
105 # Build a disk image in CI as this logic is much more prone to breakage.
106 Format=disk
42212407
DDM
107 UseSubvolumes=yes
108
109 WorkspaceDirectory=$TMPDIR
110 PackageCacheDirectory=$TMPDIR/cache
111
112 [Content]
113 Environment=
114 # mkfs.erofs is extremely noisy when not connected to a tty.
115 SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet"
116 # Build debuginfo packages since we'll be publishing the packages as artifacts.
117 WITH_DEBUG=1
118 # Enabling optimizations significantly speeds up integration tests.
119 OPTIMIZATION=g
52842bb2 120
8c018edb
DDM
121 [Host]
122 ToolsTree=default
123 ToolsTreeDistribution=fedora
e399efea
DDM
124 # TODO: Drop once https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2038777 is fixed in Github Actions
125 QemuFirmware=uefi
7681a8ee
DDM
126 # We build with debuginfo so there's no point in mounting the sources into the machine.
127 RuntimeBuildSources=no
8c018edb
DDM
128 EOF
129
130 # These should override the options from mkosi.conf so we put them in a dropin that's ordered later
131 # instead.
132 tee mkosi.conf.d/99-ci.conf <<EOF
35356d7f 133 [Host]
42212407 134 KernelCommandLineExtra=
42212407
DDM
135 # Root device can take a long time to appear, so let's bump the timeout.
136 systemd.default_device_timeout_sec=180
24a0df5c 137 EOF
6242cda9 138
2de6cc18 139 - name: Generate secure boot key
93a94886 140 run: mkosi --debug genkey
2de6cc18 141
bc763971 142 - name: Show image summary
c9853672 143 run: mkosi summary
715a273b 144
42212407
DDM
145 - name: Install build dependencies
146 run: |
147 sudo apt-get install \
148 meson \
149 gperf \
150 libfdisk-dev \
151 libtss2-dev \
152 libblkid-dev \
153 libmicrohttpd-dev \
154 libcap-dev \
155 libcurl4-openssl-dev \
156 libcryptsetup-dev \
157 erofs-utils \
158 dosfstools \
159 python3-pefile \
160 sbsigntool \
161 mtools
162
163 - name: Configure meson
164 run: |
165 meson setup build \
166 --buildtype=debugoptimized \
167 -Dintegration-tests=true \
168 -Dremote=enabled \
169 -Dopenssl=enabled \
170 -Dblkid=enabled \
171 -Dtpm2=enabled \
172 -Dlibcryptsetup=enabled \
173 -Dlibcurl=enabled \
ffda3c3d 174 -Drepart=disabled \
42212407
DDM
175 -Dfirstboot=true \
176 -Dsysusers=true \
177 -Dtmpfiles=true \
178 -Dhwdb=true \
179 -Dvmspawn=enabled
180
181 - name: Build image
182 run: meson compile -C build mkosi
183
184 - name: Run integration tests
eabf46ef 185 run: meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
42212407
DDM
186
187 - name: Archive failed test journals
188 uses: actions/upload-artifact@v4
4becd5fb 189 if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
42212407
DDM
190 with:
191 name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-failed-test-journals
192 path: |
193 build/test/journal/*.journal
292110aa 194 build/meson-logs/*
17310088 195 retention-days: 7
42212407
DDM
196
197 - name: Archive packages
198 uses: actions/upload-artifact@v4
4becd5fb 199 if: (success() || failure()) && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
42212407
DDM
200 with:
201 name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-packages
202 path: |
203 build/mkosi.output/*.rpm
204 build/mkosi.output/*.deb
205 build/mkosi.output/*.ddeb
279b3d46 206 build/mkosi.output/*.pkg.tar
5841b5af 207 retention-days: 4