From f480c037f225fb0b26fcd6ee8f78bbd1b8404d01 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Fri, 6 Oct 2023 22:42:05 +0200 Subject: [PATCH] try gcovr --- .github/workflows/macos.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d1c001e1b..9bd471268 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,22 +19,26 @@ jobs: - name: Setup Dependencies run: | - brew install lcov ninja + brew install gtest ninja + + - name: Setup Coverage Dependencies + if: matrix.build_type == 'Debug' + run: | + brew install gcovr - name: Setup Environment if: matrix.build_type == 'Debug' run: | echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV + echo 'LDFLAGS=--coverage' >> $GITHUB_ENV - name: Configure shell: bash env: - CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}} + CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror -pedantic-errors ${{env.CXXFLAGS}} run: | cmake -S . -B build_${{matrix.build_type}} \ -DCMAKE_CXX_EXTENSIONS=OFF \ - -DCMAKE_CXX_FLAGS_DEBUG=-pedantic-errors \ - -DCMAKE_CXX_FLAGS_RELEASE=-pedantic-errors \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -G "${{matrix.generator}}" \ @@ -53,26 +57,14 @@ jobs: - name: Generate Coverage if: matrix.build_type == 'Debug' run: | - lcov --ignore-errors inconsistent --directory . --capture --output-file coverage.info - lcov --remove coverage.info \ - '*/src/*_unittest.cc' \ - '*/src/googletest.h' \ - '*/src/mock-log.h' \ - '*/usr/*' \ - --output-file coverage.info - - for file in src/glog/*.h.in; do - name=$(basename ${file}) - name_we=${name%.h.in} - sed -i "" "s|${{github.workspace}}/glog/${name_we}.h\$|${file}|g" coverage.info - done - - lcov --list coverage.info + cd build_${{matrix.build_type}} + gcovr -r .. --filter ../src/ . -s -o coverage.xml - name: Upload Coverage to Codecov if: matrix.build_type == 'Debug' uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} + files: build_${{matrix.build_type}}/coverage.xml fail_ci_if_error: true verbose: true