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 :
2024-08-19 12:27:11 +03:00
- "**"
- "!README*"
- "!LICENSE*"
- "!LICENSES/**"
- "!TODO"
- "!docs/**"
- "!man/**"
- "!catalog/**"
- "!shell-completion/**"
- "!po/**"
- "!.**"
- ".github/**"
2022-11-10 17:00:53 +03:00
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 :
2024-08-19 12:27:11 +03:00
- "**"
- "!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 :
2024-06-07 11:55:53 +03:00
runs-on : ubuntu-24.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
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-O2 -D_FORTIFY_SOURCE=3"
2024-07-09 13:26:11 +03:00
relabel : no
2022-02-04 14:10:33 +03:00
- distro : debian
release : testing
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : no
2022-02-04 14:10:33 +03:00
- distro : ubuntu
2024-01-26 00:48:55 +03:00
release : noble
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : no
2024-05-14 22:02:40 +03:00
- distro : fedora
2024-10-07 10:49:38 +03:00
release : "41"
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : yes
2022-07-26 15:53:16 +03:00
- distro : fedora
release : rawhide
2024-05-16 18:20:24 +03:00
sanitizers : address,undefined
2024-06-01 16:14:08 +03:00
llvm : 1
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : yes
2024-03-26 12:42:00 +03:00
- distro : opensuse
release : tumbleweed
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : no
2023-01-10 14:04:10 +03:00
- distro : centos
2023-01-24 14:51:31 +03:00
release : "9"
2024-05-16 18:20:24 +03:00
sanitizers : ""
2024-06-01 16:14:08 +03:00
llvm : 0
2024-06-04 13:27:29 +03:00
cflags : "-Og"
2024-07-09 13:26:11 +03:00
relabel : yes
2024-07-11 16:49:17 +03:00
- distro : centos
release : "10"
sanitizers : ""
llvm : 0
cflags : "-Og"
relabel : yes
2020-11-30 23:57:52 +03:00
steps :
2024-11-01 12:01:41 +03:00
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
2024-11-03 00:18:57 +03:00
- uses : systemd/mkosi@8976a0abb19221e65300222f2d33067970cca0f1
2024-08-19 12:27:11 +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.
- 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
2024-10-10 22:19:03 +03:00
[ Build]
2024-08-19 12:27:11 +03:00
UseSubvolumes=yes
WorkspaceDirectory=$TMPDIR
PackageCacheDirectory=$TMPDIR/cache
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
2024-10-10 22:19:03 +03:00
[ Content]
2024-08-19 12:27:11 +03:00
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