Drop the standalone Unit-tests (musl) workflow that ran on an Alpine sandbox spun up by jirutka/setup-alpine, and merge it into unit-tests.yml as a new build-musl job that provisions a postmarketOS tools tree via mkosi and runs the meson build + test suite through 'mkosi box'. postmarketOS is musl-native, so the musl-gcc / -idirafter /usr/include wrappers the Fedora tools tree needed are gone; the linter.yml's own musl build step also goes away since the unit-tests workflow now covers it (and tests it). postmarketOS doesn't ship a downstream systemd packaging spec, so the new tools tree config in mkosi.tools.conf/mkosi.conf.d/postmarketos.conf does not set PrepareScripts and lists build deps manually. mkosi.sync now early-exits when PKG_SUBDIR is unset so the missing pkgenv entry doesn't trip set -u. Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
108 lines
3.5 KiB
YAML
108 lines
3.5 KiB
YAML
---
|
|
# vi: ts=2 sw=2 et:
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#
|
|
name: Unit tests
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- v[0-9]+-stable
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.runner }}
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ matrix.run_phase }}-${{ github.ref }}-${{ matrix.runner }}
|
|
cancel-in-progress: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runner: [ ubuntu-24.04 ]
|
|
run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS]
|
|
include:
|
|
- run_phase: GCC
|
|
- run_phase: GCC
|
|
runner: ubuntu-24.04-arm
|
|
- run_phase: GCC
|
|
runner: ubuntu-24.04-ppc64le
|
|
- run_phase: GCC
|
|
runner: ubuntu-24.04-s390x
|
|
- run_phase: CLANG
|
|
- run_phase: CLANG
|
|
runner: ubuntu-24.04-arm
|
|
- run_phase: CLANG
|
|
runner: ubuntu-24.04-ppc64le
|
|
- run_phase: CLANG
|
|
runner: ubuntu-24.04-s390x
|
|
steps:
|
|
- name: Repository checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install build dependencies
|
|
run: |
|
|
# Drop XDG_* stuff from /etc/environment, so we don't get the user
|
|
# XDG_* variables when running under sudo
|
|
sudo sed -i '/^XDG_/d' /etc/environment
|
|
# Pass only specific env variables through sudo, to avoid having
|
|
# the already existing XDG_* stuff on the "other side"
|
|
sudo --preserve-env=GITHUB_ACTIONS,CI .github/workflows/unit-tests.sh SETUP
|
|
- name: Build & test
|
|
run: sudo --preserve-env=GITHUB_ACTIONS,CI .github/workflows/unit-tests.sh RUN_${{ matrix.run_phase }}
|
|
|
|
build-musl:
|
|
name: Build & test (musl, postmarketOS)
|
|
runs-on: ubuntu-24.04
|
|
concurrency:
|
|
group: ${{ github.workflow }}-musl-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- name: Repository checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: systemd/mkosi@444d247d1a1328bcfb84a945e84959bd4bd0e02d
|
|
|
|
- name: Install apk
|
|
# ubuntu-24.04 doesn't package apk, so fetch the official statically-linked binary from
|
|
# upstream so mkosi can use it to populate the postmarketOS tools tree.
|
|
run: |
|
|
sudo curl -fsSL -o /usr/local/bin/apk \
|
|
https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v3.0.6/x86_64/apk.static
|
|
echo 'f1489e05bace7d7dd0a687fcd38d50b585ac660af4231668b123649bef3718c4 /usr/local/bin/apk' | sha256sum --check
|
|
sudo chmod +x /usr/local/bin/apk
|
|
|
|
- name: Build tools tree
|
|
run: |
|
|
tee mkosi/mkosi.local.conf <<EOF
|
|
[Build]
|
|
ToolsTreeDistribution=postmarketos
|
|
EOF
|
|
|
|
tee mkosi/mkosi.tools.conf/mkosi.local.conf <<EOF
|
|
[Distribution]
|
|
RepositoryKeyFetch=yes
|
|
EOF
|
|
|
|
mkosi -f box -- true
|
|
|
|
- name: Build
|
|
run: |
|
|
mkosi box -- \
|
|
meson setup \
|
|
--werror \
|
|
-Dtests=unsafe \
|
|
-Dslow-tests=true \
|
|
-Dfuzz-tests=true \
|
|
-Dlibc=musl \
|
|
build
|
|
mkosi box -- ninja -v -C build
|
|
|
|
- name: Test
|
|
run: mkosi box -- meson test -C build --print-errorlogs --no-stdsplit --quiet
|