Skip to content

WIP: tests

WIP: tests #13

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libsdl2-dev x11-xserver-utils xdotool
- 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 unit tests
run: |
cd build/bin
./RobotCPPTest
- name: Run SDL tests with Xvfb
run: |
cd build/bin
Xvfb :99 -screen 0 1280x720x24 &
export DISPLAY=:99
sleep 2 # Wait for Xvfb to start
xset -display :99 s off -dpms # Disable screen saver
./RobotCPPSDLTest --ci-mode --run-tests
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 unit tests
run: |
cd build/bin
./RobotCPPTest
- 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
- name: Set up vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 5568f110b509a9fd90711978a7cb76bae75bb092
- name: Install SDL2
run: |
vcpkg install sdl2:x64-windows
- name: Configure
shell: powershell
run: |
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_HEADLESS_TESTS=ON
- name: Build
shell: powershell
run: |
cd build
cmake --build . --config Release
- name: Run unit tests
shell: powershell
run: |
cd build\bin\Release
.\RobotCPPTest.exe
- name: Run SDL tests in CI mode
shell: powershell
run: |
cd build\bin\Release
.\RobotCPPSDLTest.exe --ci-mode --run-tests