Files
vectorcraft/.github/workflows/ci.yml
T
dotCooCoo b7604a54e7 CI: build the tests without bundled fonts in the build job, not the lint leg
The lint leg's dependency cache keeps no compiled workspace crates, so on
a pull request `cargo test -p vectorcraft-ui-egui --no-default-features
--test install_fonts` rebuilt every workspace crate without the bundled
fonts: 35 of the lint leg's 60 minutes, and the longest leg of the run.

`cargo xtask ci` splits its no-bundled-fonts step in two. The
`no-bundled-fonts` step (the `cargo tree` checks and the clippy run
without default features) stays in `cargo xtask ci checks`. The new
`no-bundled-fonts-tests` step runs the two tests, and the new
`cargo xtask ci after-archive` runs it after the doctests in the gate's
build job, whose rolling cache entry keeps the workspace crates. The
tests' builds record their units in CRAFT_CACHE_UNITS, so the cache trim
keeps the crates built without the fonts.
2026-12-05 09:53:20 -08:00

114 lines
6.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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. Every night the gate runs a cold build:
# the safety net for the workspace crates it keeps between runs (`cache-workspace-crates`), and a
# fresh start for that cache entry.
on:
push:
branches: [main]
schedule:
- cron: "37 3 * * *"
# `labeled` so adding the `full-ci` label starts a run of all six shards.
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
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 other than `full-ci` gets a group of its own, so it never cancels a real 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:
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:
# Same craft-fonts commit as release.yml.
craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
# A cold build of every shard's tests (the nightly run, or any run after a toolchain or
# lockfile change) took 90 minutes to reach its last three steps on 2026-11-27 and was
# canceled there; with those steps and the save it needs about two hours.
timeout-minutes: 150
# The gate's test binaries carry no debug info and no symbols (CARGO_PROFILE_TEST_DEBUG=0,
# CARGO_PROFILE_TEST_STRIP=symbols), as photocraft's do: linking ~100 test binaries with line
# tables ran the hosted runner out of resources, and it stopped mid-link with "received a
# shutdown signal" (exit 143). Panics still name file and line; local builds keep Cargo.toml's
# line tables.
dev-strip: true
# The workspace crates also build without line tables. A panic still names its file and line.
dev-debug: "0"
# The `build (<os>)` job builds the tests once and writes one nextest archive per shard with
# that shard's test binaries (`cargo xtask ci archive`), then runs the doctests and the tests
# built without the bundled fonts (`cargo xtask ci after-archive`), whose second build of the
# workspace crates the build job's cache entry keeps. Five test legs download their own archive and
# run it without building: shards 1 and 2 each run half of vectorcraft-ui-egui's tests, and
# shards 3 to 5 the tests of their own crates (xtask/src/shards.rs). The `lint (<os>)` leg
# runs the other `cargo xtask ci` steps beside them, with a dependency cache of its own.
# `gate (<os>)` passes when the build and every test leg that ran passed; `lint (<os>)` is a
# check of its own.
test-shards: 5
shard-command: cargo xtask ci shard
archive-command: cargo xtask ci archive
shard-archives: true
after-archive-command: cargo xtask ci after-archive
lint-command: cargo xtask ci checks
# A pull request runs only the test shards whose crates its changes reach: the crates that
# own a changed file or declare a read of it (`[package.metadata.craft] reads`), and every
# crate that depends on them. The `select legs` log lists the shards left out and why; pushes
# to main, the nightly run and the `full-ci` label run all five. `shard-members` names each
# shard's crates, as xtask/src/shards.rs › GROUPS does.
select-tests: true
shard-members: |
vectorcraft-ui-egui
vectorcraft-ui-egui
vectorcraft-engine
vectorcraft vectorcraft-web vectorcraft-cli vectorcraft-mcp xtask
(rest)
# The dependency cache also keeps the compiled workspace crates and their library and binary
# test executables (not the integration tests' executables), so a pull request's build
# rebuilds only the crates its changes reach. Each main run's `build` job saves a rolling
# entry of its own, every build restores the newest one, and
# cache-prune.yml deletes the one it replaced after each attempt. The nightly run restores
# nothing and builds everything from source.
cache-workspace-crates: true
cold-build: ${{ github.event_name == 'schedule' }}
packages: >-
pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcb1-dev libxcursor-dev
libxrandr-dev libxi-dev libfontconfig1-dev libfreetype-dev mesa-vulkan-drivers
libgl1-mesa-dev
# The nightly cold run never restores the rolling crates entry, so the old entry is only overlap
# while the cold run saves its own: two entries of about 4.6 GB, which with the others go over the
# 10 GB cache limit and get the corpus, SonarCloud and Windows ARM64 entries evicted. This deletes
# the old entries when the `build` job starts saving (scripts/ci-clear-rolling-cache.py). When
# the job fails or is canceled, before its save or during it, this job fails too, so "Re-run
# failed jobs" runs it again beside the re-run build. The build starts after `gate / select legs`
# and a free runner. The script allows 180 minutes from its start for the build to start, then
# waits up to 160 minutes from the build's start. GitHub's 360-minute job limit can end this job
# before the script's deadlines expire when runner waits take too long.
cold-cache-clear:
name: cold cache clear
if: github.event_name == 'schedule'
runs-on: ubuntu-24.04
timeout-minutes: 360
permissions:
actions: write
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Delete the old rolling entries before the save
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/ci-clear-rolling-cache.py