From 7e1765717a81d7d3782b20cd4c10c679146d44c7 Mon Sep 17 00:00:00 2001 From: binary1248 Date: Thu, 11 Apr 2024 20:54:19 +0200 Subject: [PATCH] Fixed coverage data not being collected for MinGW builds because OpenCPPCoverage relies on pdb data being available. --- .github/workflows/ci.yml | 10 ++++++++-- test/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74056b3a0..9a8a4a36c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,12 @@ jobs: verbose: 2 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 if: matrix.type.name == 'Debug' && runner.os == 'Windows' 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" \; - 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' }} - name: Test - if: runner.os != 'Windows' + if: runner.os != 'Windows' || contains(matrix.platform.name, 'MinGW') run: | 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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2e119f2ef..f5a81ec17 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -152,7 +152,7 @@ if(SFML_OS_WINDOWS AND NOT SFML_USE_SYSTEM_DEPS) VERBATIM) 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 find_program(OpenCppCoverage_BINARY "OpenCppCoverage.exe")