Files
pdfcraft/.github/workflows/ci.yml
FredApps 28e8f2a22a ci: Windows gets its own gate call that warms and saves its dependency cache (#9054)
The Windows gate has no dependency cache, so every Windows run compiles all 741 crates cold.
A `cache warm (windows-latest)` leg now builds the tests and saves the entry as soon as the build
succeeds, so a main whose Windows tests fail still seeds it. The call has a 120-minute limit for a
cold run. cache-prune.yml deletes an entry once a newer one of its family replaces it.
2026-12-02 09:03:52 +01:00

90 lines
5.0 KiB
YAML

name: CI
# Quality gates for every push to main and every pull request (`cargo xtask ci`), through the
# suite's shared gate workflow in craft-common-actions. Nightly fuzzing is in fuzz.yml.
on:
push:
branches: [main]
pull_request:
# `labeled` so that adding `full-ci` to an open PR starts a run with Windows in it.
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
# The token is only used to check out the code: no job writes to the repository.
permissions:
contents: read
# A newer push to a PR branch cancels its older run; every push to main runs to the end. Adding
# any label but `full-ci` gets a group of its own, so it neither runs the gate nor cancels a run.
concurrency:
group: ci-${{ github.event_name == 'pull_request' && (github.event.action != 'labeled' || github.event.label.name == 'full-ci') && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# The shared gate doesn't check where git dependencies come from; release.yml runs the same job.
git-sources:
if: github.event.action != 'labeled' || github.event.label.name == 'full-ci'
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/git-sources.yml@main
gate:
if: github.event.action != 'labeled' || github.event.label.name == 'full-ci'
# 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:
# 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).
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev qpdf poppler-utils xvfb libxkbcommon-x11-0
# cargo-deny for the deny step of `cargo xtask ci`, which requires it under CI.
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
# 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 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