运行每个Travis拉取请求构建的Coverity扫描 [英] Run Coverity scan for every Travis pull request build
问题描述
- 学生分叉我的 Github 存储库并修改文件
-
- 学生将本地代码推送到他的存储库并创建请求
- Travis CI 检测到请求并运行 Pull请求构建
- 如果代码构建成功, Coverity 为拉取请求运行静态代码分析
- 从 Github 拉取请求页面获取构建状态
我已成功为每个拉出请求设置Travis构建在我的回购。我已经通过Travis成功运行Coverity扫描,以进行每次提交回购。但是我无法触发Coverity扫描拉取请求,只有Travis构建运行。我可以修复这个问题并为每个拉取请求维护Coverity扫描报告吗?
这是我的 .travis.yml
语言:c
编译器:gcc
env:
global:
#下一个声明是加密COVERITY_SCAN_TOKEN,创建
通过# 特拉维斯加密 使用项目回购的公钥
命令 - 安全: WHkT1bLbpz8VA8tl + qyZvWHLg7YvnMPhCNXCEAQQaklcDq8HQ7glIrrs35VnTDfs09tVgkPbgsAfwBuwxqkmmxWaquW0AHdb6cefNpQVj2ovUriQVNBFmjfte9Bbq0NWKoLp + 4IY / 3IDfLoUOekOIDXuQtkJhNvX1zkkt21lSeo =
addons:
coverity_scan:
项目:
名称:Freeuni-CN101-2014 /期中
说明:通过Travis CI提交的版本
notification_email:example@mail.com
build_command_prepend:
build_command:make
branch_pattern:*
脚本:make
请求的Travis输出回购。我改变了我的 .travis.yml
文件,看起来像这样
language :c
编译器:gcc
before_install:
- sudo apt-get install -qq cppcheck
脚本:
- cppcheck - 错误 - 退出代码= 1 - 安静。
- make
cppcheck可能不如Coverity那么有效,但这对学生的作业已经足够了。
I want to automate student assignment grading system as much as possible. Ideally these steps will be taken when submitting the assignment.
- Student forks my Github repository and modifies files
- Student pushes the local code to his repository and creates pull request
- Travis CI detects pull request and run Pull Request build
- If code builds successfully, Coverity runs static code analysis for the pull request
- Student gets build status from the Github pull request page
I've successfully set Travis builds for every pull request in my repo. I have successfully run Coverity scan via Travis for every commit on my repo. But I can't trigger Coverity scans for pull request, only Travis builds are run. Can I fix this problem and maintain Coverity scan report for every pull request?
This is my .travis.yml
language: c
compiler: gcc
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "WHkT1bLbpz8VA8tl+qyZvWHLg7YvnMPhCNXCEAQQaklcDq8HQ7glIrrs35VnTDfs09tVgkPbgsAfwBuwxqkmmxWaquW0AHdb6cefNpQVj2ovUriQVNBFmjfte9Bbq0NWKoLp+4IY/3IDfLoUOekOIDXuQtkJhNvX1zkkt21lSeo="
addons:
coverity_scan:
project:
name: "Freeuni-CN101-2014/midterm"
description: "Build submitted via Travis CI"
notification_email: example@mail.com
build_command_prepend: ""
build_command: "make"
branch_pattern: "*"
script: make
Travis output of pull request here
Travis output after I merged the pull request with the main branch here
I asked Coverity support and they replied
The trigger for Coverity Scan happens for the specific branch and not for the pull request, and specially the branch that is mentioned in .travis.yml
UPDATE
With user @Admaster's help I started playing with Jenkins and cppcheck plugin. Jenkins is scanning pull requests successfully without setting build status to Github commits(Travis does set).
Example
So I continued experimenting with Travis and came over this repo. I changed my .travis.yml
file that looks like this
language: c
compiler: gcc
before_install:
- sudo apt-get install -qq cppcheck
script:
- cppcheck --error-exitcode=1 --quiet .
- make
cppcheck may be less effective then Coverity, but it's sufficient for students' assignments.
这篇关于运行每个Travis拉取请求构建的Coverity扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!