]> git.ipfire.org Git - thirdparty/systemd.git/blame - .github/workflows/mkosi.yml
ci: Reduce the number of integration tests we run concurrently
[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
24a0df5c 63 - distro: fedora
755012d3 64 release: "39"
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
86e249f3 74 - uses: systemd/mkosi@22d212dcb229b553572578ef16c809f9a9961ee8
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
8c018edb
DDM
126 EOF
127
128 # These should override the options from mkosi.conf so we put them in a dropin that's ordered later
129 # instead.
130 tee mkosi.conf.d/99-ci.conf <<EOF
35356d7f 131 [Host]
42212407 132 KernelCommandLineExtra=
42212407
DDM
133 # Root device can take a long time to appear, so let's bump the timeout.
134 systemd.default_device_timeout_sec=180
24a0df5c 135 EOF
6242cda9 136
2de6cc18 137 - name: Generate secure boot key
93a94886 138 run: mkosi --debug genkey
2de6cc18 139
bc763971 140 - name: Show image summary
c9853672 141 run: mkosi summary
715a273b 142
42212407
DDM
143 - name: Install build dependencies
144 run: |
145 sudo apt-get install \
146 meson \
147 gperf \
148 libfdisk-dev \
149 libtss2-dev \
150 libblkid-dev \
151 libmicrohttpd-dev \
152 libcap-dev \
153 libcurl4-openssl-dev \
154 libcryptsetup-dev \
155 erofs-utils \
156 dosfstools \
157 python3-pefile \
158 sbsigntool \
159 mtools
160
161 - name: Configure meson
162 run: |
163 meson setup build \
164 --buildtype=debugoptimized \
165 -Dintegration-tests=true \
166 -Dremote=enabled \
167 -Dopenssl=enabled \
168 -Dblkid=enabled \
169 -Dtpm2=enabled \
170 -Dlibcryptsetup=enabled \
171 -Dlibcurl=enabled \
ffda3c3d 172 -Drepart=disabled \
42212407
DDM
173 -Dfirstboot=true \
174 -Dsysusers=true \
175 -Dtmpfiles=true \
176 -Dhwdb=true \
177 -Dvmspawn=enabled
178
179 - name: Build image
180 run: meson compile -C build mkosi
181
182 - name: Run integration tests
eabf46ef 183 run: meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
42212407
DDM
184
185 - name: Archive failed test journals
186 uses: actions/upload-artifact@v4
4becd5fb 187 if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
42212407
DDM
188 with:
189 name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-failed-test-journals
190 path: |
191 build/test/journal/*.journal
292110aa 192 build/meson-logs/*
17310088 193 retention-days: 7
42212407
DDM
194
195 - name: Archive packages
196 uses: actions/upload-artifact@v4
4becd5fb 197 if: (success() || failure()) && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
42212407
DDM
198 with:
199 name: ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-packages
200 path: |
201 build/mkosi.output/*.rpm
202 build/mkosi.output/*.deb
203 build/mkosi.output/*.ddeb
279b3d46 204 build/mkosi.output/*.pkg.tar
5841b5af 205 retention-days: 4