Skip to content

Commit 7d73724

Browse files
committed
CI: fix retry.sh not propagating exit code
Plus changes in run-test.sh: * no longer copies MainScene.tscn (only one present) * kills previous Godot instance on failure
1 parent f095c9b commit 7d73724

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.github/other/retry.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ for ((attempt=0; attempt<limit; attempt++)); do
1515
if "$@"; then
1616
# Command succeeded, exit the loop
1717
echo "Done."
18-
break
18+
exit 0
1919
fi
2020

2121
# Calculate the sleep duration using the retry interval from the array
2222
sleepDuration=${retryIntervals[$attempt]}
2323

2424
# Sleep for the calculated duration
2525
echo "Failed command '$1'."
26-
echo "Retry #$attempt in $sleepDuration seconds..."
27-
sleep "$sleepDuration"
26+
if [[ $attempt -ne $((limit - 1)) ]]; then
27+
echo "Retry #$attempt in $sleepDuration seconds..."
28+
sleep "$sleepDuration"
29+
fi
2830
done
31+
32+
echo "::error::Failed after $limit attempts."
33+
exit 1

itest/hot-reload/godot/run-test.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ rel="."
88

99
# Restore un-reloaded files on exit (for local testing).
1010
cleanedUp=0 # avoid recursion if cleanup fails
11+
godotPid=0 # kill previous instance if necessary
12+
1113
cleanup() {
1214
if [[ $cleanedUp -eq 0 ]]; then
1315
cleanedUp=1
16+
if [[ $godotPid -ne 0 ]]; then
17+
echo "[Bash] Kill Godot (PID $godotPid)..."
18+
kill $godotPid || true # ignore errors here
19+
fi
1420
echo "[Bash] Cleanup..."
1521
git checkout --quiet $rel/../rust/src/lib.rs $rel/rust.gdextension $rel/MainScene.tscn || true # ignore errors here
1622
fi
@@ -27,7 +33,7 @@ git checkout --quiet $rel/../rust/src/lib.rs $rel/rust.gdextension
2733
# Set up editor file which has scene open, so @tool script loads at startup. Also copy scene file that holds a script.
2834
mkdir -p $rel/.godot/editor
2935
cp editor_layout.cfg $rel/.godot/editor/editor_layout.cfg
30-
cp MainScene.tscn $rel/MainScene.tscn
36+
#cp MainScene.tscn $rel/MainScene.tscn
3137

3238
# Compile original Rust source.
3339
cargoArgs=""
@@ -38,8 +44,8 @@ cargo build -p hot-reload $cargoArgs
3844
sleep 0.5
3945

4046
$GODOT4_BIN -e --headless --path $rel &
41-
pid=$!
42-
echo "[Bash] Wait for Godot ready (PID $pid)..."
47+
godotPid=$!
48+
echo "[Bash] Wait for Godot ready (PID $godotPid)..."
4349

4450
$GODOT4_BIN --headless --no-header --script ReloadOrchestrator.gd -- await
4551
$GODOT4_BIN --headless --no-header --script ReloadOrchestrator.gd -- replace
@@ -50,9 +56,9 @@ cargo build -p hot-reload $cargoArgs
5056
$GODOT4_BIN --headless --no-header --script ReloadOrchestrator.gd -- notify
5157

5258
echo "[Bash] Wait for Godot exit..."
53-
wait $pid
59+
wait $godotPid
5460
status=$?
55-
echo "[Bash] Godot (PID $pid) has completed with status $status."
61+
echo "[Bash] Godot (PID $godotPid) has completed with status $status."
5662

5763

5864

0 commit comments

Comments
 (0)