我正試圖在我的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。 –