diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..338a869 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Tests + +on: + - push + - workflow_dispatch + +jobs: + linux_tests: + timeout-minutes: 10 + + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + # TODO: cache + + - name: Install Dependencies + run: sudo apt update && sudo apt -y install libsdl2-dev xserver-xorg-video-dummy + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug + + - name: Build + run: cmake --build ${{github.workspace}}/build --config Debug -j 4 + + - name: Test + working-directory: ${{github.workspace}}/build + ## Execute tests defined by the CMake configuration. + ## See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + #run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure + # TODO: look into xinit + env: + DISPLAY: :0 + run: | + sudo Xorg :0 -config ${{github.workspace}}/.github/workflows/x/dummy-1920x1080.conf -noautoBindGPU & + #export DISPLAY=:4 + sleep 20s + #bin/sdl_service_test + ctest --output-on-failure --timeout 20 + sudo pkill -15 Xorg + diff --git a/.github/workflows/x/dummy-1920x1080.conf b/.github/workflows/x/dummy-1920x1080.conf new file mode 100644 index 0000000..d4ebf0c --- /dev/null +++ b/.github/workflows/x/dummy-1920x1080.conf @@ -0,0 +1,21 @@ +# https://wiki.archlinux.org/title/Xorg +Section "Monitor" + Identifier "dummy_monitor" + HorizSync 28.0-80.0 + VertRefresh 48.0-75.0 + Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 +EndSection + +Section "Device" + Identifier "dummy_card" + VideoRam 256000 + Driver "dummy" +EndSection + +Section "Screen" + Identifier "dummy_screen" + Device "dummy_card" + Monitor "dummy_monitor" + SubSection "Display" + EndSubSection +EndSection