fix: run project scenarios in quality gate

This commit is contained in:
2026-07-05 23:24:17 +02:00
parent fde2101690
commit ac0282716c
3 changed files with 82 additions and 29 deletions
+29 -8
View File
@@ -15,6 +15,7 @@ CHANGED=false
OVERALL=false
ERRORS=()
FIXES=()
OWNED_GDSCRIPT_ROOTS=(player simulation tests tools world)
# -- tool detection -----------------------------------------------------------
find_godot() {
@@ -86,7 +87,7 @@ else
echo "($bad/$total files need formatting)" >> "$LOG/gdformat.log"
fi
else
$fmt_tool --check . >> "$LOG/gdformat.log" 2>&1 || true
$fmt_tool --check "${OWNED_GDSCRIPT_ROOTS[@]}" >> "$LOG/gdformat.log" 2>&1 || true
fi
fi
@@ -119,7 +120,7 @@ else
done <<< "$files"
fi
else
$lint_tool . >> "$LOG/gdlint.log" 2>&1 || true
$lint_tool "${OWNED_GDSCRIPT_ROOTS[@]}" >> "$LOG/gdlint.log" 2>&1 || true
fi
fi
@@ -146,21 +147,20 @@ fi
# -- 3. godot headless check --------------------------------------------------
godot_result="PASS"
: > "$LOG/godot-check.log"
GODOT_CMD="$GODOT --headless --path \"$ROOT\" --check-only --quit"
if need_timeout; then
if timeout 30 $GODOT_CMD >> "$LOG/godot-check.log" 2>&1; then
if timeout 30 "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
godot_result="PASS"
else
ec=$?
if [[ $ec -eq 124 ]]; then
godot_result="PASS"
godot_result="FAIL"
echo "[timed out after 30s — project runs continuously]" >> "$LOG/godot-check.log"
else
godot_result="FAIL"
fi
fi
else
if $GODOT --headless --path "$ROOT" --quit >> "$LOG/godot-check.log" 2>&1; then
if "$GODOT" --headless --path "$ROOT" --script res://tests/simulation_definitions_test.gd >> "$LOG/godot-check.log" 2>&1; then
godot_result="PASS"
else
godot_result="FAIL"
@@ -173,7 +173,26 @@ if [[ "$godot_result" == "FAIL" ]]; then
FIXES+=("Fix Godot parser errors")
fi
# -- 4. GUT (optional) --------------------------------------------------------
# -- 4. project scenario tests ------------------------------------------------
scenario_result="PASS"
: > "$LOG/scenarios.log"
for test in tests/*_test.gd; do
echo "[RUN] $(basename "$test")" >> "$LOG/scenarios.log"
if need_timeout; then
if ! timeout 30 "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
scenario_result="FAIL"
ERRORS+=("scenario: $(basename "$test") failed or timed out")
fi
elif ! "$GODOT" --headless --path "$ROOT" --script "res://$test" >> "$LOG/scenarios.log" 2>&1; then
scenario_result="FAIL"
ERRORS+=("scenario: $(basename "$test") failed")
fi
done
if [[ "$scenario_result" == "FAIL" ]]; then
FIXES+=("Fix failing project scenario tests")
fi
# -- 5. GUT (optional) --------------------------------------------------------
gut_result="SKIPPED"
: > "$LOG/gut.log"
if [[ -f "addons/gut/gut_cmdln.gd" ]]; then
@@ -189,7 +208,7 @@ if [[ -f "addons/gut/gut_cmdln.gd" ]]; then
fi
# -- summary ------------------------------------------------------------------
if [[ "$fmt_result" == "FAIL" || "$lint_result" == "FAIL" || "$godot_result" == "FAIL" || "$gut_result" == "FAIL" ]]; then
if [[ "$fmt_result" == "FAIL" || "$lint_result" == "FAIL" || "$godot_result" == "FAIL" || "$scenario_result" == "FAIL" || "$gut_result" == "FAIL" ]]; then
OVERALL=true
fi
@@ -203,6 +222,7 @@ echo ""
echo " gdformat $fmt_result"
echo " gdlint $lint_result"
echo " godot-check $godot_result"
echo " scenarios $scenario_result"
echo " gut $gut_result"
seen_err=()
@@ -236,6 +256,7 @@ echo ""
echo " gdformat $fmt_result"
echo " gdlint $lint_result"
echo " godot-check $godot_result"
echo " scenarios $scenario_result"
echo " gut $gut_result"
} > "$LOG/summary.txt"