Compare commits

...

4 Commits

Author SHA1 Message Date
JunioR
643c641503 smoke.gd: сталий сід (seed, side_rng, bm_rng) — тест більше не падає випадково в ~3% прогонів
All checks were successful
build / build (push) Successful in 2m26s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZuyxtuPUay6iyMLJtD
2026-11-27 12:08:17 +00:00
Gitea Actions
8c6b75678f game_godot: TinMerezhi.exe v1.0.65 2026-11-27 11:54:34 +00:00
JunioR
010e5d5061 CI: тести більше не зависають — без звукового генератора в headless, тайм-аути на Godot
All checks were successful
build / build (push) Successful in 2m24s
Причина: під навантаженням звуковий потік Godot (Dummy-драйвер) зрідка зациклювався на AudioStreamGenerator
і тримав блокування AudioServer; головний потік тесту чекав на нього вічно (~1 з 150 запусків).
У headless генератор не запускається (ui_build.gd). Крім того кожен процес Godot у CI має тайм-аут
(run_tests.sh: 180 с на тест і рядок "ЗАВИС: tests/X.gd"; build.yml: 240 с на процес, 3 хв на імпорт,
timeout-minutes на кроках), тож завислий прогін падає з назвою тесту.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZuyxtuPUay6iyMLJtD
2026-11-27 11:51:20 +00:00
Gitea Actions
b586447a4d game_godot: TinMerezhi.exe v1.0.64 2026-11-27 11:44:07 +00:00
5 changed files with 22 additions and 9 deletions

View File

@@ -23,10 +23,13 @@ jobs:
- name: Import
working-directory: source_godot
run: godot --version && godot --headless --path . --import
timeout-minutes: 5
run: godot --version && timeout -k 10 180 godot --headless --path . --import
- name: Tests and balance bot (in parallel; a tag skips them if this commit already passed on main)
working-directory: source_godot
# backstop only: every Godot process below has its own timeout, so a hang fails with its log instead of this
timeout-minutes: 10
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -41,8 +44,9 @@ jobs:
esac
# every Godot process gets its own user:// (XDG_DATA_HOME), because the tests reuse save file names
L=/tmp/ci; mkdir -p $L
run() { n=$1; shift; (env XDG_DATA_HOME=$L/u_$n "$@" > $L/$n.log 2>&1; echo $? > $L/$n.rc) & }
run tests env GODOT=godot sh run_tests.sh
# a hung process is killed after 4 min (exit 124/137) and reported below with its log tail
run() { n=$1; shift; (env XDG_DATA_HOME=$L/u_$n timeout -k 10 240 "$@" > $L/$n.log 2>&1; echo $? > $L/$n.rc) & }
run tests env GODOT=godot TEST_TIMEOUT=180 sh run_tests.sh
# balance bot: seed:difficulty (0 novice, 1 normal, 2 paranoid):choices in the Act IV, V and VI finals
for c in 1:1:222 8:1:111 3:1:221 4:0:112 5:2:222 7:2:111; do
s=$(echo $c | cut -d: -f1); d=$(echo $c | cut -d: -f2); ch=$(echo $c | cut -d: -f3)
@@ -55,7 +59,7 @@ jobs:
s=${c%%:*}
echo "seed $c: $(grep -E '^(НЕСКІНЧЕННА|КІНЕЦЬ|OK|FAIL)' $L/bal_$s.log | tr '\n' ' ')"
done
for r in $L/*.rc; do [ "$(cat $r)" = 0 ] || { fail=1; echo "FAILED: $(basename $r .rc)"; cat ${r%.rc}.log | tail -30; }; done
for r in $L/*.rc; do rc=$(cat $r); [ "$rc" = 0 ] || { fail=1; case $rc in 124|137) echo "HUNG (killed by timeout): $(basename $r .rc)";; *) echo "FAILED ($rc): $(basename $r .rc)";; esac; tail -30 ${r%.rc}.log; }; done
exit $fail
- name: Export Windows exe

BIN
game_godot/TinMerezhi.exe (Stored with Git LFS)

Binary file not shown.

View File

@@ -2,10 +2,14 @@
# Усі автотести гри одним запуском: GODOT=/шлях/до/godot ./run_tests.sh
cd "$(dirname "$0")"
G="${GODOT:-godot}"
# завислий тест падає за TEST_TIMEOUT секунд і називає себе (timeout із coreutils; якщо його нема, запуск без ліміту)
T=""; command -v timeout >/dev/null 2>&1 && T="timeout -k 10 ${TEST_TIMEOUT:-180}"
fail=0
for t in smoke fx balance update features lang; do
echo "=== $t"
"$G" --headless --path . -s "tests/$t.gd" || fail=1
$T "$G" --headless --path . -s "tests/$t.gd"; rc=$?
[ $rc = 124 ] || [ $rc = 137 ] && echo "ЗАВИС: tests/$t.gd не завершився за ${TEST_TIMEOUT:-180} с"
[ $rc = 0 ] || fail=1
done
[ $fail = 0 ] && echo "УСІ ТЕСТИ ПРОЙШЛИ" || echo "Є ПОМИЛКИ"
exit $fail

View File

@@ -25,6 +25,8 @@ func fresh(keep_save := false) -> Node:
g.legacy_path = "user://smoke_legacy.json"
g.settings_path = "user://test_settings.json"
root.add_child(g)
g.side_rng.seed = 1 # побічні квести й події зламу: без сталого сіду ~3% прогонів падали випадково
g.bm_rng.seed = 31
return g
func drop(g: Node) -> void:
@@ -54,6 +56,7 @@ func last(g, n := 1) -> String:
func _initialize() -> void:
load("res://lang.gd").lang = "uk" # тести перевіряють українські тексти, хай що обрав гравець
seed(1) # randf() гри (події, суперники) — однакові в кожному запуску, як у features.gd
_run.call_deferred() # сцени стають "готовими" лише коли дерево вже працює
# сторож: якщо скрипт гри не скомпілюється, тест не зависне, а впаде
create_timer(120.0).timeout.connect(func(): print("FAIL тест не завершився за 120 с (помилка в коді гри?)"); quit(1))

View File

@@ -265,8 +265,10 @@ static func build(g) -> void:
gen.buffer_length = 0.2
player.stream = gen
g.add_child(player)
player.play()
g.playback = player.get_stream_playback()
# headless (тести, CI): без генератора — звуковий потік Godot зрідка зациклювався на ньому під навантаженням і вішав тест
if DisplayServer.get_name() != "headless":
player.play()
g.playback = player.get_stream_playback()
g.sfx_player = player
g.music_player = AudioStreamPlayer.new()
g.add_child(g.music_player)