mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Replaced xvfb-run with manually starting Xvfb and running fluxbox to emulate a window manager and combined test and coverage steps into a single step.
This commit is contained in:
parent
ccda8a9db0
commit
acba3e6165
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
@ -17,8 +17,8 @@ jobs:
|
|||||||
- { name: Windows VS2022 x64, os: windows-2022, flags: -A x64 }
|
- { name: Windows VS2022 x64, os: windows-2022, flags: -A x64 }
|
||||||
- { name: Windows VS2022 ClangCL, os: windows-2022, flags: -T ClangCL }
|
- { name: Windows VS2022 ClangCL, os: windows-2022, flags: -T ClangCL }
|
||||||
- { name: Windows VS2022 Clang, os: windows-2022, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -GNinja }
|
- { name: Windows VS2022 Clang, os: windows-2022, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -GNinja }
|
||||||
- { name: Linux GCC, os: ubuntu-latest, prefix: xvfb-run -a, flags: -DSFML_RUN_DISPLAY_TESTS=ON -GNinja }
|
- { name: Linux GCC, os: ubuntu-latest, flags: -DSFML_RUN_DISPLAY_TESTS=ON -GNinja }
|
||||||
- { name: Linux Clang, os: ubuntu-latest, prefix: xvfb-run -a, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSFML_RUN_DISPLAY_TESTS=ON -GNinja , gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
|
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSFML_RUN_DISPLAY_TESTS=ON -GNinja , gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
|
||||||
- { name: MacOS, os: macos-11, flags: -GNinja }
|
- { name: MacOS, os: macos-11, flags: -GNinja }
|
||||||
- { name: MacOS Xcode, os: macos-11, flags: -GXcode }
|
- { name: MacOS Xcode, os: macos-11, flags: -GXcode }
|
||||||
config:
|
config:
|
||||||
@ -57,7 +57,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Linux Dependencies
|
- name: Install Linux Dependencies
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: sudo apt-get update && sudo apt-get install ninja-build xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
|
run: sudo apt-get update && sudo apt-get install ninja-build xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox
|
||||||
|
|
||||||
- name: Install Android Components
|
- name: Install Android Components
|
||||||
if: matrix.platform.name == 'Android'
|
if: matrix.platform.name == 'Android'
|
||||||
@ -95,18 +95,34 @@ jobs:
|
|||||||
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: Test
|
- name: Test
|
||||||
if: runner.os == 'Windows'
|
uses: nick-fields/retry@v2
|
||||||
shell: bash
|
with:
|
||||||
run: cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
max_attempts: 10
|
||||||
|
timeout_minutes: 3
|
||||||
- name: Test
|
retry_wait_seconds: 5
|
||||||
if: runner.os != 'Windows'
|
warning_on_retry: false
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ${{matrix.platform.prefix}} ctest --test-dir $GITHUB_WORKSPACE/build --output-on-failure --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
command: |
|
||||||
|
if [ "${{ runner.os }}" == "Windows" ]; then
|
||||||
- name: Generate Coverage Report
|
# Run the tests
|
||||||
if: matrix.type.name == 'Debug' && runner.os != 'Windows' # Coverage is already generated on Windows when running tests.
|
cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
||||||
run: gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
|
# Coverage is already generated on Windows when running tests.
|
||||||
|
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
|
||||||
|
# Run the tests
|
||||||
|
ctest --test-dir $GITHUB_WORKSPACE/build --output-on-failure --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
||||||
|
# Run gcovr to extract coverage information from the test run
|
||||||
|
if [ "${{ matrix.type.name }}" == "Debug" ]; then
|
||||||
|
gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Download Codecov Uploader
|
- name: Download Codecov Uploader
|
||||||
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
|
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
|
||||||
|
@ -49,13 +49,7 @@ target_compile_definitions(test-sfml-system PRIVATE
|
|||||||
EXPECTED_SFML_VERSION_IS_RELEASE=$<IF:$<BOOL:${VERSION_IS_RELEASE}>,true,false>
|
EXPECTED_SFML_VERSION_IS_RELEASE=$<IF:$<BOOL:${VERSION_IS_RELEASE}>,true,false>
|
||||||
)
|
)
|
||||||
|
|
||||||
# FIXME Remove this once the Buildbot supports handling display tests on Linux platforms
|
sfml_set_option(SFML_RUN_DISPLAY_TESTS ON BOOL "TRUE to run tests that require a display, FALSE to ignore it")
|
||||||
if(SFML_OS_WINDOWS OR SFML_OS_MACOSX)
|
|
||||||
set(SFML_RUN_DISPLAY_TESTS_DEFAULT ON)
|
|
||||||
else()
|
|
||||||
set(SFML_RUN_DISPLAY_TESTS_DEFAULT OFF)
|
|
||||||
endif()
|
|
||||||
sfml_set_option(SFML_RUN_DISPLAY_TESTS ${SFML_RUN_DISPLAY_TESTS_DEFAULT} BOOL "TRUE to run tests that require a display, FALSE to ignore it")
|
|
||||||
|
|
||||||
set(WINDOW_SRC
|
set(WINDOW_SRC
|
||||||
Window/Context.test.cpp
|
Window/Context.test.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user