Files
vectorcraft/.github/workflows/ci.yml
T
dotCooCoo bd30cd9632 CI: call the gate at craft-common-actions#408's head until it merges
The gate on craft-common-actions main has no warm-split input yet, so
every run of this branch failed at startup. #408 adds the input; this
pin goes back to @main once #408 merges.
2026-11-30 15:12:38 -08:00

98 lines
5.2 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. 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 * * *"
pull_request:
workflow_dispatch:
permissions:
contents: read
# A newer push to a PR branch cancels its older run; every push to main runs to the end.
concurrency:
group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
gate:
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
# Pinned to storytold/craft-common-actions#408 (the gate's warm-split input) until it merges;
# this goes back to @main before this pull request merges.
uses: storytold/craft-common-actions/.github/workflows/gate.yml@2dccde94f9052f8cd613ab1a35b251a58a1193a2
with:
# Same craft-fonts commit as release.yml.
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
# A cold `cache warm` leg (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"
# Six legs instead of one: shards 1 and 2 each build vectorcraft-ui-egui's tests and run
# half of them, shards 3 to 5 each build and run the tests of their own crates, and shard 6
# runs the other `cargo xtask ci` steps (xtask/src/shards.rs). `gate (<os>)` passes only
# when all six did. On pushes to main, a `cache warm` leg builds what every shard builds and
# saves the dependency cache.
test-shards: 6
shard-command: cargo xtask ci shard
warm-command: cargo xtask ci warm
# The warm build runs as one `cache warm <k>/6` leg per shard, in parallel (each builds what
# its shard builds), and `cache warm` puts their files into the one entry it saves.
warm-split: true
# The dependency cache also keeps the compiled workspace crates and test executables, so a
# pull request's shards rebuild only the crates its changes reach. Each main run's `cache
# warm` leg saves a rolling entry of its own, every leg 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 `cache warm` leg starts saving (scripts/ci-clear-rolling-cache.py).
# When the leg 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 leg. The leg starts after `gate / select legs` and a
# free runner, and with `warm-split` after every `cache warm <k>/6` leg. The script suspends its
# start deadline while any split leg is queued or running, then allows 180 minutes from the last
# split completion for the saving leg to start. Without split legs, it allows 180 minutes from
# the script's start. A failed split leg fails this job too. The script then waits up to 160
# minutes from the saving leg's start. GitHub's 360-minute job limit can end this job before the
# script's deadlines expire when split builds or 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