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: cargo-nextest@0.9.150,cargo-deny@0.20.2 # 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: cargo-nextest@0.9.150 # 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 # Windows tests what only Windows can show: the crates with Windows-specific code or tests # (`cfg(windows)` paths, the Windows spooler, winres, the native UI), through nextest as Linux # does. The crates left out have no `cfg(windows)` code and run the same tests on Linux in # `cargo xtask ci`; so do pdfcraft-web (wasm) and the OCR worker. A new crate is tested here # until it is added to the list, so the list can only be too short, not make a test vanish. command: | cargo nextest run --workspace --lib --bins --tests --no-fail-fast --locked --exclude pdfcraft-web --exclude pdfcraft-ocr-worker --exclude pdfcraft-a11y --exclude pdfcraft-annot --exclude pdfcraft-audit --exclude pdfcraft-compare --exclude pdfcraft-content --exclude pdfcraft-cos --exclude pdfcraft-crypt --exclude pdfcraft-edit --exclude pdfcraft-export --exclude pdfcraft-filters --exclude pdfcraft-fonts --exclude pdfcraft-forms --exclude pdfcraft-geom --exclude pdfcraft-measure --exclude pdfcraft-model --exclude pdfcraft-oracle --exclude pdfcraft-organize --exclude pdfcraft-prc-render --exclude pdfcraft-preflight --exclude pdfcraft-redact --exclude pdfcraft-testkit --exclude pdfcraft-xfa --exclude pdfcraft-xfdf --exclude xtask cargo test --workspace --doc --locked --exclude pdfcraft-web --exclude pdfcraft-ocr-worker --exclude pdfcraft-a11y --exclude pdfcraft-annot --exclude pdfcraft-audit --exclude pdfcraft-compare --exclude pdfcraft-content --exclude pdfcraft-cos --exclude pdfcraft-crypt --exclude pdfcraft-edit --exclude pdfcraft-export --exclude pdfcraft-filters --exclude pdfcraft-fonts --exclude pdfcraft-forms --exclude pdfcraft-geom --exclude pdfcraft-measure --exclude pdfcraft-model --exclude pdfcraft-oracle --exclude pdfcraft-organize --exclude pdfcraft-prc-render --exclude pdfcraft-preflight --exclude pdfcraft-redact --exclude pdfcraft-testkit --exclude pdfcraft-xfa --exclude pdfcraft-xfdf --exclude xtask # 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). # The same build as `command`, flag for flag, so the warm leg saves what the gate restores. warm-command: cargo nextest run --workspace --lib --bins --tests --no-run --locked --exclude pdfcraft-web --exclude pdfcraft-ocr-worker --exclude pdfcraft-a11y --exclude pdfcraft-annot --exclude pdfcraft-audit --exclude pdfcraft-compare --exclude pdfcraft-content --exclude pdfcraft-cos --exclude pdfcraft-crypt --exclude pdfcraft-edit --exclude pdfcraft-export --exclude pdfcraft-filters --exclude pdfcraft-fonts --exclude pdfcraft-forms --exclude pdfcraft-geom --exclude pdfcraft-measure --exclude pdfcraft-model --exclude pdfcraft-oracle --exclude pdfcraft-organize --exclude pdfcraft-prc-render --exclude pdfcraft-preflight --exclude pdfcraft-redact --exclude pdfcraft-testkit --exclude pdfcraft-xfa --exclude pdfcraft-xfdf --exclude xtask