2021-10-01 13:09:20 +03:00
---
# vi: ts=2 sw=2 et:
2021-10-01 13:10:22 +03:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2023-03-29 11:42:23 +03:00
# Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.conf.d/.
2020-11-30 23:57:52 +03:00
name : mkosi
on :
push :
branches :
2021-01-21 16:52:18 +03:00
- main
2021-11-12 19:37:15 +03:00
- v[0-9]+-stable
2022-11-10 17:00:53 +03:00
paths :
- '**'
- '!README*'
- '!LICENSE*'
- '!LICENSES/**'
- '!TODO'
- '!docs/**'
- '!man/**'
- '!catalog/**'
- '!shell-completion/**'
- '!po/**'
- '!.**'
- '.github/**'
2020-11-30 23:57:52 +03:00
pull_request :
branches :
2021-01-21 16:52:18 +03:00
- main
2021-11-12 19:37:15 +03:00
- v[0-9]+-stable
2022-11-10 17:00:53 +03:00
paths :
- '**'
- '!README*'
- '!LICENSE*'
- '!LICENSES/**'
- '!TODO'
- '!docs/**'
- '!man/**'
- '!catalog/**'
- '!shell-completion/**'
- '!po/**'
- '!.**'
- '.github/**'
2020-11-30 23:57:52 +03:00
2021-11-14 01:34:04 +03:00
permissions :
contents : read
2021-11-13 17:40:20 +03:00
2020-11-30 23:57:52 +03:00
jobs :
ci :
2022-06-21 21:53:42 +03:00
runs-on : ubuntu-22.04
2021-11-10 18:45:12 +03:00
concurrency :
2022-03-07 18:18:42 +03:00
group : ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.release }}-${{ github.ref }}
2021-11-10 18:45:12 +03:00
cancel-in-progress : true
2020-11-30 23:57:52 +03:00
strategy :
fail-fast : false
matrix :
2022-02-04 14:10:33 +03:00
include :
2023-09-04 14:26:39 +03:00
- distro : arch
release : rolling
2022-02-04 14:10:33 +03:00
- distro : debian
release : testing
- distro : ubuntu
2024-01-26 00:48:55 +03:00
release : noble
2024-05-14 22:02:40 +03:00
- distro : fedora
release : "40"
2022-07-26 15:53:16 +03:00
- distro : fedora
release : rawhide
2024-03-26 12:42:00 +03:00
- distro : opensuse
release : tumbleweed
2023-01-10 14:04:10 +03:00
- distro : centos
2023-01-24 14:51:31 +03:00
release : "9"
2020-11-30 23:57:52 +03:00
steps :
2024-03-13 19:48:43 +03:00
- uses : actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
2024-05-28 16:56:13 +03:00
- uses : systemd/mkosi@8770a4e3390a68522f187acbcd33311040563fda
2020-11-30 23:57:52 +03:00
2024-03-15 22:25:01 +03: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 19:53:50 +03:00
- name : Free disk space
run : |
2024-03-15 22:25:01 +03: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 19:53:50 +03:00
2024-04-19 11:54:38 +03: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 12:57:39 +03:00
- name : Configure
2022-02-04 14:10:33 +03:00
run : |
2024-01-09 13:55:37 +03:00
tee mkosi.local.conf <<EOF
2022-02-04 14:10:33 +03:00
[ Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
2023-12-07 21:52:41 +03:00
[ Output]
# Build a disk image in CI as this logic is much more prone to breakage.
Format=disk
2024-04-19 11:54:38 +03:00
UseSubvolumes=yes
WorkspaceDirectory=$TMPDIR
PackageCacheDirectory=$TMPDIR/cache
[ Content]
Environment=
# 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 21:52:41 +03:00
2024-01-09 13:55:37 +03:00
[ Host]
ToolsTree=default
ToolsTreeDistribution=fedora
2024-05-16 18:18:38 +03:00
QemuMem=4G
2024-05-06 23:22:50 +03:00
# We build with debuginfo so there's no point in mounting the sources into the machine.
RuntimeBuildSources=no
2024-01-09 13:55:37 +03:00
EOF
2023-01-31 20:53:28 +03:00
- name : Generate secure boot key
2023-05-09 21:53:02 +03:00
run : mkosi --debug genkey
2023-01-31 20:53:28 +03:00
2023-08-30 20:58:14 +03:00
- name : Show image summary
2023-02-09 11:53:05 +03:00
run : mkosi summary
2021-05-19 22:29:42 +03:00
2024-04-19 11:54:38 +03: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 \
2024-05-03 13:56:50 +03:00
-Drepart=disabled \
2024-04-19 11:54:38 +03:00
-Dfirstboot=true \
-Dsysusers=true \
-Dtmpfiles=true \
-Dhwdb=true \
-Dvmspawn=enabled
- name : Build image
run : meson compile -C build mkosi
- name : Run integration tests
2024-05-30 13:41:34 +03:00
run : sudo --preserve-env meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
2024-04-19 11:54:38 +03:00
- name : Archive failed test journals
uses : actions/upload-artifact@v4
2024-04-25 20:50:38 +03:00
if : failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
2024-04-19 11:54:38 +03:00
with :
name : ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-failed-test-journals
path : |
build/test/journal/*.journal
2024-04-25 14:08:59 +03:00
build/meson-logs/*
2024-04-25 20:52:10 +03:00
retention-days : 7
2024-04-19 11:54:38 +03:00
- name : Archive packages
uses : actions/upload-artifact@v4
2024-04-25 20:50:38 +03:00
if : (success() || failure()) && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
2024-04-19 11:54:38 +03:00
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
2024-04-23 12:53:28 +03:00
build/mkosi.output/*.pkg.tar
2024-04-23 12:58:44 +03:00
retention-days : 4