Fixed coverage data not being collected for MinGW builds because OpenCPPCoverage relies on pdb data being available.

This commit is contained in:
binary1248 2024-04-11 20:54:19 +02:00 committed by Chris Thrasher
parent b17150d3c0
commit 7e1765717a
2 changed files with 9 additions and 3 deletions

View File

@ -128,6 +128,12 @@ jobs:
verbose: 2 verbose: 2
key: ${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.type.name }} key: ${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.type.name }}
- name: Install Gcovr for MinGW
if: matrix.type.name == 'Debug' && contains(matrix.platform.name, 'MinGW')
uses: threeal/pipx-install-action@v1.0.0
with:
packages: gcovr
- name: Cache OpenCppCoverage - name: Cache OpenCppCoverage
if: matrix.type.name == 'Debug' && runner.os == 'Windows' if: matrix.type.name == 'Debug' && runner.os == 'Windows'
id: opencppcoverage-cache id: opencppcoverage-cache
@ -193,11 +199,11 @@ jobs:
find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \; find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \;
- name: Test - name: Test
if: runner.os == 'Windows' if: runner.os == 'Windows' && !contains(matrix.platform.name, 'MinGW')
run: cmake --build build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} run: cmake --build build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
- name: Test - name: Test
if: runner.os != 'Windows' if: runner.os != 'Windows' || contains(matrix.platform.name, 'MinGW')
run: | run: |
ctest --test-dir build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --repeat until-pass:3 ctest --test-dir build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --repeat until-pass:3
# Run gcovr to extract coverage information from the test run # Run gcovr to extract coverage information from the test run

View File

@ -152,7 +152,7 @@ if(SFML_OS_WINDOWS AND NOT SFML_USE_SYSTEM_DEPS)
VERBATIM) VERBATIM)
endif() endif()
if(SFML_ENABLE_COVERAGE AND SFML_OS_WINDOWS) if(SFML_ENABLE_COVERAGE AND SFML_OS_WINDOWS AND NOT SFML_COMPILER_GCC)
# Try to find and use OpenCppCoverage for coverage reporting when building with MSVC # Try to find and use OpenCppCoverage for coverage reporting when building with MSVC
find_program(OpenCppCoverage_BINARY "OpenCppCoverage.exe") find_program(OpenCppCoverage_BINARY "OpenCppCoverage.exe")