chore: install gut quality suite

This commit is contained in:
Rijad Zuzo
2026-07-10 15:59:46 +02:00
parent ce8f71082b
commit 2ed93de6d1
266 changed files with 23057 additions and 21 deletions
+62 -8
View File
@@ -95,6 +95,41 @@ if [[ -z "$GODOT" ]]; then
fi
GODOT_ENV=(env "HOME=$GODOT_PROFILE" "APPDATA=$GODOT_PROFILE" "LOCALAPPDATA=$GODOT_PROFILE")
# -- 0. Godot import bootstrap ------------------------------------------------
import_result="PASS"
: > "$LOG/godot-import.log"
class_cache="$ROOT/.godot/global_script_class_cache.cfg"
needs_import=false
[[ ! -f "$class_cache" ]] && needs_import=true
if [[ -f "addons/gut/gut_cmdln.gd" ]] && ! grep -q '"class": &"GutTest"' "$class_cache" 2>/dev/null; then
needs_import=true
fi
if $needs_import; then
if need_timeout; then
timeout 60 "${GODOT_ENV[@]}" "$GODOT" --headless --path "$ROOT" --import >> "$LOG/godot-import.log" 2>&1
import_exit=$?
else
"${GODOT_ENV[@]}" "$GODOT" --headless --path "$ROOT" --import >> "$LOG/godot-import.log" 2>&1
import_exit=$?
fi
if [[ $import_exit -ne 0 ]]; then
import_result="FAIL"
fi
fi
if [[ ! -f "$class_cache" ]] || ! grep -q '"class": &"SimNPC"' "$class_cache"; then
import_result="FAIL"
fi
if [[ -f "addons/gut/gut_cmdln.gd" ]] && ! grep -q '"class": &"GutTest"' "$class_cache" 2>/dev/null; then
import_result="FAIL"
fi
if grep -qE "SCRIPT ERROR:|Parse Error:|Failed to load script" "$LOG/godot-import.log"; then
import_result="FAIL"
fi
if [[ "$import_result" == "FAIL" ]]; then
ERRORS+=("godot-import: failed to build the global class cache")
FIXES+=("Fix Godot import errors before running headless checks")
fi
# -- 1. gdformat --------------------------------------------------------------
fmt_tool=$(find_gdformat) || true
fmt_result="PASS"
@@ -231,23 +266,40 @@ if [[ "$scenario_result" == "FAIL" ]]; then
FIXES+=("Fix failing project scenario tests")
fi
# -- 5. GUT (optional) --------------------------------------------------------
gut_result="SKIPPED"
# -- 5. GUT -------------------------------------------------------------------
gut_result="PASS"
: > "$LOG/gut.log"
if [[ -f "addons/gut/gut_cmdln.gd" ]]; then
if "${GODOT_ENV[@]}" "$GODOT" --headless --path "$ROOT" -s addons/gut/gut_cmdln.gd >> "$LOG/gut.log" 2>&1; then
if [[ ! -f "addons/gut/gut_cmdln.gd" ]]; then
gut_result="FAIL"
ERRORS+=("gut: pinned addon is missing")
FIXES+=("Restore addons/gut from pinned GUT v9.7.1")
else
gut_command=(
"${GODOT_ENV[@]}" "$GODOT" --headless --path "$ROOT"
-s addons/gut/gut_cmdln.gd -gexit -gdisable_colors
)
if need_timeout; then
timeout 30 "${gut_command[@]}" >> "$LOG/gut.log" 2>&1
gut_exit=$?
else
"${gut_command[@]}" >> "$LOG/gut.log" 2>&1
gut_exit=$?
fi
if [[ $gut_exit -eq 0 ]]; then
gut_result="PASS"
else
gut_result="FAIL"
grep -iE "fail|error|assert" "$LOG/gut.log" 2>/dev/null | head -20 | while IFS= read -r errline; do
ERRORS+=("gut: $errline")
done
FIXES+=("Fix failing GUT tests")
fi
if grep -qE "Some GUT class_names have not been imported|SCRIPT ERROR:|Parse Error:|Failed to load script" "$LOG/gut.log"; then
gut_result="FAIL"
ERRORS+=("gut: addon or unit tests failed to load")
FIXES+=("Run Godot 4.7 headless import and fix GUT load errors")
fi
fi
# -- summary ------------------------------------------------------------------
if [[ "$fmt_result" == "FAIL" || "$lint_result" == "FAIL" || "$godot_result" == "FAIL" || "$scenario_result" == "FAIL" || "$gut_result" == "FAIL" ]]; then
if [[ "$import_result" == "FAIL" || "$fmt_result" == "FAIL" || "$lint_result" == "FAIL" || "$godot_result" == "FAIL" || "$scenario_result" == "FAIL" || "$gut_result" == "FAIL" ]]; then
OVERALL=true
fi
@@ -258,6 +310,7 @@ else
echo "QUALITY RESULT: PASS"
fi
echo ""
echo " godot-import $import_result"
echo " gdformat $fmt_result"
echo " gdlint $lint_result"
echo " godot-check $godot_result"
@@ -294,6 +347,7 @@ echo ""
{
echo "QUALITY RESULT: $($OVERALL && echo FAIL || echo PASS)"
echo ""
echo " godot-import $import_result"
echo " gdformat $fmt_result"
echo " gdlint $lint_result"
echo " godot-check $godot_result"