- distro: centos
release: "9"
- env:
- SYSTEMD_LOG_LEVEL: debug
-
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- uses: systemd/mkosi@8cbde8a4ed20a078ad5c70fe38c0dd2294a68bb1
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
[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=
+ # 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
[Host]
ToolsTree=default
QemuKvm=yes
# TODO: Drop once https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2038777 is fixed in Github Actions
QemuFirmware=uefi
- Ephemeral=yes
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
[Host]
- KernelCommandLineExtra=systemd.unit=mkosi-check-and-shutdown.service
- systemd.log_level=debug
- 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
+ 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
EOF
- # 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
- 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
- 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 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