Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit e7def6a

Browse files
authored
Added Coverage Build Job (#7)
Job and script that posts Coverage Reports to Github pull requests
1 parent dcdd1c5 commit e7def6a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ matrix:
4646
# eigen3 throws warnings.
4747
- CXXFLAGS="" CONFIG="-I/usr/include/eigen3" make examples/all
4848
- make docs
49+
# Build Job
50+
- name: Tests Coverage (Latest gcc7)
51+
os: linux
52+
addons:
53+
apt:
54+
sources:
55+
- ubuntu-toolchain-r-test
56+
packages:
57+
- g++-7
58+
- lcov
59+
env:
60+
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
61+
script:
62+
- make unit-test/test_coverage
63+
after_success:
64+
- bash .travis_coverage_poster.sh
4965

5066
before_install:
5167
- eval "${MATRIX_EVAL}"

.travis_coverage_poster.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -ev
3+
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
4+
curl -H "Authorization: token ${COVERAGE_POSTER_API_TOKEN}" \
5+
-X POST -d "{\"body\": \"\`\`\`\n$(cat coverage/coverage.txt | awk -v ORS='\\n' '1')\`\`\`\"}" \
6+
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments";
7+
fi

makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ unit-test/test_coverage: cleancoverage
131131
--extract coverage/coverage.info "*/unit-test/*" \
132132
--extract coverage/coverage.info "*/test-util/*" \
133133
-q --output-file coverage/coverage.info
134+
lcov -l coverage/coverage.info > coverage/coverage.txt
134135
genhtml coverage/coverage.info --output-directory coverage/.
135136

136137
code_size_benchmark/%:

0 commit comments

Comments
 (0)