Add Phase 0 build verification gate (T-004)

This commit is contained in:
ila
2026-07-16 15:51:34 +08:00
parent 6f920eb457
commit 45c242ecec
10 changed files with 458 additions and 29 deletions
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
if python3 --version >/dev/null 2>&1; then
PYTHON=python3
elif python --version >/dev/null 2>&1; then
PYTHON=python
else
echo "ERROR: Python 3 is required." >&2
exit 2
fi
GO_PATH="$(go env GOPATH)"
if command -v cygpath >/dev/null 2>&1; then
GO_PATH="$(cygpath -u "$GO_PATH")"
fi
GO_BIN="$GO_PATH/bin"
if [ -x "$GO_BIN/go1.20.14" ] || [ -x "$GO_BIN/go1.20.14.exe" ]; then
export PATH="$GO_BIN:$PATH"
fi
mkdir -p dist
echo "==> Sync root workspace"
GOTOOLCHAIN=go1.25.0 go work sync
echo "==> Validate harness governance"
"$PYTHON" scripts/validate_agent_context.py
"$PYTHON" -m unittest discover -s tests -p "test_*.py"
"$PYTHON" scripts/validate_harness_governance.py
echo "==> Validate core architecture boundary"
"$PYTHON" scripts/check_core_boundaries.py --self-test
"$PYTHON" scripts/check_core_boundaries.py
echo "==> Validate Go and dependency pins"
GOTOOLCHAIN=go1.20.14 "$PYTHON" scripts/check_go_versions.py
echo "==> Vet and test core with Go 1.20.14"
GOTOOLCHAIN=go1.20.14 GOWORK=off go -C core vet ./...
GOTOOLCHAIN=go1.20.14 GOWORK=off go -C core test -count=1 ./...
echo "==> Test and build modern target with Go 1.25.0"
GOTOOLCHAIN=go1.25.0 GOWORK="$ROOT_DIR/go.work" CGO_ENABLED=0 \
go -C app-modern test -count=1 ./ui/gio ./platform/windows
GOTOOLCHAIN=go1.25.0 GOWORK="$ROOT_DIR/go.work" CGO_ENABLED=0 \
GOOS=windows GOARCH=amd64 \
go -C app-modern build -trimpath -ldflags="-H=windowsgui" \
-o ../dist/SoftBox.exe ./cmd/softbox
echo "==> Test and build Win7 target with Go 1.20.14"
GOTOOLCHAIN=go1.20.14 GOWORK="$ROOT_DIR/app-win7/go.work" CGO_ENABLED=0 \
go -C app-win7 test -count=1 ./ui/gio ./platform/windows
GOTOOLCHAIN=go1.20.14 GOWORK="$ROOT_DIR/app-win7/go.work" CGO_ENABLED=0 \
GOOS=windows GOARCH=amd64 \
go -C app-win7 build -trimpath -ldflags="-H=windowsgui" \
-o ../dist/SoftBox-win7.exe ./cmd/softbox
echo "Phase 0 verification passed."