Skip to content

Commit 0d2022f

Browse files
committed
Fix smoke test workflow: Avoid nested heredocs causing YAML parse errors
Changed approach to avoid triple nesting (YAML multiline -> bash heredoc -> bash heredoc): - Use echo statements for modinfo.lua generation instead of heredoc - Inline Spring script.txt generation directly in workflow step - Remove intermediate start_test.sh script file - Use SCRIPTEND delimiter to avoid conflicts This resolves the GitHub Actions workflow syntax error at line 64.
1 parent c45247d commit 0d2022f

File tree

1 file changed

+114
-139
lines changed

1 file changed

+114
-139
lines changed

.github/workflows/smoke-test.yml

Lines changed: 114 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,17 @@ jobs:
6060
cp ../modinfo.lua "SpringBoard Core.sdd/"
6161
else
6262
# Create minimal modinfo.lua
63-
cat > "SpringBoard Core.sdd/modinfo.lua" << 'EOF'
64-
local modinfo = {
65-
name = "SpringBoard Core",
66-
shortName = "SBC",
67-
version = "dev-test",
68-
game = "SpringBoard Core",
69-
shortGame = "SBC",
70-
mutator = "Official",
71-
description = "SpringBoard scenario editor with RmlUi UI",
72-
modtype = "5",
73-
}
74-
return modinfo
75-
EOF
63+
echo 'local modinfo = {' > "SpringBoard Core.sdd/modinfo.lua"
64+
echo ' name = "SpringBoard Core",' >> "SpringBoard Core.sdd/modinfo.lua"
65+
echo ' shortName = "SBC",' >> "SpringBoard Core.sdd/modinfo.lua"
66+
echo ' version = "dev-test",' >> "SpringBoard Core.sdd/modinfo.lua"
67+
echo ' game = "SpringBoard Core",' >> "SpringBoard Core.sdd/modinfo.lua"
68+
echo ' shortGame = "SBC",' >> "SpringBoard Core.sdd/modinfo.lua"
69+
echo ' mutator = "Official",' >> "SpringBoard Core.sdd/modinfo.lua"
70+
echo ' description = "SpringBoard scenario editor with RmlUi UI",' >> "SpringBoard Core.sdd/modinfo.lua"
71+
echo ' modtype = "5",' >> "SpringBoard Core.sdd/modinfo.lua"
72+
echo '}' >> "SpringBoard Core.sdd/modinfo.lua"
73+
echo 'return modinfo' >> "SpringBoard Core.sdd/modinfo.lua"
7674
fi
7775
7876
cd ..
@@ -87,136 +85,113 @@ EOF
8785
}
8886
cd ..
8987
90-
- name: Create start script
88+
- name: Create Spring script.txt
9189
run: |
92-
cat > start_test.sh << 'EOF'
93-
#!/bin/bash
94-
set -e
95-
96-
ENGINE_DIR="./engine/bar-105"
97-
GAME="SpringBoard Core"
98-
99-
echo "Starting SpringBoard smoke test..."
100-
echo "Engine: $ENGINE_DIR"
101-
echo "Game: $GAME"
102-
103-
# Try to find an available map
104-
if [ -f maps/Comet_Catcher_Redux_1.8.sd7 ]; then
105-
MAP_NAME="Comet Catcher Redux 1.8"
106-
echo "Using downloaded map: $MAP_NAME"
107-
108-
# Create script.txt with real map
109-
cat > script.txt << 'SCRIPT'
110-
[GAME]
111-
{
112-
GameType=SpringBoard Core;
113-
MapName=Comet Catcher Redux 1.8;
114-
IsHost=1;
115-
MyPlayerName=TestPlayer;
116-
117-
[MODOPTIONS]
118-
{
119-
MapSeed=42;
120-
}
121-
122-
[PLAYER0]
123-
{
124-
Name=TestPlayer;
125-
Team=0;
126-
IsFromDemo=0;
127-
Spectator=1;
128-
}
129-
130-
[TEAM0]
131-
{
132-
TeamLeader=0;
133-
AllyTeam=0;
134-
}
135-
136-
[ALLYTEAM0]
137-
{
138-
}
139-
}
140-
SCRIPT
141-
else
142-
# Use blank map generator (from config.json pattern)
143-
MAP_NAME="sb_initial_blank_10x8"
144-
echo "Using generated blank map: $MAP_NAME"
145-
146-
cat > script.txt << 'SCRIPT'
147-
[GAME]
148-
{
149-
GameType=SpringBoard Core;
150-
MapName=sb_initial_blank_10x8;
151-
IsHost=1;
152-
MyPlayerName=TestPlayer;
153-
154-
[MODOPTIONS]
155-
{
156-
MapSeed=42;
157-
new_map_x=10;
158-
new_map_y=8;
159-
}
160-
161-
[PLAYER0]
162-
{
163-
Name=TestPlayer;
164-
Team=0;
165-
IsFromDemo=0;
166-
Spectator=1;
167-
}
168-
169-
[TEAM0]
170-
{
171-
TeamLeader=0;
172-
AllyTeam=0;
173-
}
174-
175-
[ALLYTEAM0]
176-
{
177-
}
178-
}
179-
SCRIPT
180-
fi
181-
182-
echo "=== Script contents ==="
183-
cat script.txt
184-
echo "======================="
185-
186-
# Run Spring in headless mode for 10 seconds
187-
timeout 10s $ENGINE_DIR/spring-headless --write-dir $(pwd)/test-data script.txt || EXIT_CODE=$?
188-
189-
# Exit codes:
190-
# 0 = clean exit (unlikely in 10s)
191-
# 124 = timeout (expected - means it ran without crashing)
192-
# Other = crash/error
193-
194-
if [ "${EXIT_CODE:-0}" -eq 124 ]; then
195-
echo "✓ SpringBoard started successfully and ran for 10 seconds"
196-
echo "✓ Smoke test PASSED"
197-
exit 0
198-
elif [ "${EXIT_CODE:-0}" -eq 0 ]; then
199-
echo "✓ SpringBoard exited cleanly"
200-
echo "✓ Smoke test PASSED"
201-
exit 0
202-
else
203-
echo "✗ SpringBoard crashed with exit code: ${EXIT_CODE}"
204-
echo "✗ Smoke test FAILED"
205-
206-
# Show infolog if available
207-
if [ -f test-data/infolog.txt ]; then
208-
echo "=== Last 50 lines of infolog.txt ==="
209-
tail -50 test-data/infolog.txt
210-
fi
211-
212-
exit 1
213-
fi
214-
EOF
215-
chmod +x start_test.sh
90+
# Try to use downloaded map, fallback to blank map
91+
if [ -f maps/Comet_Catcher_Redux_1.8.sd7 ]; then
92+
MAP_NAME="Comet Catcher Redux 1.8"
93+
echo "Using downloaded map: $MAP_NAME"
94+
cat > script.txt << 'SCRIPTEND'
95+
[GAME]
96+
{
97+
GameType=SpringBoard Core;
98+
MapName=Comet Catcher Redux 1.8;
99+
IsHost=1;
100+
MyPlayerName=TestPlayer;
101+
[MODOPTIONS]
102+
{
103+
MapSeed=42;
104+
}
105+
[PLAYER0]
106+
{
107+
Name=TestPlayer;
108+
Team=0;
109+
IsFromDemo=0;
110+
Spectator=1;
111+
}
112+
[TEAM0]
113+
{
114+
TeamLeader=0;
115+
AllyTeam=0;
116+
}
117+
[ALLYTEAM0]
118+
{
119+
}
120+
}
121+
SCRIPTEND
122+
else
123+
echo "Using generated blank map"
124+
cat > script.txt << 'SCRIPTEND'
125+
[GAME]
126+
{
127+
GameType=SpringBoard Core;
128+
MapName=sb_initial_blank_10x8;
129+
IsHost=1;
130+
MyPlayerName=TestPlayer;
131+
[MODOPTIONS]
132+
{
133+
MapSeed=42;
134+
new_map_x=10;
135+
new_map_y=8;
136+
}
137+
[PLAYER0]
138+
{
139+
Name=TestPlayer;
140+
Team=0;
141+
IsFromDemo=0;
142+
Spectator=1;
143+
}
144+
[TEAM0]
145+
{
146+
TeamLeader=0;
147+
AllyTeam=0;
148+
}
149+
[ALLYTEAM0]
150+
{
151+
}
152+
}
153+
SCRIPTEND
154+
fi
155+
156+
echo "=== Script contents ==="
157+
cat script.txt
158+
echo "======================="
216159
217160
- name: Run smoke test
218161
run: |
219-
./start_test.sh
162+
ENGINE_DIR="./engine/bar-105"
163+
164+
echo "Starting SpringBoard smoke test..."
165+
echo "Engine: $ENGINE_DIR"
166+
167+
# Run Spring in headless mode for 10 seconds
168+
timeout 10s $ENGINE_DIR/spring-headless --write-dir $(pwd)/test-data script.txt || EXIT_CODE=$?
169+
170+
# Exit codes:
171+
# 0 = clean exit (unlikely in 10s)
172+
# 124 = timeout (expected - means it ran without crashing)
173+
# Other = crash/error
174+
175+
if [ "${EXIT_CODE:-0}" -eq 124 ]; then
176+
echo "✓ SpringBoard started successfully and ran for 10 seconds"
177+
echo "✓ Smoke test PASSED"
178+
exit 0
179+
elif [ "${EXIT_CODE:-0}" -eq 0 ]; then
180+
echo "✓ SpringBoard exited cleanly"
181+
echo "✓ Smoke test PASSED"
182+
exit 0
183+
else
184+
echo "✗ SpringBoard crashed with exit code: ${EXIT_CODE}"
185+
echo "✗ Smoke test FAILED"
186+
187+
# Show infolog if available
188+
if [ -f test-data/infolog.txt ]; then
189+
echo "=== Last 50 lines of infolog.txt ==="
190+
tail -50 test-data/infolog.txt
191+
fi
192+
193+
exit 1
194+
fi
220195
221196
- name: Upload test artifacts on failure
222197
if: failure()

0 commit comments

Comments
 (0)