WIP: tests #18
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: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| brew install sdl2 | |
| - name: Configure | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_HEADLESS_TESTS=ON | |
| - name: Build | |
| run: | | |
| cd build | |
| cmake --build . --config Release | |
| - name: Run SDL tests in CI mode | |
| run: | | |
| cd build/bin | |
| # macOS needs special handling for mouse automation in headless mode | |
| # We'll use the CI mode flag we're adding to the test application | |
| ./RobotCPPSDLTest --ci-mode --run-tests | |
| test-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| # Alternative approach: clone vcpkg directly | |
| - name: Setup vcpkg | |
| run: | | |
| git clone https://github.com/Microsoft/vcpkg.git | |
| cd vcpkg | |
| .\bootstrap-vcpkg.bat | |
| shell: cmd | |
| - name: Install SDL2 | |
| run: | | |
| .\vcpkg\vcpkg.exe install sdl2:x64-windows | |
| shell: cmd | |
| # Debug step to verify toolchain file existence | |
| - name: Verify vcpkg toolchain | |
| run: | | |
| dir vcpkg\scripts\buildsystems | |
| if (Test-Path "vcpkg\scripts\buildsystems\vcpkg.cmake") { | |
| Write-Host "Toolchain file found!" | |
| } else { | |
| Write-Host "Toolchain file not found!" | |
| } | |
| shell: powershell | |
| - name: Configure | |
| shell: powershell | |
| run: | | |
| mkdir build | |
| cd build | |
| # Use an absolute path that we know exists | |
| $vcpkgToolchain = "$pwd\..\vcpkg\scripts\buildsystems\vcpkg.cmake" | |
| Write-Host "Using toolchain file: $vcpkgToolchain" | |
| cmake .. -DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" -DCMAKE_BUILD_TYPE=Release -DBUILD_HEADLESS_TESTS=ON | |
| - name: Build | |
| shell: powershell | |
| run: | | |
| cd build | |
| cmake --build . --config Release | |
| - name: Run SDL tests in CI mode | |
| shell: powershell | |
| run: | | |
| if (Test-Path "build\bin\Release\RobotCPPSDLTest.exe") { | |
| cd build\bin\Release | |
| .\RobotCPPSDLTest.exe --ci-mode --run-tests | |
| } elseif (Test-Path "build\tests\Release\RobotCPPSDLTest.exe") { | |
| cd build\tests\Release | |
| .\RobotCPPSDLTest.exe --ci-mode --run-tests | |
| } else { | |
| Write-Host "Searching for RobotCPPSDLTest.exe..." | |
| Get-ChildItem -Path build -Recurse -Filter "RobotCPPSDLTest.exe" | ForEach-Object { $_.FullName } | |
| exit 1 | |
| } |