e92fb75dd9
Test / test (pull_request) Successful in 36m3s
The wasm bundles in solitaire_server/web/pkg/ are no longer tracked. The web-wasm-rebuild workflow (which rebuilt them in CI and committed them back to master) is gone; instead: - solitaire_server/Dockerfile gains a wasm-builder stage that runs build_wasm.sh with the same pinned toolchain (wasm-bindgen 0.2.120, wasm-pack 0.14.0, binaryen 130) and the runtime image copies pkg/ from it — the image build is now the artifacts' single source of truth. - web-e2e builds the wasm before Playwright runs, and its trigger paths now include the wasm-feeding crates it actually tests. - docker-build triggers on solitaire_data/** and build_wasm.sh too, so every wasm-affecting change redeploys. - Self-hosters serving /web or /play from a source checkout run ./build_wasm.sh once (script header and ARCHITECTURE.md updated). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
66 lines
2.6 KiB
Bash
Executable File
66 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Live-watch the Gitea Actions deploy pipeline for Ferrous Solitaire.
|
|
#
|
|
# Polls recent workflow runs and prints a compact status block each cycle.
|
|
# Stops when the newest docker-build (the deploy) has completed — the wasm
|
|
# is built inside that image build, so no other workflow gates the deploy.
|
|
#
|
|
# Usage: ./scripts/watch_deploy.sh [interval_seconds]
|
|
# token is read from ~/.config/tea/config.yml (never printed).
|
|
set -uo pipefail
|
|
|
|
REPO="funman300/Ferrous-Solitaire"
|
|
BASE="https://git.aleshym.co/api/v1/repos/${REPO}"
|
|
INTERVAL="${1:-20}"
|
|
CFG="${HOME}/.config/tea/config.yml"
|
|
|
|
TOKEN="$(grep -E '^[[:space:]]*token:' "$CFG" | head -1 | sed -E 's/.*token:[[:space:]]*//' | tr -d '"'\'' ')"
|
|
[ -z "$TOKEN" ] && { echo "error: no token in $CFG" >&2; exit 1; }
|
|
|
|
echo "── watching ${REPO} deploy (poll ${INTERVAL}s, Ctrl-C to stop) ──"
|
|
|
|
while :; do
|
|
json="$(curl -s --max-time 20 -H "Authorization: token ${TOKEN}" "${BASE}/actions/runs?limit=6")"
|
|
# Print rows + emit the deploy state on the last line (parsed below).
|
|
# JSON is passed via env var because `python3 -` reads its program from the
|
|
# heredoc on stdin, so stdin can't also carry the data.
|
|
out="$(JSON_DATA="$json" python3 - <<'PY'
|
|
import os, sys, json, datetime
|
|
now = datetime.datetime.now().strftime("%H:%M:%S")
|
|
raw = os.environ.get("JSON_DATA", "").strip()
|
|
try:
|
|
d = json.loads(raw)
|
|
except Exception:
|
|
print("[%s] (api unavailable, retrying)" % now)
|
|
print("STATE=DEPLOYING")
|
|
sys.exit(0)
|
|
runs = d.get("workflow_runs", [])[:6]
|
|
icons = {("completed","success"):"OK ", ("completed","failure"):"FAIL",
|
|
("completed","cancelled"):"CXL "}
|
|
def ic(s, c):
|
|
if s == "queued": return "queue"
|
|
if s == "in_progress": return "run.."
|
|
return icons.get((s, c), s or "?")
|
|
print("[%s]" % datetime.datetime.now().strftime("%H:%M:%S"))
|
|
for r in runs:
|
|
wf = str(r.get("path","")).split("@")[0].split("/")[-1].replace(".yml","")
|
|
print(" %-5s %-5s %-7s %-18s %s/%s" % (
|
|
ic(r.get("status"), r.get("conclusion")),
|
|
r.get("id"), str(r.get("head_sha"))[:7], wf[:18],
|
|
r.get("status"), r.get("conclusion")))
|
|
db = [r for r in runs if "docker-build" in str(r.get("path"))]
|
|
top = db[0] if db else None
|
|
live = bool(top and top.get("status")=="completed" and top.get("conclusion")=="success")
|
|
print("STATE=%s" % ("LIVE" if live else "DEPLOYING"))
|
|
PY
|
|
)"
|
|
echo "$out" | grep -v '^STATE='
|
|
if echo "$out" | grep -q '^STATE=LIVE'; then
|
|
echo ""
|
|
echo "DEPLOY LIVE — newest docker-build succeeded."
|
|
echo " Test: https://klondike.aleshym.co/play?v=${RANDOM}"
|
|
break
|
|
fi
|
|
sleep "$INTERVAL"
|
|
done
|