gpt4 book ai didi

java - 使用 Gradle 进行 Travis CI + Coverity 扫描

转载 作者:行者123 更新时间:2023-11-30 07:58:58 27 4
gpt4 key购买 nike

我已经成功了 setup a project它使用 Travis CI 进行构建和测试。现在我正在尝试添加 Coverity Scan。

我创建了一个名为 coverity_scan 的分支,并将其设置为用于覆盖构建。将提交推送到该分支后,我可以在 Travis CI 构建控制台中看到 Coverity 工具开始执行其工作:

Coverity Scan analysis selected for branch coverity_scan.
Coverity Scan analysis authorized per quota.

...

Running Coverity Scan Analysis Tool...

Travis 构建成功,在 Coverity build-log.txt 文件中我看到了这个:

2016-10-06T21:02:39.132946Z|cov-build|2665|info|> 
2016-10-06T21:02:39.132946Z|cov-build|2665|info|> Build time (cov-build overall): 00:01:36.812431
2016-10-06T21:02:39.132946Z|cov-build|2665|info|>
2016-10-06T21:02:39.134719Z|cov-build|2665|info|> Build time (Java emits total): 00:01:07.595656
2016-10-06T21:02:39.134719Z|cov-build|2665|info|>
2016-10-06T21:02:39.134719Z|cov-build|2665|info|>
2016-10-06T21:02:39.134763Z|cov-build|2665|info|> Emitted 30 Java compilation units (100%) successfully
2016-10-06T21:02:39.134763Z|cov-build|2665|info|> [WARNING] Recoverable errors were encountered during 1 of these Java compilation units.
2016-10-06T21:02:39.134763Z|cov-build|2665|info|>
2016-10-06T21:02:39.134763Z|cov-build|2665|info|> 30 Java compilation units (100%) are ready for analysis
2016-10-06T21:02:39.134763Z|cov-build|2665|info|> For more details, please look at:
2016-10-06T21:02:39.134763Z|cov-build|2665|info|> /home/travis/build/Edvinas01/chat-rooms/server/cov-int/build-log.txt

但是,在完成此操作后,我在项目 Coverity 仪表板中看不到任何提交的构建或更改。项目状态保持在 pending

我关注了this像这样引导和设置我的 .travis.yml 文件:

language: java
jdk:
- oraclejdk8
before_script:
- cd server
- chmod +x gradlew
script:
# Run tests when not on coverity branch.
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then
./gradlew check;
fi
cache:
directories:
- ~/.gradle
after_success:
# Upload coveralls when not on coverity branch.
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then
./gradlew cobertura coveralls;
else
cat cov-int/build-log.txt;
fi
notifications:
email:
on_success: change
env:
matrix:
- TERM=dumb
global:
# COVERITY_SCAN_TOKEN
- secure: "<TOKEN>"
before_install:
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
addons:
coverity_scan:
project:
name: "Edvinas01/chat-rooms"
description: "Build submitted via Travis CI"
notification_email: "<EMAIL>"
build_command_prepend: "./gradlew clean"
build_command: "./gradlew build"
branch_pattern: coverity_scan

我是否必须指定一些额外的配置才能发布我的 Coverity 构建?

最佳答案

花些时间用 java 和覆盖率分析工具创建了一个虚拟机。拉取我的项目并运行该工具后,我在日志中注意到了这一点:

[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.

在摆弄了很多东西并查看了其他项目之后,我发现这是由于 Gradle 版本造成的。我的项目使用的是 3.0,所以我降级到 2.14.1,它终于可以正常工作了。

关于java - 使用 Gradle 进行 Travis CI + Coverity 扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39911113/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com