[英]Different jacoco coverage results in a github action environment
is there any reason for a jacoco coverage report to produce different results when running it in a CI environment? jacoco 覆盖率报告在 CI 环境中运行时是否有任何理由产生不同的结果?
I have the following situation after migrating to Java 17. when I run ./gradlew clean build
the report is generated and the jacocoTestCoverageVerification
doesnt fail.迁移到 Java 17 后,我遇到以下情况。当我运行./gradlew clean build
时,会生成报告并且jacocoTestCoverageVerification
不会失败。
But when the same command is executed in a github runner I have a very different result, the coverage report is also created with different coverage values and some classes just fail the coverage verification.但是,当在 github 跑步者中执行相同的命令时,我得到了非常不同的结果,覆盖率报告也使用不同的覆盖率值创建,并且某些类只是未能通过覆盖率验证。
Unfortunately, I cannot provide code snippets but I already tried this:不幸的是,我无法提供代码片段,但我已经尝试过:
So it seems that something in a github action env produces this behavior.所以似乎 github 动作环境中的某些东西会产生这种行为。
versions:版本:
The problem here was lombok config files.这里的问题是 lombok 配置文件。 It turns out that the new version of lombok plugin compatible with java 17 and Gradle 7.3 does not generate the lombok.config
files anymore.事实证明,与 java 17 和 Gradle 7.3 兼容的新版 lombok 插件不再生成lombok.config
文件。
In the previous version, these files were generated by io.freefair.lombok
plugin, and we had them in.gitignore.在以前的版本中,这些文件是由io.freefair.lombok
插件生成的,我们将它们放在.gitignore 中。 Because of that, a local build worked just fine, since the files were still there.因此,本地构建工作得很好,因为文件仍然存在。
I realized this by looking at the generated reports and I noticed that lombok classes were being analyzed only by the CI.我通过查看生成的报告意识到了这一点,我注意到 lombok 类仅由 CI 分析。
In other cases, a similar problem could be related to this: https://www.eclemma.org/jacoco/trunk/doc/classids.html在其他情况下,类似的问题可能与此有关: https://www.eclemma.org/jacoco/trunk/doc/classids.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.