ci(test-crates): align workflow with release CI conventions

Match naming, permissions, concurrency, mold linker, and cache save-if
policy (write only from pre-release) used by the Slint release jobs.
This commit is contained in:
Afonso Jorge Ramos committed 2026-07-10 01:02:37 +02:00
1 parent 7a600a60f4
commit 54da577d56
2 files changed
+50 -21

No files matched your search

+44 -16
View File
@@ -1,18 +1,30 @@
name: Test crates # Workspace unit/doc tests for the shipping crates/ tree (Slint-era).
#
# 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)
#
# 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.
# Unit/doc tests for the shipping Rust workspace (no Slint UI graph). name: test-crates
# Intentionally excludes qbz / qbz-ui / qbz-dac-wizard / qbz-slint-common so
# CI never hits the 20–30 GB UI compile wall. Warm runs are a few seconds;
# cold first run is dominated by dependency compile + rust-cache restore.
on: on:
pull_request: pull_request:
# pre-release is the real base; main is listed so a PR opened against main
# still runs once before redirect-pr-to-prerelease retargets it.
branches: [pre-release, main] branches: [pre-release, main]
paths: paths:
- "crates/**" - "crates/**"
- "scripts/cargo-test.sh" - "scripts/cargo-test.sh"
- ".github/workflows/test-crates.yml" - ".github/workflows/test-crates.yml"
push: push:
# Integration branch only — never main (a push to main is a release merge).
branches: [pre-release] branches: [pre-release]
paths: paths:
- "crates/**" - "crates/**"
@@ -21,44 +33,60 @@ on:
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
group: test-crates-${{ github.workflow }}-${{ github.ref }} group: test-crates-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: read
jobs: jobs:
test: test:
name: cargo test (workspace, no UI) name: cargo test (workspace, no UI)
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
timeout-minutes: 45 # 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
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
- name: System dependencies - name: Install system dependencies
run: | run: |
# Non-UI crates still link Linux audio / D-Bus stubs (qbz-audio). # 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.
sudo apt-get update sudo apt-get update
sudo apt-get install -y --no-install-recommends \ sudo apt-get install -y --no-install-recommends \
build-essential pkg-config \ build-essential pkg-config mold \
libasound2-dev libjack-jackd2-dev \ libasound2-dev libjack-jackd2-dev \
libdbus-1-dev libssl-dev libdbus-1-dev libssl-dev
- name: Rust toolchain # 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 uses: dtolnay/rust-toolchain@stable
- name: Cargo cache - name: Rust cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
# Manifest is crates/Cargo.toml → artifacts in crates/target (same
# workspaces mapping as release-linux / build-slint).
workspaces: crates -> target workspaces: crates -> target
shared-key: test-crates-linux shared-key: test-crates-linux
cache-on-failure: true 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 - name: cargo test
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
CARGO_BUILD_JOBS: "2" CARGO_BUILD_JOBS: "2"
# Keyring / credentials tests skip themselves when CI=true. # Faster link; no -Z flags (stable toolchain).
CI: "true" RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
run: | run: |
echo "::group::rustc / cargo" echo "::group::toolchain"
rustc -V rustc -V
cargo -V cargo -V
echo "::endgroup::" echo "::endgroup::"
+6 -5
View File
@@ -1,13 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Run the shipping-stack unit/doc tests (crates workspace). # Run the shipping-stack unit/doc tests (crates workspace).
# #
# Excludes the Slint UI compile graph (qbz-ui + dependents). Building those for # Same command CI uses (.github/workflows/test-crates.yml). Excludes the Slint
# tests re-triggers the UI "memory wall" and is unnecessary: qbz-ui has no # UI compile graph (qbz-ui + dependents) so a laptop / Actions runner never hits
# #[test]s, and the binary crate's tests need a full Slint link. # the 20–30 GB UI memory wall. qbz-ui has no #[test]s; the binary crate's tests
# need a full Slint link and stay out of the default suite.
# #
# Usage: # Usage:
# ./scripts/cargo-test.sh # default: workspace minus UI graph # ./scripts/cargo-test.sh
# ./scripts/cargo-test.sh -- --lib # extra args after -- go to cargo test # ./scripts/cargo-test.sh -- --lib # skip doctests
# CARGO_BUILD_JOBS=1 ./scripts/cargo-test.sh # CARGO_BUILD_JOBS=1 ./scripts/cargo-test.sh
set -euo pipefail set -euo pipefail