我正试图在我的GitHub仓库上配置CodeCov和TravisCI。由于我的回购是在C++中,我使用的CMake了,我基本上是复制粘贴的this example的after_success
标签到我.travis.yml
文件:如何在TravisCI中为C++ w/CMake项目正确配置CodeCov?
after_success:
# Creating report
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --capture --output-file coverage.info coverage info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info
- lcov --list coverage.info
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
我推定制.codecov.yml
文件提供了USB Key和通知设置,但after_success
只是该示例中建议的一个。我真的不熟悉lcov
,所以我不知道是否有其他东西丢失或这些电话是用于什么。
看着CodeCov的文档我找不到什么我可能会丢失,但我的覆盖报告是空的,因为lcov
无法找到某种神秘.gcda
文件(我猜)。 CodeCov的文档没有提到任何地方,所以我想我错过了我的配置中的重要一步(或者由于某些原因可能找不到文件...?)
这是TravisCI的输出after_success
阶段:
$ lcov --directory . --capture --output-file coverage.info
Capturing coverage data from .
Found gcov version: 4.8.4
Scanning . for .gcda files ...
geninfo: ERROR: no .gcda files found in .!
$ lcov --remove coverage.info '/usr/*' --output-file coverage.info
Reading tracefile coverage.info
lcov: ERROR: no valid records found in tracefile coverage.info
$ lcov --list coverage.info
Reading tracefile coverage.info
lcov: ERROR: no valid records found in tracefile coverage.info
$ bash <(curl -s https://codecov.io/bash) || \
echo "Codecov did not collect coverage reports"
_____ _
/____| | |
| | ___ __| | ___ ___ _____ __
| | /_ \/_` |/ _ \/ __/ _ \ \//
| |___| (_) | (_| | __/ (_| (_) \ V/
\_____\___/ \__,_|\___|\___\___/ \_/
Bash-8fda091
==> Travis CI detected.
project root: .
--> token set from env
...
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
-> Found 3 reports
==> Detecting git/mercurial file structure
==> Appending build variables
+ TRAVIS_OS_NAME
==> Reading reports
- Skipping empty file ./coverage.info
+ ./doc/****.zip bytes=337165 -----> That's not a report.
+ ./doc/****.pdf bytes=353614 -----> That's not a report.
==> Appending adjustments
http://docs.codecov.io/docs/fixing-reports
+ Found adjustments
==> Uploading reports
url: https://codecov.io
query: branch=codecov&commit=*****...
-> Pinging Codecov
-> Uploading to S3 https://codecov.s3.amazonaws.com
-> View reports at https://codecov.io/github/********
GCC的较新版本可以使用 - 覆盖一切。请参阅https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html。 –