Compare commits

...

2 Commits

Author SHA1 Message Date
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
4 changed files with 19 additions and 9 deletions

View File

@@ -23,10 +23,13 @@ jobs:
- name: Import - name: Import
working-directory: source_godot 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) - name: Tests and balance bot (in parallel; a tag skips them if this commit already passed on main)
working-directory: source_godot 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: env:
TOKEN: ${{ secrets.GITHUB_TOKEN }} TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
@@ -41,8 +44,9 @@ jobs:
esac esac
# every Godot process gets its own user:// (XDG_DATA_HOME), because the tests reuse save file names # every Godot process gets its own user:// (XDG_DATA_HOME), because the tests reuse save file names
L=/tmp/ci; mkdir -p $L 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) & } # a hung process is killed after 4 min (exit 124/137) and reported below with its log tail
run tests env GODOT=godot sh run_tests.sh 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 # 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 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) 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%%:*} s=${c%%:*}
echo "seed $c: $(grep -E '^(НЕСКІНЧЕННА|КІНЕЦЬ|OK|FAIL)' $L/bal_$s.log | tr '\n' ' ')" echo "seed $c: $(grep -E '^(НЕСКІНЧЕННА|КІНЕЦЬ|OK|FAIL)' $L/bal_$s.log | tr '\n' ' ')"
done 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 exit $fail
- name: Export Windows exe - 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 # Усі автотести гри одним запуском: GODOT=/шлях/до/godot ./run_tests.sh
cd "$(dirname "$0")" cd "$(dirname "$0")"
G="${GODOT:-godot}" G="${GODOT:-godot}"
# завислий тест падає за TEST_TIMEOUT секунд і називає себе (timeout із coreutils; якщо його нема, запуск без ліміту)
T=""; command -v timeout >/dev/null 2>&1 && T="timeout -k 10 ${TEST_TIMEOUT:-180}"
fail=0 fail=0
for t in smoke fx balance update features lang; do for t in smoke fx balance update features lang; do
echo "=== $t" 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 done
[ $fail = 0 ] && echo "УСІ ТЕСТИ ПРОЙШЛИ" || echo "Є ПОМИЛКИ" [ $fail = 0 ] && echo "УСІ ТЕСТИ ПРОЙШЛИ" || echo "Є ПОМИЛКИ"
exit $fail exit $fail

View File

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