#!/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: .name and .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; }