Use Xvfb with full spring binary to actually test LuaUI + RmlUi #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Smoke Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'claude/**' | |
| pull_request: | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| smoke-test-linux: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: 'true' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget p7zip-full xvfb libsdl2-2.0-0 libglew2.1 libopenal1 libcurl4 | |
| - name: Download BAR Engine (with RmlUi support) | |
| run: | | |
| mkdir -p engine | |
| cd engine | |
| echo "Downloading BAR Engine 105.1.1-2472-ga5aa45c (supports RmlUi)..." | |
| 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" | |
| 7z x "spring_bar_.BAR105.105.1.1-2472-ga5aa45c_linux-64-minimal-portable.7z" -o"bar-105" | |
| rm *.7z | |
| chmod +x bar-105/spring | |
| chmod +x bar-105/spring-headless || true | |
| chmod +x bar-105/spring-dedicated || true | |
| ls -lah bar-105/ | |
| cd .. | |
| - name: Prepare SpringBoard game package | |
| run: | | |
| # Create SpringBoard game directory structure | |
| mkdir -p games | |
| cd games | |
| # Create SpringBoard package | |
| mkdir -p "SpringBoard Core.sdd" | |
| cp -r ../scen_edit "SpringBoard Core.sdd/" | |
| cp -r ../triggers "SpringBoard Core.sdd/" | |
| cp -r ../libs_sb "SpringBoard Core.sdd/" | |
| cp -r ../LuaUI "SpringBoard Core.sdd/" | |
| cp -r ../LuaMenu "SpringBoard Core.sdd/" | |
| cp ../modinfo.lua "SpringBoard Core.sdd/" | |
| cd .. | |
| - name: Download test map | |
| run: | | |
| mkdir -p maps | |
| cd maps | |
| echo "Downloading Comet Catcher Redux map for testing..." | |
| wget -q "http://springfiles.springrts.com/spring/spring-maps/Comet%20Catcher%20Redux%201.8.sd7" -O "Comet_Catcher_Redux_1.8.sd7" || { | |
| echo "Map download failed, will try to use generated blank map" | |
| } | |
| cd .. | |
| - name: Create Spring script.txt | |
| run: | | |
| # Try to use downloaded map, fallback to blank map | |
| if [ -f maps/Comet_Catcher_Redux_1.8.sd7 ]; then | |
| MAP_NAME="Comet Catcher Redux 1.8" | |
| echo "Using downloaded map: $MAP_NAME" | |
| cat > script.txt << 'SCRIPTEND' | |
| [GAME] | |
| { | |
| GameType=SpringBoard Core; | |
| MapName=Comet Catcher Redux 1.8; | |
| IsHost=1; | |
| MyPlayerName=TestPlayer; | |
| [MODOPTIONS] | |
| { | |
| MapSeed=42; | |
| } | |
| [PLAYER0] | |
| { | |
| Name=TestPlayer; | |
| Team=0; | |
| IsFromDemo=0; | |
| Spectator=1; | |
| } | |
| [TEAM0] | |
| { | |
| TeamLeader=0; | |
| AllyTeam=0; | |
| } | |
| [ALLYTEAM0] | |
| { | |
| } | |
| } | |
| SCRIPTEND | |
| else | |
| echo "Using generated blank map" | |
| cat > script.txt << 'SCRIPTEND' | |
| [GAME] | |
| { | |
| GameType=SpringBoard Core; | |
| MapName=sb_initial_blank_10x8; | |
| IsHost=1; | |
| MyPlayerName=TestPlayer; | |
| [MODOPTIONS] | |
| { | |
| MapSeed=42; | |
| new_map_x=10; | |
| new_map_y=8; | |
| } | |
| [PLAYER0] | |
| { | |
| Name=TestPlayer; | |
| Team=0; | |
| IsFromDemo=0; | |
| Spectator=1; | |
| } | |
| [TEAM0] | |
| { | |
| TeamLeader=0; | |
| AllyTeam=0; | |
| } | |
| [ALLYTEAM0] | |
| { | |
| } | |
| } | |
| SCRIPTEND | |
| fi | |
| echo "=== Script contents ===" | |
| cat script.txt | |
| echo "=======================" | |
| - name: Run smoke test with Xvfb (tests LuaUI + RmlUi) | |
| run: | | |
| ENGINE_DIR="./engine/bar-105" | |
| echo "Starting SpringBoard smoke test with virtual display..." | |
| echo "Engine: $ENGINE_DIR" | |
| echo "Using Xvfb to run full spring binary (loads LuaUI + RmlUi)" | |
| # Run Spring with Xvfb (virtual X11 display) so LuaUI loads | |
| # This actually tests RmlUi initialization! | |
| timeout 10s xvfb-run -a -s "-screen 0 1024x768x24" \ | |
| $ENGINE_DIR/spring --write-dir $(pwd)/test-data script.txt || EXIT_CODE=$? | |
| # Exit codes: | |
| # 0 = clean exit (unlikely in 10s) | |
| # 124 = timeout (expected - means it ran without crashing) | |
| # Other = crash/error | |
| echo "" | |
| echo "=== Checking for RmlUi initialization in logs ===" | |
| if [ -f test-data/infolog.txt ]; then | |
| if grep -i "rmlui" test-data/infolog.txt; then | |
| echo "✓ RmlUi messages found in infolog" | |
| else | |
| echo "⚠ No RmlUi messages found in infolog" | |
| fi | |
| if grep -i "luaui.*loaded\|loading luaui" test-data/infolog.txt; then | |
| echo "✓ LuaUI loaded successfully" | |
| else | |
| echo "⚠ Could not confirm LuaUI loaded" | |
| fi | |
| fi | |
| echo "" | |
| if [ "${EXIT_CODE:-0}" -eq 124 ]; then | |
| echo "✓ SpringBoard started successfully and ran for 10 seconds" | |
| echo "✓ Smoke test PASSED (with LuaUI + RmlUi)" | |
| exit 0 | |
| elif [ "${EXIT_CODE:-0}" -eq 0 ]; then | |
| echo "✓ SpringBoard exited cleanly" | |
| echo "✓ Smoke test PASSED" | |
| exit 0 | |
| else | |
| echo "✗ SpringBoard crashed with exit code: ${EXIT_CODE}" | |
| echo "✗ Smoke test FAILED" | |
| # Show infolog if available | |
| if [ -f test-data/infolog.txt ]; then | |
| echo "=== Last 100 lines of infolog.txt ===" | |
| tail -100 test-data/infolog.txt | |
| fi | |
| exit 1 | |
| fi | |
| - name: Upload test artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: smoke-test-logs | |
| path: | | |
| test-data/infolog.txt | |
| test-data/*.log | |
| if-no-files-found: ignore | |
| - name: Show engine info | |
| if: always() | |
| run: | | |
| echo "=== Engine information ===" | |
| ./engine/bar-105/spring --version || true | |
| echo "" | |
| echo "=== RmlUi check ===" | |
| if strings ./engine/bar-105/spring | grep -i rmlui; then | |
| echo "✓ RmlUi support detected in engine binary" | |
| else | |
| echo "⚠ Could not detect RmlUi in engine binary" | |
| fi | |
| echo "" | |
| echo "=== GL info ===" | |
| ldd ./engine/bar-105/spring | grep -i "gl\|sdl" || true |