#!/usr/bin/env bash set -euo pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" "$script_dir/godot-import.sh" GODOT_BIN="${GODOT_BIN:-/snap/bin/godot4}" if [[ ! -x "$GODOT_BIN" ]]; then GODOT_BIN="$(command -v godot4 || command -v godot || true)" fi : "${GODOT_BIN:?Set GODOT_BIN or install godot4/godot}" log_path="$(mktemp)" trap 'rm -f "$log_path"' EXIT set +e "$GODOT_BIN" --headless --path . -s res://addons/gut/gut_cmdln.gd -gdir=res://tests/unit -gexit 2>&1 | tee "$log_path" godot_status=${PIPESTATUS[0]} set -e if grep -Eq 'SCRIPT ERROR|Parse Error' "$log_path"; then echo "unit tests failed: Godot reported a script or parse error" >&2 exit 1 fi exit "$godot_status"