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
steps :
2024-03-13 16:48:43 +00:00
- uses : actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
2024-04-22 15:26:35 +02:00
- uses : systemd/mkosi@8cbde8a4ed20a078ad5c70fe38c0dd2294a68bb1
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
2024-04-19 10:54:38 +02:00
- name : Btrfs
run : |
truncate --size=100G btrfs.raw
mkfs.btrfs btrfs.raw
sudo mkdir /mnt/mkosi
LOOP="$(sudo losetup --find --show --direct-io=on btrfs.raw)"
sudo mount "$LOOP" /mnt/mkosi --options compress=zstd:1,user_subvol_rm_allowed,noatime,discard=async,space_cache=v2
sudo chown "$(id -u):$(id -g)" /mnt/mkosi
mkdir /mnt/mkosi/tmp
echo "TMPDIR=/mnt/mkosi/tmp" >>"$GITHUB_ENV"
ln -s /mnt/mkosi/build build
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-04-19 10:54:38 +02:00
UseSubvolumes=yes
WorkspaceDirectory=$TMPDIR
PackageCacheDirectory=$TMPDIR/cache
[ Content]
Environment=
# mkfs.erofs is extremely noisy when not connected to a tty.
SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet"
# Build debuginfo packages since we'll be publishing the packages as artifacts.
WITH_DEBUG=1
# Enabling optimizations significantly speeds up integration tests.
OPTIMIZATION=g
2023-12-07 19:52:41 +01:00
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
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]
2024-04-19 10:54:38 +02:00
KernelCommandLineExtra=
# udev's debug log output is very verbose, so up it to info in CI.
udev.log_level=info
# 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-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
2024-04-19 10:54:38 +02:00
- name : Install build dependencies
run : |
sudo apt-get install \
meson \
gperf \
libfdisk-dev \
libtss2-dev \
libblkid-dev \
libmicrohttpd-dev \
libcap-dev \
libcurl4-openssl-dev \
libcryptsetup-dev \
erofs-utils \
dosfstools \
python3-pefile \
sbsigntool \
mtools
- name : Configure meson
run : |
meson setup build \
--buildtype=debugoptimized \
-Dintegration-tests=true \
-Dremote=enabled \
-Dopenssl=enabled \
-Dblkid=enabled \
-Dtpm2=enabled \
-Dlibcryptsetup=enabled \
-Dlibcurl=enabled \
-Drepart=enabled \
-Dfirstboot=true \
-Dsysusers=true \
-Dtmpfiles=true \
-Dhwdb=true \
-Dvmspawn=enabled
- name : Build image
run : meson compile -C build mkosi
- name : Run integration tests
run : meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit
- name : Archive failed test journals
uses : actions/upload-artifact@v4
if : failure()
with :
name : ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-failed-test-journals
path : |
build/test/journal/*.journal
- name : Archive packages
uses : actions/upload-artifact@v4
if : success() || failure()
with :
name : ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-packages
path : |
build/mkosi.output/*.rpm
build/mkosi.output/*.deb
build/mkosi.output/*.ddeb
build/mkosi.output/*.tar.pkg