test(11.2): complete the phase gate

- --built: build.sh (release when the framework checkout has v0.1.0, else
  dev), then TestLandingLinks, TestTerminalCommandsInPage and
  TestDocsHeaderSiteLink with SUMMERCMS_REQUIRE_BUILD=1, required to PASS
- --smoke and --deploy require smoke: ok and check-deploy: ok
- --terminal runs TestTerminalCommands with this checkout as the clone URL;
  --verbatim leaves the page's URL for the cutover run
- --full runs the framework's whole suite; --all runs every stage in order
This commit is contained in:
Jakub Zych
2026-10-01 16:39:09 +02:00
parent f5f9387ac9
commit 29adc23595

View File

@@ -32,6 +32,12 @@ usage:
check-phase11.2.sh --plugin
check-phase11.2.sh --app
check-phase11.2.sh --site
check-phase11.2.sh --built
check-phase11.2.sh --smoke
check-phase11.2.sh --deploy
check-phase11.2.sh --terminal [--verbatim]
check-phase11.2.sh --full
check-phase11.2.sh --all
EOF
exit 2
}
@@ -193,10 +199,107 @@ run_site() {
echo "phase11.2 site passed"
}
case "${1:-}" in
# Build-dependent plugin tests: they skip without SUMMERCMS_REQUIRE_BUILD
# and fail (not skip) on a missing build with it, so the gate sets it.
BUILT_TESTS=(TestLandingLinks TestTerminalCommandsInPage TestDocsHeaderSiteLink)
# run_built builds bin/summercms-io and the embedded trees, then requires the
# build-dependent plugin tests to PASS against them. The build is a release
# build when the framework checkout build.sh uses has the v0.1.0 tag (D-42),
# else a dev build from the framework HEAD.
run_built() {
local fw="${SUMMERCMS_FRAMEWORK:-$ROOT}" mode=dev
need_dir "$APP"
if git -C "$fw" rev-parse -q --verify refs/tags/v0.1.0 >/dev/null; then
mode=release
echo "built: v0.1.0 found in $fw, release build"
else
echo "built: no v0.1.0 tag in $fw, dev build (framework HEAD)"
fi
"$APP/scripts/build.sh" "$mode"
(export SUMMERCMS_REQUIRE_BUILD=1 && named_tests "$PLUG" . "${BUILT_TESTS[@]}") || refuse "built: build-dependent plugin tests"
echo "phase11.2 built passed"
}
# expect_line CMD... runs a script and requires its own success line ($1).
expect_line() {
local want="$1" log code=0
shift
log="$(mktemp)"
SCRATCH+=("$log")
"$@" >"$log" 2>&1 || code=$?
cat "$log"
[ "$code" -eq 0 ] || refuse "$1 exited $code"
grep -qx -- "$want" "$log" || refuse "$1 printed no '$want' line"
}
run_smoke() {
expect_line "smoke: ok" "$APP/scripts/smoke.sh"
echo "phase11.2 smoke passed"
}
run_deploy() {
expect_line "check-deploy: ok" "$APP/scripts/check-deploy.sh"
echo "phase11.2 deploy passed"
}
# run_terminal runs the landing page's six commands from a fresh shell
# (D-40) with TestTerminalCommands required to PASS. By default the clone
# URL is this checkout, because the public repository may not exist yet;
# --verbatim leaves the page's URL untouched, the cutover run after D-38.
# The variables are set in subshells on purpose: they apply to one run only.
# shellcheck disable=SC2030,SC2031
run_terminal() {
need_dir "$APP"
if [ "${1:-}" = --verbatim ]; then
echo "terminal: verbatim, cloning the page's URL"
(unset SUMMERCMS_CLONE_URL && export SUMMERCMS_TERMINAL_CHECK=1 &&
named_tests "$APP" . TestTerminalCommands) || refuse "terminal: TestTerminalCommands (verbatim)"
else
echo "terminal: clone override $ROOT"
(export SUMMERCMS_TERMINAL_CHECK=1 SUMMERCMS_CLONE_URL="$ROOT" &&
named_tests "$APP" . TestTerminalCommands) || refuse "terminal: TestTerminalCommands"
fi
echo "phase11.2 terminal passed"
}
# run_full is the framework's whole suite, the Docker-backed database
# suites included.
run_full() {
(cd "$ROOT" && go vet ./... && go test ./... -count=1)
echo "phase11.2 full passed"
}
MODE="${1:-}"
if [ "$MODE" = --terminal ]; then
if [ $# -gt 2 ] || { [ $# -eq 2 ] && [ "$2" != --verbatim ]; }; then
usage
fi
elif [ $# -ne 1 ]; then
usage
fi
case "$MODE" in
--framework) run_framework ;;
--plugin) run_plugin ;;
--app) run_app ;;
--site) run_site ;;
--built) run_built ;;
--smoke) run_smoke ;;
--deploy) run_deploy ;;
--terminal) run_terminal "${2:-}" ;;
--full) run_full ;;
--all)
run_framework
run_plugin
run_app
run_site
run_built
run_smoke
run_deploy
run_terminal
run_full
echo "phase11.2 all passed"
;;
*) usage ;;
esac