Skip to content

Commit d805bd3

Browse files
authored
Merge pull request #506 from zeromq/gfa/coveralls
Coveralls upload in actions
2 parents 4108a5d + 4c08773 commit d805bd3

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
drafts: ["ON"]
1919
libzmq: ["4.3.4"]
2020
libzmqbuild: ["cmake"]
21-
platform: [""]
2221
include:
2322
# older libzmq and gcc without draft
2423
- os: "ubuntu-18.04"
@@ -54,6 +53,15 @@ jobs:
5453
drafts: "OFF"
5554
libzmq: "4.3.4"
5655
libzmqbuild: "cmake"
56+
# coverage (gcc version should match gcov version)
57+
- os: "ubuntu-latest"
58+
cppstd: "17"
59+
cc: "gcc-9"
60+
cxx: "g++-9"
61+
drafts: "ON"
62+
libzmq: "4.3.4"
63+
libzmqbuild: "cmake"
64+
coverage: "-DCOVERAGE=ON"
5765
# clang
5866
- os: "ubuntu-latest"
5967
cppstd: "17"
@@ -126,10 +134,9 @@ jobs:
126134
env:
127135
CMAKE_PREFIX_PATH: ${{ env.LIBZMQ }}
128136
run: |
129-
cmake -H. -Bbuild ${{ matrix.platform}} \
137+
cmake -H. -Bbuild ${{ matrix.platform}} ${{ matrix.coverage }} \
130138
-DCMAKE_BUILD_TYPE=${BUILDTYPE} \
131139
-DENABLE_DRAFTS=${{ matrix.drafts }} \
132-
-DCOVERAGE=${COVERAGE} \
133140
-DCMAKE_CXX_STANDARD=${{ matrix.cppstd }}
134141
cmake --build build --config ${BUILDTYPE} -j ${THREADS}
135142
echo "CPPZMQ=${PWD}/build" >> ${GITHUB_ENV}
@@ -154,3 +161,22 @@ jobs:
154161
cmake --build build --config ${BUILDTYPE}
155162
cd build
156163
ctest -V -C ${BUILDTYPE}
164+
165+
- name: lcov
166+
if: ${{ matrix.coverage && success() }}
167+
run: |
168+
sudo apt install -y lcov
169+
lcov --capture --directory . --output-file coverage.info
170+
lcov --remove coverage.info -o coverage_filtered.info \
171+
'/usr/include/*' \
172+
'/usr/local/include/*' \
173+
${PWD}'/tests/*' \
174+
${PWD}'/build/*'
175+
# to generate local html: genhtml coverage_filtered.info --output-directory .
176+
177+
- name: coveralls_upload
178+
if: ${{ matrix.coverage && success() }}
179+
uses: coverallsapp/github-action@master
180+
with:
181+
github-token: ${{ secrets.GITHUB_TOKEN }}
182+
path-to-lcov: ./coverage_filtered.info

tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ OPTION (COVERAGE "Enable gcda file generation needed by lcov" OFF)
4444

4545
if (COVERAGE)
4646
target_compile_options(unit_tests PRIVATE --coverage)
47-
target_link_libraries(unit_tests PRIVATE --coverage)
47+
target_link_options(unit_tests PRIVATE --coverage)
48+
message(STATUS "Coverage enabled")
4849
endif()
4950

5051
include(CTest)

0 commit comments

Comments
 (0)