Merge pull request #9056 from storytold/ci/windows-warm-cache

ci: Windows gate warms and saves its dependency cache on main
This commit is contained in:
FredApps authored and GitHub committed 2026-12-02 14:38:23 +01:00
commit 5b822e9e5e
2 files changed
+73 -15

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
name: Cache prune
# Keeps the repository inside its 10 GB Actions cache budget. A new Rust cache entry (a lockfile or
# toolchain change makes one) leaves its predecessor behind until GitHub evicts the least recently
# used entries, which can be one a run still needs. After each CI run on main, this deletes the
# entries a newer one of the same family replaced, once nothing has used them since (craft-common-actions
# actions/cache-prune). Other entries (apt packages, tool caches) stay.
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
permissions:
contents: read
jobs:
cache-prune:
name: cache prune
# A fork's pull request from a branch named main also matches `branches`.
if: github.event.workflow_run.event != 'pull_request'
timeout-minutes: 10
runs-on: ubuntu-24.04
permissions:
actions: write
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
# A failed pass warns; the next run's prune deletes what it missed.
- name: Prune replaced cache entries
uses: storytold/craft-common-actions/actions/cache-prune@main
continue-on-error: true
+39 -15
View File
@@ -32,9 +32,10 @@ jobs:
# 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:
# Windows on main, manual runs and pull requests labelled `full-ci`. No macOS on PRs or main:
# the org's 5 macOS slots are kept for release builds, and release.yml builds macOS.
os: ${{ (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci')) && '["ubuntu-24.04","windows-latest"]' || '["ubuntu-24.04"]' }}
# Linux only; Windows has its own job below, because it saves its cache differently.
# No macOS on PRs or main: the org's 5 macOS slots are kept for release builds, and
# release.yml builds macOS (nightly-macos.yml tests it each night).
os: '["ubuntu-24.04"]'
# Same craft-fonts commit as release.yml and freebsd.yml.
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
# egui/winit/rfd, and the independent oracles (crates/oracle).
@@ -45,21 +46,44 @@ jobs:
tools: [email protected],[email protected]
# A missing oracle fails the job instead of printing a skip notice that reads as a pass.
linux-env: PDFCRAFT_ORACLES_REQUIRED=1
# One KEY=VALUE per line. No debug info on Windows: a cold-cache gate built it for every
# dependency and spent the 90-minute cap compiling before the tests started.
windows-env: |
PDFCRAFT_REQUIRE_WINRES=1
CARGO_PROFILE_DEV_DEBUG=0
CARGO_PROFILE_TEST_DEBUG=0
# Windows completed its 54m33s gate, then cache save hit the default 60m job cap
# (run 44364342368). Leave bounded room for setup and post-job cleanup.
# This changes no test watchdog or selection; craft-common-actions#60.
timeout-minutes: 90
# Preserve the packaging regression check removed from git-sources in #7042.
command: |
pwsh -NoProfile -File packaging/windows/test-font-notices.ps1
cargo xtask ci
# Windows checks what differs by platform: the build (with resources) and the tests. Clippy
# runs on Linux in `cargo xtask ci`; lints don't differ by platform.
windows-command: |
cargo test --workspace --locked
# Windows on main, manual runs and pull requests labelled `full-ci`. It is a call of its own, not
# a leg of `gate`, because `warm-command` applies to every leg of a call: with it the Linux gate
# would stop saving its own cache at the end of its green run (which holds what `cargo xtask ci`
# builds: clippy, wasm) and save only the test build instead.
gate-windows:
if: >-
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-ci'))
&& (github.event.action != 'labeled' || github.event.label.name == 'full-ci')
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: '["windows-latest"]'
# Same craft-fonts commit as `gate`.
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
# Prebuilt cargo tools: Windows runs `cargo test`, not `cargo xtask ci`, so no cargo-deny.
tools: [email protected]
# One KEY=VALUE per line. No debug info on Windows: a cold-cache gate built it for every
# dependency and spent the 90-minute cap compiling before the tests started (#9033).
# rust-cache hashes these into its key, so the warm leg, the gate and every full-ci pull
# request must keep them identical to share one entry.
env: |
PDFCRAFT_REQUIRE_WINRES=1
CARGO_PROFILE_DEV_DEBUG=0
CARGO_PROFILE_TEST_DEBUG=0
# A cold run (a lockfile or toolchain change, or an evicted cache) took 89 of 90 minutes
# (run 46809231999), so 120 leaves room for it and for the cache save. Windows checks what
# differs by platform: the build (with resources) and the tests. Clippy runs on Linux in
# `cargo xtask ci`; lints don't differ by platform.
timeout-minutes: 120
command: cargo test --workspace --locked
# On main and manual runs a `cache warm (windows-latest)` leg builds the tests (the build
# `command` does, without running them) and saves the dependency cache as soon as that
# succeeds. Without it the cache is saved only at the end of a green gate, and a main whose
# Windows tests fail never saves it, so every full-ci pull request compiled cold (#9054).
warm-command: cargo test --workspace --no-run --locked