chore: install gut quality suite
This commit is contained in:
+52
-6
@@ -163,6 +163,40 @@ if (-not $GODOT) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# -- 0. Godot import bootstrap ------------------------------------------------
|
||||
$importResult = "PASS"
|
||||
Set-Content -Path "$LOG/godot-import.log" -Value "" -Encoding utf8
|
||||
$classCache = Join-Path $ROOT ".godot/global_script_class_cache.cfg"
|
||||
$hasProjectClasses = (Test-Path $classCache) -and
|
||||
(Select-String -Path $classCache -SimpleMatch '"class": &"SimNPC"' -Quiet)
|
||||
$hasGutClasses = (Test-Path $classCache) -and
|
||||
(Select-String -Path $classCache -SimpleMatch '"class": &"GutTest"' -Quiet)
|
||||
$needsImport = (-not $hasProjectClasses) -or
|
||||
((Test-Path "addons/gut/gut_cmdln.gd") -and (-not $hasGutClasses))
|
||||
if ($needsImport) {
|
||||
$importArgs = "--headless --path `"$ROOT`" --import"
|
||||
$importOutput, $importExit = Invoke-GodotWithTimeout -ArgumentString $importArgs
|
||||
$importOutput | Add-Content -Path "$LOG/godot-import.log" -Encoding utf8
|
||||
if ($importExit -eq $null -or $importExit -ne 0) {
|
||||
$importResult = "FAIL"
|
||||
}
|
||||
}
|
||||
$hasProjectClasses = (Test-Path $classCache) -and
|
||||
(Select-String -Path $classCache -SimpleMatch '"class": &"SimNPC"' -Quiet)
|
||||
$hasGutClasses = (Test-Path $classCache) -and
|
||||
(Select-String -Path $classCache -SimpleMatch '"class": &"GutTest"' -Quiet)
|
||||
if (-not $hasProjectClasses -or ((Test-Path "addons/gut/gut_cmdln.gd") -and (-not $hasGutClasses))) {
|
||||
$importResult = "FAIL"
|
||||
}
|
||||
$importLoadError = Select-String -Path "$LOG/godot-import.log" -Pattern 'SCRIPT ERROR:|Parse Error:|Failed to load script' -Quiet
|
||||
if ($importLoadError) {
|
||||
$importResult = "FAIL"
|
||||
}
|
||||
if ($importResult -eq "FAIL") {
|
||||
$ERRORS += "godot-import: failed to build the global class cache"
|
||||
$FIXES += "Fix Godot import errors before running headless checks"
|
||||
}
|
||||
|
||||
# -- 1. gdformat --------------------------------------------------------------
|
||||
$fmtAvail = Test-GdFormat
|
||||
$fmtResult = "PASS"
|
||||
@@ -285,13 +319,17 @@ if ($scenarioResult -eq "FAIL") {
|
||||
$FIXES += "Fix failing project scenario tests"
|
||||
}
|
||||
|
||||
# -- 5. GUT (optional) --------------------------------------------------------
|
||||
$gutResult = "SKIPPED"
|
||||
# -- 5. GUT -------------------------------------------------------------------
|
||||
$gutResult = "PASS"
|
||||
Set-Content -Path "$LOG/gut.log" -Value "" -Encoding utf8
|
||||
if (Test-Path "addons/gut/gut_cmdln.gd") {
|
||||
$gutArgs = "--headless --path `"$ROOT`" -s addons/gut/gut_cmdln.gd --quit"
|
||||
if (-not (Test-Path "addons/gut/gut_cmdln.gd")) {
|
||||
$gutResult = "FAIL"
|
||||
$ERRORS += "gut: pinned addon is missing"
|
||||
$FIXES += "Restore addons/gut from pinned GUT v9.7.1"
|
||||
} else {
|
||||
$gutArgs = "--headless --path `"$ROOT`" -s addons/gut/gut_cmdln.gd -gexit -gdisable_colors"
|
||||
$gutOutput, $gutExit = Invoke-GodotWithTimeout -ArgumentString $gutArgs
|
||||
$gutOutput | Out-File -FilePath "$LOG/gut.log" -Encoding utf8
|
||||
$gutOutput | Add-Content -Path "$LOG/gut.log" -Encoding utf8
|
||||
if ($gutExit -eq $null) {
|
||||
$gutResult = "FAIL"
|
||||
Add-Content -Path "$LOG/gut.log" -Value "[timed out after 30s]" -Encoding utf8
|
||||
@@ -306,16 +344,23 @@ if (Test-Path "addons/gut/gut_cmdln.gd") {
|
||||
}
|
||||
$FIXES += "Fix failing GUT tests"
|
||||
}
|
||||
$gutLoadError = Select-String -Path "$LOG/gut.log" -Pattern 'Some GUT class_names have not been imported|SCRIPT ERROR:|Parse Error:|Failed to load script' -Quiet
|
||||
if ($gutLoadError) {
|
||||
$gutResult = "FAIL"
|
||||
$ERRORS += "gut: addon or unit tests failed to load"
|
||||
$FIXES += "Run Godot 4.7 headless import and fix GUT load errors"
|
||||
}
|
||||
}
|
||||
|
||||
# -- summary ------------------------------------------------------------------
|
||||
if ($fmtResult -eq 'FAIL' -or $lintResult -eq 'FAIL' -or $godotResult -eq 'FAIL' -or $scenarioResult -eq 'FAIL' -or $gutResult -eq 'FAIL') {
|
||||
if ($importResult -eq 'FAIL' -or $fmtResult -eq 'FAIL' -or $lintResult -eq 'FAIL' -or $godotResult -eq 'FAIL' -or $scenarioResult -eq 'FAIL' -or $gutResult -eq 'FAIL') {
|
||||
$OVERALL = $true
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
if ($OVERALL) { Write-Host "QUALITY RESULT: FAIL" } else { Write-Host "QUALITY RESULT: PASS" }
|
||||
Write-Host ""
|
||||
Write-Host " godot-import $importResult"
|
||||
Write-Host " gdformat $fmtResult"
|
||||
Write-Host " gdlint $lintResult"
|
||||
Write-Host " godot-check $godotResult"
|
||||
@@ -352,6 +397,7 @@ if ($OVERALL) { $resultText = "FAIL" } else { $resultText = "PASS" }
|
||||
$summary = @"
|
||||
QUALITY RESULT: $resultText
|
||||
|
||||
godot-import $importResult
|
||||
gdformat $fmtResult
|
||||
gdlint $lintResult
|
||||
godot-check $godotResult
|
||||
|
||||
Reference in New Issue
Block a user