我正在尝试让codecov运行和处理Jacoco为我的multibuild Java Gradle项目生成的报告。但是,当我运行codecov脚本(bash <(curl -s https://codecov.io/bash)
)时,得到以下输出:
x> No CI provider detected.
Testing inside Docker? http://docs.codecov.io/docs/testing-with-docker
Testing with Tox? https://docs.codecov.io/docs/python#section-testing-with-tox
project root: .
Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
--> No coverage report found.
Please visit http://docs.codecov.io/docs/supported-languages
我已验证报告是由jacoco在
build/reports/jacoco/codeCoverageReport
中创建的,并且xml报告实际上已经存在。我按照here (Github)指南设置了jacoco报告。我的gradle代码和github上的代码之间的主要区别是我排除了
xml.destination "${buildDir}/reports/jacoco/report.xml"
,因为Gradle将无法对其进行处理。.codecov.yml
codecov:
require_ci_to_pass: true
coverage:
precision: 3
round: up
range: "70...100"
status:
project: true
patch: yes
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: yes
macro: no
comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: false
最佳答案
我想到了。运行bash <(curl -s https://codecov.io/bash) -h
列出了我可以使用的选项,在这里我发现有一个-f <file>
选项可以指定要使用的确切文件。
从这里,我只需在travis文件中使用它即可正确上传:bash <(curl -s https://codecov.io/bash) -f build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml