name: Automated Tests # 注意:仓库已初始化 git(尚无远端)——本 workflow 在首次 push 到 GitHub 后自动生效;远端仓库建好后无需改本文件即自动生效。 # 载体 = ADR-0004(双载体):逻辑冒烟 + 场景探针;gdUnit4 deferred(不使用 gdUnit4-action)。 # 外部 wall-clock 超时(timeout 命令)为 ADR-0004 硬性要求——引擎自身无死锁探测。 # 路径口径:2026-09-27 三层收敛(7f24b640)后工程在 game/——tests 归 game/tests/、探针在 game/smoke/。 # 轻闸探针口径(2026-10-08 CI 预接线批/迭代19卡③):三探针=ui_input/ui_struct/ui_contrast # (tools/probe_gate.sh 默认段同款);ui_probe/ui_click/ui_tune/t17_defer/fx 归 --full 重闸不入轻 CI; # 窗口化四件(shot/fx_shot/board_shot/ui_audit)禁入 headless CI(无渲染面、探针内 fail-fast); # 判定=timeout 外壳+退出码超时判+PASS 串判定,镜像 probe_gate 判定逻辑的 Linux 形态。 on: push: branches: [master] pull_request: branches: [master] jobs: static-scan: name: Static scan (ADR-0004 S1–S8) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Run static scan run: bash game/tests/static_scan.sh smoke: name: Headless smoke (Godot 4.7.2) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Godot 4.7.2 # 2026-10-08 尾裁微批c(卡③S1 用户裁甲):nikeee/godot-actions/setup-godot@v2 下载 404 # (卡③轻 CI 首跑实证:setup 步骤 release 资产拉取失败)——换 chickensoft-games/setup-godot@v2, # version 参数语义不变(4.7.2)。 uses: chickensoft-games/setup-godot@v2 with: version: 4.7.2 # 冷检出导入(.godot 不入 git,fresh checkout 首跑一次性付清;probe_gate 本机经验 1-2 分钟) - name: Import assets (cold checkout, one-time) run: timeout 300s godot --headless --path game --import # 逻辑冒烟(run_all.gd 内登记套件 manifest) - name: Run smoke runner (external timeout per ADR-0004) run: timeout 120s godot --headless --path game --script res://tests/run_all.gd # 场景探针(轻闸三探针=probe_gate 默认段同款;probe_gate.sh 本体系 Windows 专用 # 〔PowerShell+taskkill〕CI 不可调用,此处为其判定逻辑的 Linux 独立命令形态: # 每探针 timeout 外壳 + 退出码超时判〔124/137=挂死〕+ PASS 串判定〔只跑不判=违 ADR-0004〕; # 三探针全跑不短路,末尾按汇总退出码定段红绿) - name: Run scene probes (light-gate trio, timeout + PASS check per ADR-0004) run: | mkdir -p logs/probe_ci run_probe() { name="$1"; scene="$2" echo "======== $name ========" st=0 timeout 120s godot --headless --path game "res://smoke/$scene" >"logs/probe_ci/$name.log" 2>&1 || st=$? tail -n 20 "logs/probe_ci/$name.log" if [ "$st" -eq 124 ] || [ "$st" -eq 137 ]; then echo "[ci-probe] FAIL — $name 超时挂死(exit=$st)"; return 1 elif ! grep -q "PASS" "logs/probe_ci/$name.log"; then echo "[ci-probe] FAIL — $name 未见 PASS(exit=$st)"; return 1 fi } rc=0 run_probe ui_input_probe ui_input_probe.tscn || rc=1 run_probe ui_struct_probe ui_struct_probe.tscn || rc=1 run_probe ui_contrast_probe ui_contrast_probe.tscn || rc=1 exit $rc - name: Upload Test Results if: always() uses: actions/upload-artifact@v4 with: name: test-results path: | logs/ reports/ if-no-files-found: ignore