NS-21: fail CI if Godot logs SCRIPT ERROR during GdUnit discovery

GdUnit exits 0 when broken suites are skipped; grep log for parse/load errors.
pull/26/head
VinPropane 2026-04-06 22:34:43 -04:00
parent 4f46fa580b
commit da72ea8264
2 changed files with 18 additions and 1 deletions

View File

@ -70,7 +70,22 @@ jobs:
exit 1 exit 1
} }
# GdUnit returns 0 if *executed* tests pass, even when Godot logs SCRIPT ERROR during suite
# discovery (broken test files are skipped). Fail the job if those errors appear in output.
- name: GDUnit4 (headless) - name: GDUnit4 (headless)
working-directory: client working-directory: client
shell: bash
run: | run: |
~/godot/Godot_v4.6-stable_linux.x86_64 --headless --path . -s "$GDUNIT_CMDTOOL" --ignoreHeadlessMode -a res://test set -euo pipefail
LOG="$(mktemp)"
trap 'rm -f "$LOG"' EXIT
~/godot/Godot_v4.6-stable_linux.x86_64 --headless --path . -s "$GDUNIT_CMDTOOL" --ignoreHeadlessMode -a res://test 2>&1 | tee "$LOG"
godot_ec="${PIPESTATUS[0]}"
if [[ "$godot_ec" -ne 0 ]]; then
echo "::error::Godot/GdUnit exited with code ${godot_ec}"
exit "$godot_ec"
fi
if grep -E 'SCRIPT ERROR:|ERROR: Failed to load script' "$LOG"; then
echo "::error::Godot reported script parse/load errors (suites may have been skipped). Fix the test scripts."
exit 1
fi

View File

@ -100,6 +100,8 @@ godot --headless --path . -s res://addons/gdUnit4/bin/GdUnitCmdTool.gd --ignoreH
On **Linux** (including GitHub Actions), the path must be **`gdUnit4`** with a capital **`U`**; `gdunit4` does not resolve. On **Linux** (including GitHub Actions), the path must be **`gdUnit4`** with a capital **`U`**; `gdunit4` does not resolve.
**CI:** The **GDScript** workflow fails the job if Godot prints **`SCRIPT ERROR:`** or **`ERROR: Failed to load script`** while running GdUnit. GdUnit alone can still exit **0** when a test file fails to parse (that suite is skipped); the workflow guards against that.
**Scope:** Unit tests cover **`player.gd`**, **`position_authority_client.gd`**, and **`ground_pick.gd`** (walkable collider check). **`main.gd`**, full **`_input` / ray pick** flows, and scene wiring are **not** automated here—use manual checks above. **Scope:** Unit tests cover **`player.gd`**, **`position_authority_client.gd`**, and **`ground_pick.gd`** (walkable collider check). **`main.gd`**, full **`_input` / ray pick** flows, and scene wiring are **not** automated here—use manual checks above.
**Reports:** GdUnit writes under **`reports/`** (gitignored); ignore locally generated HTML/XML when committing. **Reports:** GdUnit writes under **`reports/`** (gitignored); ignore locally generated HTML/XML when committing.