Don't repeatedly run test setup code

This commit is contained in:
binary1248 2023-04-12 01:37:05 +02:00 committed by Chris Thrasher
parent 038030aed3
commit 913d7358ac

View File

@ -3,6 +3,7 @@ name: CI
on: [push, pull_request, workflow_dispatch] on: [push, pull_request, workflow_dispatch]
env: env:
DISPLAY: ":99" # Display number to use for the X server
GALLIUM_DRIVER: llvmpipe # Use Mesa 3D software OpenGL renderer GALLIUM_DRIVER: llvmpipe # Use Mesa 3D software OpenGL renderer
jobs: jobs:
@ -105,6 +106,20 @@ jobs:
shell: bash shell: bash
run: cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install run: cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install
- name: Prepare Test
shell: bash
run: |
set -e
# Start up Xvfb and fluxbox to host display tests
if [ "${{ runner.os }}" == "Linux" ]; then
Xvfb $DISPLAY -screen 0 1920x1080x24 &
sleep 5
fluxbox > /dev/null 2>&1 &
sleep 5
fi
# Make sure the build/bin directory exists so that the find command does not fail if no executables are built
mkdir -p $GITHUB_WORKSPACE/build/bin
- name: Test - name: Test
uses: nick-fields/retry@v2 uses: nick-fields/retry@v2
with: with:
@ -122,14 +137,6 @@ jobs:
cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
# Coverage is already generated on Windows when running tests. # Coverage is already generated on Windows when running tests.
else else
# Start up Xvfb and fluxbox to host display tests on DISPLAY :99
if [ "${{ runner.os }}" == "Linux" ]; then
export DISPLAY=":99"
Xvfb $DISPLAY -screen 0 1920x1080x24 &
sleep 5
fluxbox > /dev/null 2>&1 &
sleep 5
fi
# Make use of a test to print OpenGL vendor/renderer/version info to the console # Make use of a test to print OpenGL vendor/renderer/version info to the console
find $GITHUB_WORKSPACE/build/bin -name test-sfml-window -exec {} --test-case="[Window] sf::Context" --subcase="Version String" \; | grep OpenGL find $GITHUB_WORKSPACE/build/bin -name test-sfml-window -exec {} --test-case="[Window] sf::Context" --subcase="Version String" \; | grep OpenGL
# Run the tests # Run the tests