diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 04d35b6..f970a00 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -41,11 +41,11 @@ jobs: # names a packageManager, and then fails on a runner with no pnpm. # This job installs nothing. package-manager-cache: false - - name: Contract tests (manifest, phases, coverage, rebrand, retouch, bootstrap-defer) + - name: Contract tests (manifest, phases, coverage, rebrand, retouch, bootstrap-defer, render) run: | set -euo pipefail python3 -c 'import yaml' 2>/dev/null || pip install --quiet pyyaml - for t in manifest phases coverage rebrand retouch bootstrap-defer; do + for t in manifest phases coverage rebrand retouch bootstrap-defer render; do echo "── $t" bash "testing/$t.test.sh" done diff --git a/hooks/render-deployment-docs.sh b/hooks/render-deployment-docs.sh index 0bbe21c..63de5bf 100644 --- a/hooks/render-deployment-docs.sh +++ b/hooks/render-deployment-docs.sh @@ -53,16 +53,46 @@ badge() { case "$1" in 2*|3*) echo "LIVE ($1)" ;; 000) echo "unreachable" ;; *) # The environment's public origin: SITE_URL from intent.yaml when set (a custom # domain the owner attached), else the workers.dev URL. +# STANDARD LIBRARY ONLY. The build box has python3 but not PyYAML, and an +# `import yaml` that fails ended this hook with exit 1 and no message: +# console builds reached 03-docs and stopped here, with the site live. +# PyYAML is used when present; otherwise the one key this needs is read by +# indentation: environments → → env → SITE_URL. site_url() { python3 - "$1" "https://${brand}-web-$1.${sub}.workers.dev" <<'PY' -import sys, yaml +import re, sys env, fallback = sys.argv[1], sys.argv[2] + +def by_indent(text): + path, want = [], ["environments", env, "env", "SITE_URL"] + for line in text.splitlines(): + if not line.strip() or line.lstrip().startswith("#"): + continue + m = re.match(r"^( *)([A-Za-z0-9_.-]+):(.*)$", line) + if not m: + continue + depth = len(m.group(1)) + while path and path[-1][0] >= depth: + path.pop() + path.append((depth, m.group(2))) + if [k for _, k in path] == want: + value = m.group(3).split(" #")[0].strip() + return value.strip("'\"") + return "" + +try: + text = open("intent.yaml").read() +except OSError: + text = "" try: - d = yaml.safe_load(open("intent.yaml")) or {} + import yaml + d = yaml.safe_load(text) or {} url = (((d.get("environments") or {}).get(env) or {}).get("env") or {}).get("SITE_URL") or "" +except ImportError: + url = by_indent(text) except Exception: url = "" -print(url.rstrip("/") or fallback) +print(str(url).rstrip("/") or fallback) PY } stage_url="$(site_url stage)"; prod_url="$(site_url prod)" diff --git a/specs/epics/angular-boilerplate/risks-and-open-questions.md b/specs/epics/angular-boilerplate/risks-and-open-questions.md index 1b7d5c5..7bece52 100644 --- a/specs/epics/angular-boilerplate/risks-and-open-questions.md +++ b/specs/epics/angular-boilerplate/risks-and-open-questions.md @@ -9,3 +9,4 @@ | NG-E | The template's component-style budget warns | ACCEPTED | The welcome page's inline `