ci: qt gate in test-crates; ship the QML audits in the repo

The five static QML audits move from the docs checkout to
scripts/qml-audits so CI runs the same gate as scripts/qt-run.sh
(which now defaults to the in-repo copy). New qt-gate job: audits,
Slint-free graph check, cargo test -p qbz-qt, and an offscreen boot of
the debug binary that fails on any QML complaint. cargo-test.sh excludes
qbz-qt (it needs Qt) so the no-UI job stays cheap.

cc
This commit is contained in:
vicrodh committed 2026-08-26 19:11:01 -06:00
1 parent c6bfb90ede
commit 077e5fd97e
9 files changed
+939 -35

No files matched your search

+114 -34
View File
@@ -1,16 +1,19 @@
# Workspace unit/doc tests for the shipping crates/ tree (Slint-era).
# CI for the crates/ workspace on the integration branch.
#
# Companion to the release/build workflows, not a substitute:
# - release-linux / build-slint / release-snap compile -p qbz (full UI, ~30 GB peak)
# - this job runs `cargo test` on every non-UI crate only (~5 min cold, ~1–2 min warm)
# Two jobs, two economies:
# test — `cargo test` on every crate that needs no Qt (scripts/cargo-test.sh:
# excludes the frozen Slint crates and qbz-qt). ~5 min cold.
# qt-gate — the Qt frontend: the five static QML audits, `cargo test -p
# qbz-qt`, the Slint-free dep-graph gate, and an OFFSCREEN BOOT of
# the debug binary. This is the thing `cargo check` cannot give:
# a missing QML component or a call to a bridge member that does
# not exist compiles clean and throws when the user opens the
# view. Qt comes from aqt — ubuntu-24.04's own Qt is 6.4.2 and has
# no QtQuick.Effects module.
#
# Excludes qbz, qbz-ui, qbz-dac-wizard, qbz-slint-common so the UI compile unit
# never enters the graph. Cache key is intentionally separate from
# `slint-linux` (stable + test profile vs nightly + release).
#
# Repo policy note: release builds stay tag/dispatch-only. This is the one
# workflow that runs on pre-release integration so regressions land before a
# release cut. Path-filtered so packaging/docs PRs skip it.
# Rewritten 2026-08-25 for the Slint -> Qt frontend switch. Release builds stay
# tag/dispatch-only; this is the one workflow that runs on pre-release
# integration so regressions land before a release cut.
name: test-crates
@@ -22,6 +25,7 @@ on:
paths:
- "crates/**"
- "scripts/cargo-test.sh"
- "scripts/qml-audits/**"
- ".github/workflows/test-crates.yml"
push:
# Integration branch only — never main (a push to main is a release merge).
@@ -29,6 +33,7 @@ on:
paths:
- "crates/**"
- "scripts/cargo-test.sh"
- "scripts/qml-audits/**"
- ".github/workflows/test-crates.yml"
workflow_dispatch:
@@ -39,63 +44,51 @@ concurrency:
permissions:
contents: read
env:
# Same pin as build-qt-linux.yml (the Linux floor). Bump both together.
QT_VERSION: ${{ vars.QT_VERSION_LINUX || '6.8.3' }}
jobs:
test:
name: cargo test (workspace, no UI)
runs-on: ubuntu-24.04
# Cold first run ~5 min (compile + test); warm ~1–2 min. Headroom for
# registry lag / cache restore, not for a Slint UI compile.
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install system dependencies
run: |
# Minimal subset of release-linux.yml deps: non-UI crates still link
# ALSA / JACK / D-Bus (qbz-audio) and OpenSSL (reqwest). mold matches
# the release linker for faster test-binary link.
# Non-UI crates still link ALSA / JACK / D-Bus (qbz-audio) and
# OpenSSL (reqwest).
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential pkg-config mold \
build-essential pkg-config \
libasound2-dev libjack-jackd2-dev \
libdbus-1-dev libssl-dev
# Floating stable is fine here: rust-cache keys on rustc -V, so a stable
# bump just rebuilds the test cache once. Nightly is reserved for the
# release/UI builds that need -Z threads.
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
# Manifest is crates/Cargo.toml → artifacts in crates/target (same
# workspaces mapping as release-linux / build-slint).
workspaces: crates -> target
shared-key: test-crates-linux
cache-on-failure: true
# PRs restore only. pre-release pushes write so the integration
# branch keeps the cache warm (mirrors release-linux save-if policy).
save-if: ${{ github.ref == 'refs/heads/pre-release' }}
- name: cargo test
env:
CARGO_TERM_COLOR: always
CARGO_BUILD_JOBS: "2"
# Faster link; no -Z flags (stable toolchain).
RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
run: |
echo "::group::toolchain"
rustc -V
cargo -V
echo "::endgroup::"
rustc -V; cargo -V
START=$(date +%s)
./scripts/cargo-test.sh
END=$(date +%s)
echo "cargo test wall time: $((END - START))s"
echo "cargo test wall time: $(( $(date +%s) - START ))s"
- name: qbzd slint-free dep-graph gate (01-architecture.md §1.2)
- name: qbzd slint-free dep-graph gate
run: |
set -euo pipefail
hits=$(cargo tree --manifest-path crates/Cargo.toml -p qbzd -e normal \
@@ -103,3 +96,90 @@ jobs:
if [ -n "$hits" ]; then
echo "::error::qbzd graph resolves Slint crates:"; echo "$hits"; exit 1
fi
qt-gate:
name: qt gate (audits, tests, offscreen boot)
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v7
# Cheapest gates first. The audits are ~1 s and catch exactly the class
# of mistake nothing else in CI can see.
- name: QML audits
run: |
set -euo pipefail
for a in qml_resolution_audit qml_singleton_xref qml_eager_tab_audit qml_module_registration_audit qml_icon_bake_audit; do
echo "::group::$a"
python3 "scripts/qml-audits/$a.py" "$PWD/crates/qbz-qt"
echo "::endgroup::"
done
# No workflow may build the frozen Slint binary (same bin name, same
# target dir — the last build silently wins the file).
- name: Gate — no workflow builds `-p qbz`
run: |
set -euo pipefail
hits=$(grep -rnE 'cargo (build|check|test|run|install).* -p qbz([^-a-z]|$)' .github/workflows/ || true)
[ -z "$hits" ] || { echo "::error::a workflow still builds the Slint crate:"; echo "$hits"; exit 1; }
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential pkg-config cmake clang libclang-dev nasm \
libasound2-dev libjack-jackd2-dev libdbus-1-dev libssl-dev \
libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
host: linux
target: desktop
arch: linux_gcc_64
modules: qtshadertools
cache: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: crates -> target
shared-key: qt-gate
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/pre-release' }}
- name: Slint-free dep-graph gate (qbz-qt)
run: |
set -euo pipefail
hits=$(cargo tree --manifest-path crates/Cargo.toml -p qbz-qt -e normal \
| grep -E '\b(slint|qbz-ui|qbz-slint-common|qbz-dac-wizard) v' || true)
[ -z "$hits" ] || { echo "::error::qbz-qt graph resolves Slint crates:"; echo "$hits"; exit 1; }
- name: cargo test -p qbz-qt (debug)
env:
CARGO_TERM_COLOR: always
run: cargo test --manifest-path crates/Cargo.toml -p qbz-qt --no-fail-fast
# The debug binary is what the tests just linked; boot it headless. Pass
# = >= 10 log lines, zero QML complaints, core initialized (the login
# screen — `home published` needs a session CI does not have).
- name: Offscreen boot (debug binary)
run: |
set -uo pipefail
cargo build --manifest-path crates/Cargo.toml -p qbz-qt
QT_QPA_PLATFORM=offscreen RUST_LOG=info timeout 75 ./crates/target/debug/qbz > smoke.log 2>&1 || true
lines=$(wc -l < smoke.log); echo "smoke log: $lines lines"
if (( lines < 10 )); then cat smoke.log; echo "::error::the app did not start"; exit 1; fi
errs=$(grep -av 'propertyCache' smoke.log \
| grep -aciE 'is not a type|unavailable|ReferenceError|TypeError|Cannot read|Unable to assign|Cannot open|no such method|non-existent property|failed to load component|is not installed' || true)
if (( errs > 0 )); then
grep -av 'propertyCache' smoke.log | grep -aiE 'is not a type|unavailable|ReferenceError|TypeError|Cannot read|Unable to assign|Cannot open|no such method|non-existent property|failed to load component|is not installed' | head -20
echo "::error::$errs QML complaint(s) in the smoke log"; exit 1
fi
grep -aq 'QbzCore initialized' smoke.log || { tail -20 smoke.log; echo "::error::never reached QbzCore init"; exit 1; }
echo "smoke OK (0 QML complaints, core initialized)"