Commit Graph
13 Commits
Author SHA1 Message Date
aiongg fc3e1afc1c rust-cache: leave a runner-provided cargo home (CRAFT_RUNNER_CARGO_HOME) to the runner (#320)
rust-cache caches and, at save, prunes the registry, git and bin directories
under CARGO_HOME, with no input to leave them out. The cluster runners'
CARGO_HOME is a crate cache shared across jobs, and align-environment refused
it outright. When CARGO_HOME is the directory the runner names in
CRAFT_RUNNER_CARGO_HOME, rust-cache gets a job-private directory as its
CARGO_HOME, with or without align-environment; a CARGO_HOME the job sets
itself is still refused. GitHub-hosted runs take the same steps as before.
2026-11-22 01:02:38 -05:00
aiongg bf191401c5 rust-cache: name a run's entry after the one it restored and record the build's units; cache-trim and cache-prune
- rust-cache: a saving leg's crates entry is <job>-crates-<os>-<arch>-<parent run>-0, from
  .ci-cache-meta/entry, so of two runs that restored the same entry only the first to finish
  saves (GitHub refuses an existing key). Nothing restored gives -0-0; a cold build writes
  -<run>-<attempt>. A saving leg gets CRAFT_CACHE_UNITS, a file for the build's Cargo JSON
  messages; the name is outside the prefixes rust-cache hashes into its key.
- cache-trim: deletes every unit directory (<profile>/build/<package>/<hash>/) the record does
  not name, before rust-cache's post step saves; rust-cache's own cleanup matches package names
  only and keeps older builds of updated dependencies. No record, no change.
- cache-prune: for a caller job with actions: write. Keeps the newest rolling crates entry per
  job/OS/arch, and of other rust-cache entries and named <name>-<sha256> entries removes an older
  one once nothing used it since the newest was created. watch: prunes as the run's saving jobs
  finish and ends when none is queued or running.
2026-11-19 23:19:14 +00:00
aiongg 7513b173b4 Merge craft-common-actions#252 (canonical save-if) into the gate change
# Conflicts:
#	README.md
2026-11-19 09:25:52 +00:00
aiongg fabe5cc9f4 actions: rolling workspace-crates entry in rust-cache, restore-mtimes and gate-run
actions/rust-cache gains cache-workspace-crates and restore. With
cache-workspace-crates the entry also keeps the workspace crates' compiled
libraries and unit-test executables, as a rolling entry: a saving run writes
an entry of its own and every run restores the newest under the job's prefix,
since rust-cache never replaces an existing key. Both inputs default to
today's behaviour.

actions/restore-mtimes records the commit an entry was built from (and the
commits of the craft-i18n and craft-fonts checkouts), and after a restore
touches only the files that changed since then, so Cargo rebuilds only what
they reach.

actions/gate-run runs one of gate.yml's commands with its optional timeout.

gate.yml is unchanged; it moves to these actions in a separate change.
2026-11-19 09:23:40 +00:00
aiongg 112ef59c08 gate: each shard leg records its latest status, so a re-run that fails replaces an earlier pass 2026-11-18 20:20:21 +00:00
aiongg ea2e684a31 rust-cache: Swatinem v2.9.3 by commit; cache-version v2
StepSecurity's v2.9.1 cut every target/<profile>/build entry at its last '-',
so Cargo's new build-dir layout (build/<package>/<hash>/) lost most dependency
packages from each saved entry. v2.9.3 checks the exact name first (#371 there)
and keeps the Windows path fix (#355 there) that v2.9.1 was pinned for.

The cache-version default moves to v2 once: rust-cache never replaces an
exact-key entry, so the pruned v1 entries would otherwise be restored as they
are until the lockfile changes.
2026-11-18 18:54:00 +00:00
aiongg a24d4fc3de gate: cache key from native profiles only, optional cache-warm leg saves after the build
The rust-cache key hashes the root [profile] tables except wasm-only ones (web, wasm-*), so a
web-profile edit no longer starts every native cache cold. A new warm-command input adds a
default-branch leg that runs only the build and saves the gate entry as soon as it succeeds,
instead of after the tests.
2026-11-18 14:14:58 +00:00
skylar taylor-barrick e89dbaf1a2 ci(rust-cache): warn about an unrecognized save-if without echoing it
The fail-closed warning printed the caller's value with printf %q. That value is
configuration and a misdirected one can be a token, which the log has no use for, so
the warning names the policy instead of the value. Normalization is unchanged; a direct
test asserts a synthetic sentinel never reaches the log.
2026-11-18 03:52:27 +01:00
skylar taylor-barrick 94729a030a ci(rust-cache): describe the ASCII-only save-if trim accurately
rust-cache's trim strips U+00A0 (NBSP) and the other Unicode spaces but leaves U+0085
(NEL) in place. The comment claimed it strips neither. Say what each one does: the
wrapper matches it on U+0085 and is deliberately narrower on U+00A0, so it is never
looser than the cache action. Comments and test intent only; the accepted-input policy
and its tests are unchanged.
2026-11-18 03:51:54 +01:00
skylar taylor-barrick 16d88e0e6b ci(rust-cache): only an accepted save-if true permits a save
rust-cache trims its save-if input and falls back to true when nothing is left, so a
whitespace-only value arrived at the shipped action as "save= " and granted a save the
caller never asked for. Emit one canonical word instead: an accepted true (ASCII
whitespace trimmed, ASCII case ignored) saves; empty, whitespace-only and unrecognized
values restore only, in a single GITHUB_OUTPUT record so a newline in the input cannot
override the decision.

Lock the gate's cache-write condition by tokens rather than substrings, and add an
event/ref/default-branch/dispatch truth table plus a gate-to-action contract test, so
an appended "|| true" or a dropped pull-request guard fails instead of passing. The
gate expression and its behaviour are unchanged.
2026-11-18 03:51:54 +01:00
Martin BallandClaude Opus 5.5 f9e835af4f fix(rust-cache): pin v2.9.1 so Windows jobs save their cache (#249)
step-security/rust-cache v2.9.2 ships an ES-module bundle. Its bundled
minimatch 3 calls require('path'), which throws in an ES module, so it
falls back to '/' as the separator. On Windows no cache path then
matches and every save fails with "Path Validation Error". Windows legs
never saved a cache and built every dependency from scratch.

v2.9.1 is a CommonJS (ncc) bundle with the same inputs. Pin it
everywhere rust-cache is used and add a test that keeps every pin on
the action's commit and off v2.9.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCXtSjB6e5jmy9Uq7u8
2026-11-16 12:19:03 +00:00
Martin Ball 59d1ecc4ea Fix shared cache save policy and target paths (#253)
Disable Rust cache saves after failed runs and resolve CARGO_TARGET_DIR relative to the checkout. Use dated FreeBSD cache entries and skip a matching same-day save. Keep inherited-target tests independent of the caller environment.

Contributor: @benandez.

Validated with the passing hosted test job, 95 focused passes plus one existing csh skip, and four inherited-target tests. Native Windows/FreeBSD VM and live cache-service execution were not claimed.
2026-11-15 19:19:40 -06:00
skylar taylor-barrick 2537691a6b ci: share dependency-cache keys and read-only restores (#240)
* ci: share the gate dependency-cache key and read-only restores

* fix(rust-cache): compare cache directories, not their spelling

A Windows runner spells one directory two ways: git-bash reports $HOME/.cargo as
/c/Users/x/.cargo, and a native tool or workflow input passes C:\Users\x\.cargo. The
align-environment guard compared the strings, so the first Windows caller copying the
README example exited 1 with "sets ...; drop the input". It now resolves both sides when
they exist and otherwise normalises backslashes, a drive letter and its case before
comparing. Refusing a genuinely different cargo home is unchanged.

Regressions cover both Windows spellings, a trailing separator, a drive letter in either
case, two different Windows homes, and a symlinked home that resolves to $HOME/.cargo;
the five positive cases fail against the previous guard.
2026-11-14 21:01:18 -06:00