summaryrefslogtreecommitdiffstats
path: root/.github/workflows/mkosi.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/mkosi.yml')
-rw-r--r--.github/workflows/mkosi.yml182
1 files changed, 126 insertions, 56 deletions
diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml
index 8b32ec8..425d737 100644
--- a/.github/workflows/mkosi.yml
+++ b/.github/workflows/mkosi.yml
@@ -46,7 +46,7 @@ permissions:
jobs:
ci:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.release }}-${{ github.ref }}
cancel-in-progress: true
@@ -56,76 +56,94 @@ jobs:
include:
- distro: arch
release: rolling
+ sanitizers: ""
+ llvm: 0
+ cflags: "-O2 -D_FORTIFY_SOURCE=3"
- distro: debian
release: testing
+ sanitizers: ""
+ llvm: 0
+ cflags: "-Og"
- distro: ubuntu
- release: jammy
+ release: noble
+ sanitizers: ""
+ llvm: 0
+ cflags: "-Og"
- distro: fedora
- release: "39"
+ release: "40"
+ sanitizers: ""
+ llvm: 0
+ cflags: "-Og"
- distro: fedora
release: rawhide
+ sanitizers: address,undefined
+ llvm: 1
+ cflags: "-Og"
- distro: opensuse
release: tumbleweed
+ sanitizers: ""
+ llvm: 0
+ cflags: "-Og"
- distro: centos
release: "9"
- - distro: centos
- release: "8"
-
- env:
- SYSTEMD_LOG_LEVEL: debug
+ sanitizers: ""
+ llvm: 0
+ cflags: "-Og"
steps:
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- - uses: systemd/mkosi@bbe715f42911f9660712377a5b39335b9391ae22
+ - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
+ - uses: systemd/mkosi@0081ea66faf56a35353d6aeadfe42f9679c7d1cf
+
+ # 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: |
- tee mkosi.local.conf <<- EOF
+ tee mkosi.local.conf <<EOF
[Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
- EOF
-
- tee mkosi.conf.d/99-ci.conf <<- EOF
- [Content]
- Environment=CI_BUILD=1
- SLOW_TESTS=true
- [Host]
- KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
- systemd.journald.max_level_console=debug
- # 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
- QemuVsock=yes
- # Sometimes we run on a host with /dev/kvm, but it is broken, so explicitly disable it
- QemuKvm=no
- Ephemeral=yes
- EOF
+ [Output]
+ # Build a disk image in CI as this logic is much more prone to breakage.
+ Format=disk
+ UseSubvolumes=yes
- # For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
- # version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
+ WorkspaceDirectory=$TMPDIR
+ PackageCacheDirectory=$TMPDIR/cache
- mkdir -p mkosi.images/system/mkosi.repart/10-usr.conf.d
- tee mkosi.images/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<- EOF
- [Partition]
- Format=squashfs
- EOF
+ [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 }}
- # The emergency shell is not useful in the CI, as it just blocks for a long time before the job
- # eventually times out. Override it to just shutdown immediately.
- mkdir -p mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
- mkdir -p mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
- tee mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<- EOF
- [Unit]
- FailureAction=exit
- [Service]
- ExecStartPre=
- ExecStart=
- ExecStart=false
+ [Host]
+ QemuMem=4G
+ # We build with debuginfo so there's no point in mounting the sources into the machine.
+ RuntimeBuildSources=no
EOF
- cp mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf
- name: Generate secure boot key
run: mkosi --debug genkey
@@ -133,11 +151,63 @@ jobs:
- name: Show image summary
run: mkosi summary
- - name: Build
- run: mkosi --debug
-
- - name: Boot systemd-nspawn
- run: test "$(sudo mkosi --debug boot 1>&2; echo $?)" -eq 123
-
- - name: Boot QEMU
- run: timeout -k 30 10m test "$(mkosi --debug qemu 1>&2; echo $?)" -eq 123
+ - 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: 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