Files
CatoandClaude Opus 5.5 f2ada23b82 feat(ci): fleet gets a verify, so the forge merge check can merge it (#573)
GitHub Actions has been off for the org since 2026-11-15, and fleet's main
required two Actions jobs (`verify`, `app-template`) that never came — so no
fleet PR could merge. The forge merge bridge merges any repo that has a
`verify` script; fleet had none.

- package.json + an empty pnpm lockfile: `pnpm run verify` = scripts/ci/verify.sh,
  which runs every `run:` of ci.yml's `verify` and `app-template` jobs, read
  from the YAML — ci.yml stays the one definition. Runs all, exits on the verdict.
- main was RED behind the outage: #570 removed the sweep from the templates but
  three checks still required it. The merge path is now "has a `verify`" (what
  forge/verify runs), with a test that it bites; fleet's own-caller assertions
  became "fleet ships no sweep caller".
- templates/app: next 16.4.1 -> 16.4.6. Next's build refuses the vulnerable
  version, so every product created from the starter failed its first build.
- SWC 1.16 refuses a cache under a group-writable parent (~/.cache on the
  laptop runner): verify points it at the 0700 runtime dir.

verify: 57 passed, 0 failed (incl. the full template render/install/build).

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:55:06 +01:00

79 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# fleet's `verify` — what its CI checks, runnable anywhere.
#
# GitHub stopped running Actions for the org on 2026-11-15. The forge merge
# bridge (forge-ops merge-bridge.sh) verifies and merges PRs on Gitea instead,
# but only for a repo with a `verify` script — and fleet had none, so its PRs
# could not merge at all while its branch protection waited for Actions jobs
# that never came. This makes fleet verifiable by the same rule as every
# product: verify IS CI.
#
# It does not restate the checks. It reads them from .github/workflows/ci.yml:
# every `run:` of the `verify` job, in order, then the `app-template` job's own
# command. So the CI file stays the one definition, and a step added there is
# verified here on the next run without touching this file.
#
# Every step runs even after one fails, so one run shows every red, and the
# exit status is the verdict.
#
# pnpm run verify # what the bridge runs
# VERIFY_SKIP_TEMPLATE=1 pnpm run verify # the fast half (no template install)
# DATABASE_URL=postgres://…/x_test … # + the template's integration suite
set -uo pipefail
cd "$(dirname "$0")/../.."
command -v python3 >/dev/null || { echo "verify: python3 is required"; exit 1; }
python3 -c 'import yaml' 2>/dev/null || { echo "verify: python3 yaml (PyYAML) is required"; exit 1; }
# SWC 1.16 refuses a native-binding cache whose parent is group-writable, and
# on the laptop runner ~/.cache is 775 — the template build then dies with
# ERR_SWC_NATIVE_CACHE. A private (0700) runtime dir satisfies it.
if [ -z "${SWC_NATIVE_BINDING_CACHE:-}" ] && [ -d "${XDG_RUNTIME_DIR:-}" ]; then
export SWC_NATIVE_BINDING_CACHE="$XDG_RUNTIME_DIR/swc-native"
fi
STEPS="$(mktemp -d)"
MAINPID=$$
trap '[ "$$" = "$MAINPID" ] && rm -rf "$STEPS"' EXIT
# One file per step: <nnn>.name and <nnn>.sh. Steps that use an action rather
# than `run:` (checkout, setup-node) are the runner's job, not a check.
python3 - "$STEPS" <<'PY' || { echo "verify: could not read ci.yml"; exit 1; }
import sys, yaml, os
out = sys.argv[1]
wf = yaml.safe_load(open(".github/workflows/ci.yml"))
jobs = wf["jobs"]
n = 0
for job in ("verify", "app-template"):
if job not in jobs:
sys.exit(f"ci.yml has no job '{job}' — verify.sh must be updated with it")
for st in jobs[job]["steps"]:
if "run" not in st:
continue
n += 1
name = f"{job}: {st.get('name', st['run'].splitlines()[0])}"
open(os.path.join(out, f"{n:03d}.name"), "w").write(name)
open(os.path.join(out, f"{n:03d}.sh"), "w").write(st["run"])
if n == 0:
sys.exit("ci.yml yielded no steps — refusing to call that green")
PY
pass=0 fail=0 failed=()
for sh in "$STEPS"/*.sh; do
name="$(cat "${sh%.sh}.name")"
case "$name" in "app-template:"*) [ -n "${VERIFY_SKIP_TEMPLATE:-}" ] && { echo "⊘ $name (VERIFY_SKIP_TEMPLATE)"; continue; } ;; esac
log="${sh%.sh}.log"
start=$SECONDS
if bash -euo pipefail "$sh" >"$log" 2>&1; then
pass=$((pass + 1)); echo "✓ $name ($((SECONDS - start))s)"
else
fail=$((fail + 1)); failed+=("$name"); echo "✗ $name ($((SECONDS - start))s)"
tail -25 "$log" | sed 's/^/ /'
fi
done
echo "verify: $pass passed, $fail failed"
[ "$fail" -eq 0 ] || { printf ' failed: %s\n' "${failed[@]}"; exit 1; }