Round 4: CI/release gates, Cargo workspace authors, and docs/site sync (#57, #65, #66, #36, §65.8)

This commit is contained in:
Guoliang Chen committed 2026-11-26 12:32:13 -08:00
1 parent 69383eae7f
commit 6d1c68994c
38 files changed
+744 -443

No files matched your search

+11 -4
View File
@@ -114,16 +114,18 @@ tools/gates.sh # logs in target/gates/<timestamp>/
```
It runs each gate as a separate `tools/guard.sh` step with its own clock,
memory limit and log: `cargo fmt --all -- --check`, `cargo clippy
memory limit and log: `python3 tools/stamp_author.py --check`, `cargo fmt --all -- --check`, `cargo clippy
--workspace --all-targets -- -D warnings`, the test build (`cargo test
--workspace --all-targets --no-run`), `cargo test -p <crate> --all-targets`
for each workspace member in turn, the doc-tests (`cargo test --workspace
--doc`), the corpus gate (`scripts/corpus_gate.sh` over
`~/.cache/lucisv-corpus`, as CI runs it; skipped with a note when the corpus
is absent — fetch it once with `tools/corpus_fetch.sh ~/.cache/lucisv-corpus`)
is absent — fetch it once with `tools/corpus_fetch.sh ~/.cache/lucisv-corpus`),
the extension's `node --test editors/vscode/*_test.js`, and `cross` — a
`cargo check` of the three binaries for Windows and Linux with the rustup
toolchain the release build uses (skipped with a note when it is absent;
toolchain the release build uses (fails by default when that toolchain is
absent so a green gate proves cross-compilation; pass `--allow-skip-cross`
when running locally without cross targets;
added after 0.65.6 passed every other gate and then failed to compile for
Windows). It prints one line
per step start and end, then a table (step, result, seconds, passed/failed,
@@ -327,7 +329,12 @@ git tag v<X.Y.Z>
git push origin v<X.Y.Z>
```
does the rest on the `lustudio-arm64` runner: first `tools/gates.sh`, the
does the rest across three gated jobs: first `preflight` on `lustudio-arm64`
checks in seconds that the tag matches `Cargo.toml`, the extension manifests,
and a written `CHANGELOG.md` section before any heavy build starts; next
`linux` runs `cargo clippy` and guarded `cargo test --workspace` on
`luhpe-linux-x64`; then `build-and-publish` runs `tools/gates.sh` on
`lustudio-arm64`, the
whole of step 3 — a red gate stops the release before anything is built
(since 0.65.1; 0.65.0 was published while its checks had not finished) —
then `tools/release.sh --cross`, a
+24 -8
View File
@@ -3,6 +3,7 @@
# Run lucisv's release gates, each as a separate tools/guard.sh step.
#
# Steps, in order (names for --only/--skip):
# stamp python3 tools/stamp_author.py --check
# fmt cargo fmt --all -- --check
# clippy cargo clippy --workspace --all-targets -- -D warnings
# build cargo test --workspace --all-targets --no-run
@@ -15,7 +16,8 @@
# node node --test editors/vscode/*_test.js
# cross cargo check of the three shipped binaries for Windows and
# Linux with the rustup toolchain release.sh --cross uses
# (skipped, with a note, when that toolchain is absent).
# (fails when that toolchain is absent unless
# --allow-skip-cross is passed).
# Platform-conditional code is compiled nowhere else before
# the release build: 0.65.6 passed every other gate and then
# failed to compile for Windows.
@@ -33,13 +35,14 @@
# and a retry costs one crate, not the whole suite.
#
# Usage: tools/gates.sh [-o log-dir] [-c corpus-dir] [--only a,b] [--skip a,b]
# [--list] [--help]
# [--allow-skip-cross] [--list] [--help]
# tools/gates.sh # everything
# tools/gates.sh --only suites,docs # the per-crate suites and doc-tests
# tools/gates.sh --skip corpus # all but the corpus gate
#
# Exit status: 0 if every selected step passed (or was skipped for a missing
# corpus), 1 if any failed or stayed killed, 2 on a usage error.
# corpus, or cross with --allow-skip-cross), 1 if any failed or stayed killed,
# 2 on a usage error.
# Standard tooling only (bash, awk, date, sed).
set -u
@@ -53,6 +56,7 @@ corpus=$HOME/.cache/lucisv-corpus
cross_toolchain=$HOME/.rustup/toolchains/stable-aarch64-apple-darwin
only=
skip=
allow_skip_cross=0
usage() {
sed -n '/^# Usage:/,/^# Exit status/p' "$0" | sed '$d; s/^# \{0,1\}//'
@@ -70,6 +74,7 @@ while [ $# -gt 0 ]; do
--skip) skip=$2 ;;
esac
shift 2 ;;
--allow-skip-cross) allow_skip_cross=1; shift ;;
--list) list=1; shift ;;
-h|--help) usage; exit 0 ;;
*) usage >&2; exit 2 ;;
@@ -92,7 +97,7 @@ crates() {
all_steps() {
local c
echo fmt clippy build
echo stamp fmt clippy build
for c in $(crates); do echo "suite:$c"; done
echo docs corpus node cross
}
@@ -122,7 +127,7 @@ selected() {
# two minutes; memory is the peak plus headroom. README has the runs.
limits() {
case $1 in
fmt | node) echo "120 2" ;;
stamp | fmt | node) echo "120 2" ;;
clippy) echo "900 6" ;;
build) echo "900 8" ;;
suite:lucisv_server | suite:lucisv_mcp) echo "600 4" ;;
@@ -136,6 +141,7 @@ limits() {
# The command for step $1, into the array `cmd`.
set_command() {
case $1 in
stamp) cmd=(python3 tools/stamp_author.py --check) ;;
fmt) cmd=(cargo fmt --all -- --check) ;;
clippy) cmd=(cargo clippy --workspace --all-targets -- -D warnings) ;;
build) cmd=(cargo test --workspace --all-targets --no-run) ;;
@@ -219,10 +225,20 @@ for step in $steps; do
continue
fi
if [ "$step" = cross ] && [ ! -x "$cross_toolchain/bin/cargo" ]; then
echo "skipped: no rustup toolchain at $cross_toolchain (tools/RELEASING.md)" >"$log"
echo " skip $step (no rustup toolchain)"
rows="$rows$step|SKIPPED (no toolchain)|0|-|$log
if [ "$allow_skip_cross" = 1 ]; then
echo "skipped: no rustup toolchain at $cross_toolchain (tools/RELEASING.md)" >"$log"
echo " skip $step (no rustup toolchain)"
rows="$rows$step|SKIPPED (no toolchain)|0|-|$log
"
else
echo "FAIL: no rustup toolchain at $cross_toolchain (tools/RELEASING.md); pass --allow-skip-cross to skip" >"$log"
echo " fail $step (no rustup toolchain; pass --allow-skip-cross to skip)"
t0=$(date +%s)
printf '%s\t%s\t%s\t%s\n' "$step" "$t0" "$t0" "fail" >>"$log_dir/steps.tsv"
rows="$rows$step|fail|0|-|$log
"
failed=1
fi
continue
fi
echo " start $step ($(limits "$step" | sed 's/ / s, /') GB)"
+10 -4
View File
@@ -22,21 +22,26 @@ max_gb=8
max_s=1800
while [ $# -gt 0 ]; do
case $1 in
-m) max_gb=$2; shift 2 ;;
-t) max_s=$2; shift 2 ;;
-m) [ $# -ge 2 ] || { echo "guard.sh: -m requires a value" >&2; exit 2; }; max_gb=$2; shift 2 ;;
-t) [ $# -ge 2 ] || { echo "guard.sh: -t requires a value" >&2; exit 2; }; max_s=$2; shift 2 ;;
--) shift; break ;;
*) echo "usage: $0 [-m MAX_GB] [-t MAX_SECONDS] -- <command...>" >&2; exit 2 ;;
esac
done
case $max_gb in ''|*[!0-9]*) echo "guard.sh: invalid -m '$max_gb'" >&2; exit 2 ;; esac
case $max_s in ''|*[!0-9]*) echo "guard.sh: invalid -t '$max_s'" >&2; exit 2 ;; esac
command -v ps >/dev/null 2>&1 || { echo "guard.sh: ps is required" >&2; exit 2; }
[ $# -gt 0 ] || { echo "guard.sh: no command" >&2; exit 2; }
# Keep the command's stdin: a plain `cmd &` in a non-interactive shell
# gives the job /dev/null, which silently empties any stdin-fed `lucisv`.
# A CLOSED stdin (`<&-`, some launchers) would make both redirections fail
# and the command never run (exit 1, nothing executed); it gets /dev/null.
# Close fd 3 in both child and guard so neither leaks an extra open pipe end.
{ exec 3<&0; } 2>/dev/null || exec 3</dev/null
"$@" <&3 &
"$@" <&3 3<&- &
root=$!
exec 3<&-
start=$(date +%s)
# The command's process tree: descendants by parent pid, transitively.
@@ -44,10 +49,11 @@ start=$(date +%s)
# the WHOLE list on an empty element ("a,,b") — which a doubled space made
# for any tree three levels deep (cargo → rustc → ld, a test spawning
# lucisv), summing 0 kB and silently disabling the memory limit (§65.3).
# POSIX `ps -Ao` works identically on macOS BSD ps and Linux procps-ng.
tree() {
local all="$1" next
while :; do
next=$(ps -axo pid=,ppid= | awk -v set=" $all " '
next=$(ps -Ao pid=,ppid= | awk -v set=" $all " '
{ if (index(set, " " $2 " ") > 0 && index(set, " " $1 " ") == 0) printf " %s", $1 }')
[ -z "$next" ] && break
all="$all$next"