|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
| 5 | +KEEP_TEMP="0" |
| 6 | +TMP_ROOT="${TMPDIR:-/tmp}" |
| 7 | +WORKDIR="" |
| 8 | + |
| 9 | +usage() { |
| 10 | + cat <<'EOF' |
| 11 | +Usage: |
| 12 | + bash ./scripts/verify_automation_pack_poc.sh [--keep-temp] |
| 13 | +
|
| 14 | +What it does: |
| 15 | + - bootstraps a minimal project without the candidate automation pack |
| 16 | + - checks that the candidate PoC scaffold exists |
| 17 | + - runs a minimal placeholder validation when Python is available |
| 18 | + - prints the current gaps before this PoC can graduate into a real pack |
| 19 | +EOF |
| 20 | +} |
| 21 | + |
| 22 | +log() { |
| 23 | + printf '[verify-automation-poc] %s\n' "$*" |
| 24 | +} |
| 25 | + |
| 26 | +die() { |
| 27 | + printf '[verify-automation-poc] ERROR: %s\n' "$*" >&2 |
| 28 | + exit 1 |
| 29 | +} |
| 30 | + |
| 31 | +for arg in "$@"; do |
| 32 | + case "$arg" in |
| 33 | + --keep-temp) |
| 34 | + KEEP_TEMP="1" |
| 35 | + ;; |
| 36 | + -h|--help) |
| 37 | + usage |
| 38 | + exit 0 |
| 39 | + ;; |
| 40 | + *) |
| 41 | + die "unexpected argument: ${arg}" |
| 42 | + ;; |
| 43 | + esac |
| 44 | +done |
| 45 | + |
| 46 | +cleanup() { |
| 47 | + if [[ -n "${WORKDIR}" && -d "${WORKDIR}" ]]; then |
| 48 | + if [[ "${KEEP_TEMP}" == "1" ]]; then |
| 49 | + log "kept temporary project at ${WORKDIR}" |
| 50 | + else |
| 51 | + rm -rf "${WORKDIR}" |
| 52 | + fi |
| 53 | + fi |
| 54 | +} |
| 55 | + |
| 56 | +trap cleanup EXIT |
| 57 | + |
| 58 | +require_file() { |
| 59 | + local path="$1" |
| 60 | + [[ -f "${path}" ]] || die "required file missing: ${path}" |
| 61 | +} |
| 62 | + |
| 63 | +assert_manifest_lacks_automation() { |
| 64 | + if command -v jq >/dev/null 2>&1; then |
| 65 | + if jq -e '.packs[] | select(.id == "automation")' "${REPO_ROOT}/packs.manifest.json" >/dev/null; then |
| 66 | + die "candidate automation pack unexpectedly appears in packs.manifest.json" |
| 67 | + fi |
| 68 | + return 0 |
| 69 | + fi |
| 70 | + |
| 71 | + if grep -q '"id"[[:space:]]*:[[:space:]]*"automation"' "${REPO_ROOT}/packs.manifest.json"; then |
| 72 | + die "candidate automation pack unexpectedly appears in packs.manifest.json" |
| 73 | + fi |
| 74 | +} |
| 75 | + |
| 76 | +require_file "${REPO_ROOT}/packs/automation/README.md" |
| 77 | +require_file "${REPO_ROOT}/packs/automation/python/requirements-e2e.txt" |
| 78 | +require_file "${REPO_ROOT}/packs/automation/examples/tests/test_ui_smoke_placeholder.py" |
| 79 | +assert_manifest_lacks_automation |
| 80 | + |
| 81 | +WORKDIR="$(mktemp -d "${TMP_ROOT%/}/godot-toolbox-automation-poc.XXXXXX")" |
| 82 | + |
| 83 | +log "bootstrapping minimal temporary project at ${WORKDIR}" |
| 84 | +bash "${REPO_ROOT}/scripts/bootstrap_toolbox_project.sh" "${WORKDIR}" |
| 85 | + |
| 86 | +require_file "${WORKDIR}/godot/project.godot" |
| 87 | +require_file "${WORKDIR}/scripts/gdunit4_smoke.sh" |
| 88 | + |
| 89 | +if [[ -f "${WORKDIR}/.toolbox-packs" ]]; then |
| 90 | + if [[ -n "$(tr -d '[:space:]' < "${WORKDIR}/.toolbox-packs")" ]]; then |
| 91 | + die "expected no packs in minimal bootstrap, found: $(cat "${WORKDIR}/.toolbox-packs")" |
| 92 | + fi |
| 93 | +fi |
| 94 | + |
| 95 | +if command -v python3 >/dev/null 2>&1; then |
| 96 | + log "running placeholder Python validation" |
| 97 | + PLACEHOLDER_PYC="${TMP_ROOT%/}/godot-toolbox-automation-placeholder.pyc" |
| 98 | + rm -f "${PLACEHOLDER_PYC}" |
| 99 | + python3 - <<PY |
| 100 | +import py_compile |
| 101 | +py_compile.compile( |
| 102 | + r"${REPO_ROOT}/packs/automation/examples/tests/test_ui_smoke_placeholder.py", |
| 103 | + cfile=r"${PLACEHOLDER_PYC}", |
| 104 | + doraise=True, |
| 105 | +) |
| 106 | +PY |
| 107 | + rm -f "${PLACEHOLDER_PYC}" |
| 108 | +else |
| 109 | + log "python3 not found; skipped placeholder Python validation" |
| 110 | +fi |
| 111 | + |
| 112 | +log "candidate pack remains intentionally outside packs.manifest.json and default bootstrap" |
| 113 | +log "current gaps:" |
| 114 | +log "1. lock the real GodotE2E Python package name and version strategy" |
| 115 | +log "2. decide whether a Godot-side addon must be vendored for this pack" |
| 116 | +log "3. define the minimal runnable E2E smoke contract for CI" |
| 117 | +log "4. set promotion criteria before adding automation to packs.manifest.json" |
| 118 | +log "PASS" |
0 commit comments