Skip to content

Commit

Permalink
try gcovr
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Oct 6, 2023
1 parent 6226706 commit f480c03
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}" \
Expand All @@ -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

0 comments on commit f480c03

Please sign in to comment.