|
| 1 | +name: Smoke Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'claude/**' |
| 8 | + pull_request: |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + |
| 15 | +jobs: |
| 16 | + smoke-test-linux: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 15 |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + submodules: 'true' |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install -y wget p7zip-full xvfb libsdl2-2.0-0 libglew2.1 libopenal1 libcurl4 |
| 30 | +
|
| 31 | + - name: Download BAR Engine (with RmlUi support) |
| 32 | + run: | |
| 33 | + mkdir -p engine |
| 34 | + cd engine |
| 35 | + echo "Downloading BAR Engine 105.1.1-2472-ga5aa45c (supports RmlUi)..." |
| 36 | + wget -q "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-2472-ga5aa45c/spring_bar_.BAR105.105.1.1-2472-ga5aa45c_linux-64-minimal-portable.7z" |
| 37 | + 7z x "spring_bar_.BAR105.105.1.1-2472-ga5aa45c_linux-64-minimal-portable.7z" -o"bar-105" |
| 38 | + rm *.7z |
| 39 | + chmod +x bar-105/spring-headless |
| 40 | + chmod +x bar-105/spring-dedicated || true |
| 41 | + ls -lah bar-105/ |
| 42 | + cd .. |
| 43 | +
|
| 44 | + - name: Prepare SpringBoard game package |
| 45 | + run: | |
| 46 | + # Create SpringBoard game directory structure |
| 47 | + mkdir -p games |
| 48 | + cd games |
| 49 | +
|
| 50 | + # Create SpringBoard package |
| 51 | + mkdir -p "SpringBoard Core.sdd" |
| 52 | + cp -r ../scen_edit "SpringBoard Core.sdd/" |
| 53 | + cp -r ../triggers "SpringBoard Core.sdd/" |
| 54 | + cp -r ../libs_sb "SpringBoard Core.sdd/" |
| 55 | + cp -r ../LuaUI "SpringBoard Core.sdd/" |
| 56 | + cp -r ../LuaMenu "SpringBoard Core.sdd/" |
| 57 | +
|
| 58 | + # Copy modinfo if exists |
| 59 | + if [ -f ../modinfo.lua ]; then |
| 60 | + cp ../modinfo.lua "SpringBoard Core.sdd/" |
| 61 | + else |
| 62 | + # 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 |
| 76 | + fi |
| 77 | + |
| 78 | + cd .. |
| 79 | + |
| 80 | + - name: Download test map |
| 81 | + run: | |
| 82 | + mkdir -p maps |
| 83 | + cd maps |
| 84 | + echo "Downloading Comet Catcher Redux map for testing..." |
| 85 | + wget -q "http://springfiles.springrts.com/spring/spring-maps/Comet%20Catcher%20Redux%201.8.sd7" -O "Comet_Catcher_Redux_1.8.sd7" || { |
| 86 | + echo "Map download failed, will try to use generated blank map" |
| 87 | + } |
| 88 | + cd .. |
| 89 | +
|
| 90 | + - name: Create start script |
| 91 | + 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 |
| 216 | + |
| 217 | + - name: Run smoke test |
| 218 | + run: | |
| 219 | + ./start_test.sh |
| 220 | +
|
| 221 | + - name: Upload test artifacts on failure |
| 222 | + if: failure() |
| 223 | + uses: actions/upload-artifact@v2 |
| 224 | + with: |
| 225 | + name: smoke-test-logs |
| 226 | + path: | |
| 227 | + test-data/infolog.txt |
| 228 | + test-data/*.log |
| 229 | + if-no-files-found: ignore |
| 230 | + |
| 231 | + - name: Show engine info |
| 232 | + if: always() |
| 233 | + run: | |
| 234 | + echo "=== Engine information ===" |
| 235 | + ./engine/bar-105/spring-headless --version || true |
| 236 | + echo "=== RmlUi check ===" |
| 237 | + if strings ./engine/bar-105/spring-headless | grep -i rmlui; then |
| 238 | + echo "✓ RmlUi support detected in engine" |
| 239 | + else |
| 240 | + echo "⚠ Could not detect RmlUi in engine binary" |
| 241 | + fi |
0 commit comments