From b5affe3a0b412bb18fba9b9db6ca154f20388d68 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 07:11:52 -0800 Subject: [PATCH] CI: Desktop printing saves its Windows cache on main and builds the tests once The Windows leg found no cache on every pull request, because only a push or manual run on main saves one and the workflow had no push trigger. A push to main that touches the same paths now saves the entry that pull requests restore. Both test runs now select the app and the UI crate together, so Cargo resolves features once and the printps run reuses the first run's dependencies instead of rebuilding 94 crates. The first run keeps every app test (the binary's unit tests and `tests/it`). --- .github/workflows/print.yml | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/print.yml b/.github/workflows/print.yml index 8cdaf0cb28..ac941b5098 100644 --- a/.github/workflows/print.yml +++ b/.github/workflows/print.yml @@ -7,9 +7,26 @@ on: - "apps/vectorcraft/Cargo.toml" - "apps/vectorcraft/src/printing.rs" - "apps/vectorcraft/src/printing/**" + - "crates/ui-egui/Cargo.toml" - "crates/ui-egui/src/print.rs" - "crates/ui-egui/src/tests/printps.rs" - ".github/workflows/print.yml" + # A push to main saves the Windows cache entry that pull requests restore. + push: + branches: [main] + paths: + - "Cargo.toml" + - "Cargo.lock" + - "apps/vectorcraft/Cargo.toml" + - "apps/vectorcraft/src/printing.rs" + - "apps/vectorcraft/src/printing/**" + - "crates/ui-egui/Cargo.toml" + - "crates/ui-egui/src/print.rs" + - "crates/ui-egui/src/tests/printps.rs" + - ".github/workflows/print.yml" + # A weekly run on main saves a fresh entry after a new stable Rust changes the cache key. + schedule: + - cron: "23 6 * * 1" workflow_dispatch: permissions: contents: read @@ -18,15 +35,14 @@ concurrency: group: print-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - # Desktop printing on Windows, through the suite's shared gate. Pull requests restore the cache - # but never save one; a manual run on main saves the cache they restore. + # Desktop printing on Windows, through the suite's shared gate. Pushes to main, the weekly run and + # manual runs on main save the cache; pull requests restore it and never save one. windows: # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository. uses: storytold/craft-common-actions/.github/workflows/gate.yml@main with: os: '["windows-2022"]' - # A change to Cargo.lock finds no cache (only main saves one) and builds everything cold: - # about 55 minutes for `-p vectorcraft` alone, then the UI crate's tests. + # A run that finds no cache builds everything cold, which took 76 to 126 minutes. timeout-minutes: 150 # As in ci.yml: test binaries without debug info or symbols, and workspace crates without # line tables. A panic still names its file and line. @@ -36,10 +52,14 @@ jobs: craft-fonts-ref: "" tools: "" targets: "" - # A filter that matches nothing still passes, so the printps run fails unless some test ran. + # Both test runs select the same two packages, so Cargo resolves features once and the + # second run reuses the first run's dependencies. The first runs every test of the app + # (`--bin vectorcraft --test it`), the second the UI crate's `tests::printps` tests. A filter + # that matches nothing still passes, so the printps run fails unless some test ran. command: | + set -o pipefail cargo clippy --locked -p vectorcraft --all-targets -- -D warnings - cargo test --locked -p vectorcraft + cargo test --locked -p vectorcraft -p vectorcraft-ui-egui --bin vectorcraft --test it log="$RUNNER_TEMP/printps.log" - cargo test --locked -p vectorcraft-ui-egui --lib -- tests::printps | tee "$log" + cargo test --locked -p vectorcraft -p vectorcraft-ui-egui --lib -- tests::printps | tee "$log" grep -Eq 'test result: ok\. [1-9][0-9]* passed' "$log" || { echo "::error::tests::printps matched no tests"; exit 1; }