Files
systemd/.github/workflows/coverage.yml
Lennart Poettering 54eb59e7db mkosi: update mkosi ref to 131adaca5eb5f1551bc564ae4497ff940890a374
* ed3eed38f2 Fix key-file path for extension/portable
 \
  * 43e8b2d35a Handle repart definitions for extension/portable
* 04816c3b82 Add oci-archive output format
* 7a9c94b63a Install ruff on recent Debian
* 4a7b08985e Change contextlb.contextmanager typing to Generator
 \
  * 5ca453ab6b Make OUTPUT variable available in postoutput scripts
* 90463ff04d Add tests for BuildStream support
 \
  * d36b138612 Add BuildStream support
* 2ca0d9c8ce ci: Sync claude-review workflow with systemd
* 1d1763f25a codespell: add "prFiles" to ignore-words-list
* 54b2897425 Revert "Symlink man pages on the website"
 \
  * 0c087181ed tests: fix pytest deprecation warning
* c9bbec224c docs: bump year in footer
* ae665678e2 Symlink man pages on the website
 \
  * 5895cd7596 Revert "Symlink man pages on the website"
* a09d5348ed docs: symlink man pages and assign them to the documentation heading
 \
  * 0bd378b7cb man: use YAML front matter
* 922e4a7f43 build(deps): bump aws-actions/configure-aws-credentials
* 05dfd295d3 initrd: add uas to the default list
* 2d52cc80db Pass through TERMINFO and TERMINFO_DIRS to tput (#4455)
* caa3c3235d Revert "dnf: Only read repositories and variables from the sandbox tree"
* 29b5f4d0d1 Add --umask to sandbox and UMask= setting
* d2e27ab62b Renaming remaining postmarketOS to Nura
2026-10-17 17:44:22 +02:00

163 lines
5.5 KiB
YAML

---
# SPDX-License-Identifier: LGPL-2.1-or-later
name: coverage
on:
schedule:
# Calculate coverage daily at midnight
- cron: '0 0 * * *'
pull_request:
branches:
- main
paths:
- .github/workflows/coverage.yml
- test/integration-tests/integration-test-wrapper.py
permissions:
contents: read
jobs:
coverage:
runs-on: ubuntu-24.04
if: github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: systemd/mkosi@131adaca5eb5f1551bc564ae4497ff940890a374
# 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/mkosi.local.conf <<EOF
[Distribution]
Distribution=arch
[Build]
ToolsTreeDistribution=arch
UseSubvolumes=yes
WithTests=no
WorkspaceDirectory=$TMPDIR
PackageCacheDirectory=$TMPDIR/cache
Environment=
# Build debuginfo packages since we'll be publishing the packages as artifacts.
WITH_DEBUG=1
CFLAGS=-Og
MESON_OPTIONS=--werror
COVERAGE=1
[Runtime]
RAM=4G
EOF
- name: Generate secure boot key
run: mkosi --debug genkey
- name: Show image summary
run: mkosi summary
- name: Build tools tree
run: sudo mkosi -f box -- true
- name: Configure meson
run: |
sudo mkosi box -- \
meson setup \
--buildtype=debugoptimized \
build
- name: Build image
run: sudo mkosi box -- meson compile -C build mkosi
- name: Initial coverage report
run: |
sudo mkdir -p build/test/coverage
sudo mkosi box -- \
lcov \
--directory build/mkosi.builddir/arch~rolling~x86-64 \
--capture \
--initial \
--exclude "*.gperf" \
--output-file build/test/coverage/initial.coverage-info \
--base-directory src/ \
--ignore-errors source \
--no-external \
--substitute "s#src/src#src#g"
- name: Run integration tests
run: |
# --preserve-env makes sure all the github actions environment variables are propagated which are
# used in integration-test-wrapper.py to construct the `gh` command line to download the journals
# of failed tests.
sudo --preserve-env mkosi box -- \
env \
TEST_RUNNER=ubuntu-24.04 \
meson test \
-C build \
--no-rebuild \
--setup=integration \
--suite=integration-tests \
--print-errorlogs \
--no-stdsplit \
--num-processes "$(($(nproc) - 1))" \
--timeout-multiplier 2 \
--max-lines 300 \
--quiet
- name: Fix journal ownership
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
run: sudo chown -R "$(id -u):$(id -g)" build/test/journal build/meson-logs || true
- name: Archive failed test journals
uses: actions/upload-artifact@v7
if: failure() && (github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable')
with:
name: ci-coverage-${{ github.run_id }}-${{ github.run_attempt }}-arch-rolling-failed-test-journals
path: |
build/test/journal/*.journal
build/meson-logs/*
retention-days: 7
- name: Combine coverage reports
run: |
lcov_args=()
while read -r file; do
lcov_args+=(--add-tracefile "${file}")
done < <(find build/test/coverage -name "TEST-*.coverage-info")
sudo mkosi box -- lcov --ignore-errors inconsistent,inconsistent "${lcov_args[@]}" --output-file build/test/coverage/everything.coverage-info
- name: List coverage report
run: sudo mkosi box -- lcov --ignore-errors inconsistent,inconsistent --list build/test/coverage/everything.coverage-info
- name: Coveralls
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329
if: github.repository == 'systemd/systemd' || github.repository == 'systemd/systemd-stable'
with:
file: build/test/coverage/everything.coverage-info