ci: faster Forgejo CI: toolchain, apt and crate-cache fallbacks, docs-only skips, cancelled superseded runs #2538
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2538
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:push-qlwovlqqytyr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Forgejo CI's three compiling jobs (Rust, end to end, Host C for Windows) spend much of each run fetching things they had last time, and run on pull requests that change no code. This makes them faster and lighter. Nothing that is checked changes, and
release.ymlis untouched.What the logs showed (run 53990, a push to
main): rustup downloaded the toolchain in every job (16 to 20 s each).apt-get updatefetched 35 MB of lists at under 1 MB/s (26 to 45 s inrustande2e). Andrust-depsmissed on its exact key, because the key changes with anyCargo.lockormise.tomledit and has no fallback. Sorustbuilt every registry crate from nothing (clippy 1 m 43 s, then tests 1 m 09 s), andhost-windowsbuilt longshot-builder from nothing too (2.5 min).ci.yml):rust-depsandrust-e2e-depsare keyed on mise.toml's Rust version plusCargo.lock(no longer the wholemise.toml), withrestore-keyson the same Rust. A lock change restores the newest entry and builds only the crates that changed.scripts/ci_cargo_prune.pystill keeps each entry to the dependencies.~/.rustupand~/.cargo/binare cached per Rust version and job, and written only by a push tomainas every cache here is.scripts/ci_rust.shis unchanged, checksum pinning included, and finds the toolchain installed.scripts/ci_apt.shkeeps apt's lists and the downloaded packages in a cached folder, keyed by job and month. clang, lld and llvm install from it with noapt-get update. When that fails it updates and retries. apt still checks every package against the signed lists' hashes.changesjob (onquick) reads the PR's file list from the API with the base'sscripts/ci_changes.py. It skipsrust,e2eandhost-windowswhen every changed file is inwebsite/,docs/(exceptdocs/dev/reference/build-events.md, which a builder test reads),.circleci/, the other workflows or the top-level docs. The Rust tests read host/, gpu/, game/, assets/, third_party/, scripts/, tests/ and tools.lock, so the filter works by exclusion, and anything unsure (a push, a run by hand, an API error) runs everything. No gate job is needed:mainhas no required status checks (branch protection checked), andforge.py pr statuscountsskippedas passed.ci.ymlalready cancelled superseded PR runs.third-party.ymlandguide-screenshots.ymlnow do too, for pull requests only.pr-description.ymlgets one group per PR with cancel-in-progress (142 runs in about 6 h). Its event types stay as they are:synchronizeputs the status on a new head,editedcovers description, title and WIP changes, and Forgejo has noready_for_review.release.yml's group is untouched.website.yml'scheckjob ran the samenpm ci, build andnpm run checkasci.yml'swebsitejob (scripts/website_check.sh), which runs on every PR.website.ymlnow runs only the deploy and the preview.Based on #2541 (
push-kmloksxnwvkv, still open): its--this-pcin the runner-only builder steps is kept. Merge #2541 first, or this PR brings it along.Releases (second commit). First, which runners carry which labels (from
GET /orgs/MagicBeanDev/actions/runners):unraid-linux-1(id 2)releaserunner, 2 cores shared with quick)unraid-quick-1(id 3)quick,deploylocal(id 4)releasecharles-linux-ci(id 6)ubuntu-latest,ubuntu-24.04,quickPhishinabowl(id 7)ubuntu-latest,ubuntu-24.04unraid-linux-1(id 1)build-linux.ymlandbuild-windows.yml, plustools.yml's make job on main, now start withscripts/ci_release_runner.sh. It fails unless the job can reach the seal broker and the broker shows the key pinned inSEAL_BROKER_PIN(TLS only: no ID token, nothing unsealed). Only the server's CI network reaches the broker. Untillocalloses thereleaselabel, every release job that lands on it fails at this step. Removing the label is for a maintainer to do; I changed no runner. The rule is written in ci.md (Runners) and in release.yml's header. PR code still never runs onreleaseordeploy.dev tools check --require: 11 min in run 53992 (on the quick runner's 2 shared cores), out of its 17.5. Both build jobs now run the same check with the runner builder they build anyway, before they upload anything. publish needs both, so a refusal still ships nothing. The 5-minute nightly wait is unchanged, as asked.release-downloads-<platform>-…): downloads only. That is the pinned Rust's.tar.xzarchives, Cargo.lock's.cratefiles, tools.lock's archives and llvm-mingw's archive. It is restored and saved only by runs of main or av*tag. It never shares a key with the checks'rust-deps, and holds no unpacked toolchain and no target folder. Every file is checked by its SHA-256 against the checkout's pins each time it is used (renhdrum.py'sfetch/vendor_crates,helpers.download,dev tools install), so the guarantee does not depend on who wrote the cache. A branch run on the release runner could still save a key of that name, because forgejo-runner isolates only pull requests' writes. What gets signed is still compiled in the run. Saves 50–100 s of downloads per job.local, but 17 min onunraid-linux-1's 2 cores in run 53992, the same build the package job does). On the server, one builder build fewer saves about 15 min.Read first:
.forgejo/workflows/ci.yml,scripts/ci_changes.py,scripts/ci_apt.sh,docs/dev/reference/ci.md(Caches, What a pull request runs).Not done, and why:
generatedAt("As of …"), so the built site always differs. And the build, which is most of the job, is needed anyway to know whether anything changed. Skipping onlywrangler deploywould save seconds and need a cache or state that the deploy job must not read.ci_cargo_prune.pystays as it is.release.ymland the build workflows: they restore no cache by design (a cache key is anyone's to save first). Unchanged.Testing
Tested: actionlint 1.7.12 (both commits) (mise.toml's) with
.forgejo/actionlint.yamlon every workflow: clean (it parses the YAML too). shellcheck 0.10.0 onscripts/ci_apt.shandscripts/ci_release_runner.sh: clean.tests/test_release_workflow.pyis updated to the new rules (cache keys and paths, the guard before any build, tools check before upload, no build in the version job) and byte-compiles; it was not run here.bash -nand a byte-compile of the two new scripts. No game run is needed: CI configuration only. No test suite was run on my PC.Still to test:
changesjob printscode=true(this PR changesci.yml). Inrust,e2eandhost-windows, look at the rustup, apt and crate cache steps: a PR run reads onlymain's caches, so the first runs miss on the new keys and behave as before. Expect them to pass with their usual timings (by hand).main's first push: the save steps writerustup-1.99.1-*,apt-*-2026-11andrust-deps-1.99.1-*. The next PR runs should show "Cache restored" for each, rustup's "unchanged" with no download, "ci_apt: installed from the cached lists", and clippy compiling only the workspace's crates (by hand).rust,e2eandhost-windowsshow as skipped, andforge.py pr statuspasses (by hand).unraid-linux-1: "The server's release runner" passes, "The tools" passes in both builds, the Windows job ends withlongshot_vk.dll (build check), and publish signs and publishes. Onlocal(if it still has the label), the guard fails the job (by hand).pr-description,third-party,guide-screenshotsandciruns are cancelled (by hand).Measurements
Nothing runs in the game, so there is no game measurement. CI time, before (from the forge's tasks API and run 53990's job logs):
Cargo.lockchanged (fallback instead of a full build)rust-depsmisstools checklocal)unraid-linux-1)local; about 17 min more on the serverAfter: to be read from this PR's CI runs and from the first PR runs after it merges (the caches are written by
main's first push).Risks
DOCS_ONLYinscripts/ci_changes.py).main's push still runs everything, so such a break shows up onmainat the latest.main, and forgejo-runner keeps a PR's writes to that PR.rustup-*entry per job, about 0.3 to 0.6 GB, and the apt entries, about 100 MB).localkeeps thereleaselabel, a release job that lands there fails at the guard and the nightly fails, until the label is removed. With onlyunraid-linux-1(2 shared cores, capacity 1), the builds run one after another. A nightly will take longer than whenlocalbuilt Linux in parallel, despite the savings above.magicbean-seal-broker:8443. They share the quick runner's dind network, whose deploy jobs reach it, but this hasn't been seen onunraid-linux-1itself yet.Checklist
Ready for review
mainvia #2541; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (not run: no tests run on this PC; CircleCI runs them on this PR)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
c1e0f1ea3d484d649bd0484d649bd0a26e5ebb34WIP: ci: faster Forgejo CI: toolchain, apt and crate-cache fallbacks, docs-only skips, cancelled superseded runsto ci: faster Forgejo CI: toolchain, apt and crate-cache fallbacks, docs-only skips, cancelled superseded runs