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 :
2024-08-19 11:27:11 +02:00
- "**"
- "!README*"
- "!LICENSE*"
- "!LICENSES/**"
- "!TODO"
- "!docs/**"
- "!man/**"
- "!catalog/**"
- "!shell-completion/**"
- "!po/**"
- "!.**"
- ".github/**"
2022-11-10 15:00:53 +01:00
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 :
2024-08-19 11:27:11 +02:00
- "**"
- "!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 :
2024-06-07 10:55:53 +02:00
runs-on : ubuntu-24.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
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-O2 -D_FORTIFY_SOURCE=3"
2024-07-09 12:26:11 +02:00
relabel : no
2022-02-04 11:10:33 +00:00
- distro : debian
release : testing
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : no
2022-02-04 11:10:33 +00:00
- distro : ubuntu
2024-01-25 22:48:55 +01:00
release : noble
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : no
2024-05-14 21:02:40 +02:00
- distro : fedora
2024-10-07 09:49:38 +02:00
release : "41"
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : yes
2022-07-26 14:53:16 +02:00
- distro : fedora
release : rawhide
2024-05-16 17:20:24 +02:00
sanitizers : address,undefined
2024-06-01 15:14:08 +02:00
llvm : 1
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : yes
2024-03-26 10:42:00 +01:00
- distro : opensuse
release : tumbleweed
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : no
2023-01-10 12:04:10 +01:00
- distro : centos
2023-01-24 12:51:31 +01:00
release : "9"
2024-05-16 17:20:24 +02:00
sanitizers : ""
2024-06-01 15:14:08 +02:00
llvm : 0
2024-06-04 12:27:29 +02:00
cflags : "-Og"
2024-07-09 12:26:11 +02:00
relabel : yes
2024-07-11 15:49:17 +02:00
- distro : centos
release : "10"
sanitizers : ""
llvm : 0
cflags : "-Og"
relabel : yes
2020-11-30 20:57:52 +00:00
steps :
2024-10-01 09:17:05 +00:00
- uses : actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
2024-10-01 12:54:11 +00:00
- uses : systemd/mkosi@3454f7bd4ef0336ec80a117d593baaef0fe53398
2024-08-19 11:27:11 +02: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.
- name : Free disk space
run : |
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
- 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
- name : Configure
run : |
# XXX: drop after the HyperV bug that breaks secure boot KVM guests is solved
sed -i "s/'firmware'\s*:\s*'auto'/'firmware' : 'uefi'/g" test/*/meson.build
tee mkosi.local.conf <<EOF
[ Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
[ Output]
# Build a disk image in CI as this logic is much more prone to breakage.
Format=disk
UseSubvolumes=yes
WorkspaceDirectory=$TMPDIR
PackageCacheDirectory=$TMPDIR/cache
[ Content]
Environment=
# Build debuginfo packages since we'll be publishing the packages as artifacts.
WITH_DEBUG=1
CFLAGS="${{ matrix.cflags }}"
SANITIZERS=${{ matrix.sanitizers }}
MESON_OPTIONS=--werror
LLVM=${{ matrix.llvm }}
SYSEXT=1
SELinuxRelabel=${{ matrix.relabel }}
[ Host]
QemuMem=4G
EOF
- name : Generate secure boot key
run : mkosi --debug genkey
- name : Show image summary
run : mkosi summary
- name : Install dependencies
run : |
mkosi dependencies |
xargs -d '\n' sudo apt-get install \
gperf \
libblkid-dev \
libcap-dev \
libcryptsetup-dev \
libcurl4-openssl-dev \
libfdisk-dev \
libmicrohttpd-dev \
libmount-dev \
libtss2-dev \
meson
- 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 : sudo meson compile -C build mkosi
- name : Run integration tests
run : sudo --preserve-env meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
- name : Archive failed test journals
uses : actions/upload-artifact@v4
if : failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
with :
name : ci-mkosi-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.distro }}-${{ matrix.release }}-failed-test-journals
path : |
build/test/journal/*.journal
build/meson-logs/*
retention-days : 7
- name : Archive packages
uses : actions/upload-artifact@v4
if : (success() || failure()) && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
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/*.pkg.tar
retention-days : 4