Skip to content

Commit

Permalink
gcovr
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Oct 6, 2023
1 parent 018b8ae commit 11e5eda
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 36 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
build-essential \
cmake \
lcov \
gcovr \
libgflags-dev \
libunwind-dev \
ninja-build
Expand Down Expand Up @@ -117,27 +117,14 @@ jobs:
- name: Generate Coverage
if: matrix.build_type == 'Debug'
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info \
'${{github.workspace}}/gtest/*' \
'*/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|build_${{matrix.build_type}}/glog/${name_we}.h\$|${file}|g" coverage.info
done
lcov --list coverage.info
cd build_${{matrix.build_type}}
gcovr -r .. . -s --xml 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
3 changes: 2 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
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_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-G "${{matrix.generator}}" \
Expand All @@ -56,7 +57,7 @@ jobs:
if: matrix.build_type == 'Debug'
run: |
cd build_${{matrix.build_type}}
gcovr -r .. --filter \.\./src/ --exclude \.\./src/.*_unittest.cc -s . -s --cobertura coverage.xml
gcovr -r .. . -s --cobertura coverage.xml
- name: Upload Coverage to Codecov
if: matrix.build_type == 'Debug'
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,19 @@ jobs:
with:
msystem: ${{matrix.sys}}
install: >-
lcov
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-gflags
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-python-jinja
mingw-w64-${{matrix.env}}-python-lxml
mingw-w64-${{matrix.env}}-python-pip
mingw-w64-${{matrix.env}}-python-pygments
- name: Setup Coverage Dependencies
if: matrix.build_type == 'Debug'
run: |
pip install 'gcovr==6.0'
- name: Setup Environment
if: matrix.build_type == 'Debug'
Expand Down Expand Up @@ -197,28 +205,14 @@ jobs:
- name: Generate Coverage
if: matrix.build_type == 'Debug'
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info \
'*/install/include/*' \
'*/msys64/mingw32/*' \
'*/msys64/mingw64/*' \
'*/src/*_unittest.cc' \
'*/src/googletest.h' \
'*/src/mock-log.h' \
--output-file coverage.info
for file in src/glog/*.h.in; do
name=$(basename ${file})
name_we=${name%.h.in}
sed -i "s|build_${{matrix.build_type}}/glog/${name_we}.h\$|${file}|g" coverage.info
done
lcov --list coverage.info
cd build_${{matrix.build_type}}
gcovr -r .. . -s --cobertura 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
2 changes: 2 additions & 0 deletions gcovr.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
filter = src/
exclude = src/.*_unittest.cc

0 comments on commit 11e5eda

Please sign in to comment.