如何设置 Travis/Rails 项目以提交给 Coverity Scan? [英] How to setup a Travis/Rails project to submit to Coverity Scan?

查看:24
本文介绍了如何设置 Travis/Rails 项目以提交给 Coverity Scan?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Rails 应用程序寻找 std travis 覆盖设置.

I'm looking for a std travis coverity setup for a rails application.

我当前的 .travis.yml 文件如下所示:

My current .travis.yml file looks like this:

# environment settings
env:
  - DB=sqlite
  - DB=mysql
  - DB=postgresql
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: "<SECURE>"

# project language
language: ruby
rvm:
  - 2.3.1

# branches to build (whitelist)
branches:
  only:
    - master
    - coverity_scan
    - testing

# command to run before install
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-

# arguments for the bundler
bundler_args: --without production development

# addons
addons:
  coverity_scan:
    project:
      name: "<PROJECT_NAME>"
      description: "Build submitted via Travis CI"
    notification_email: <MY_EMAIL>
    build_command_prepend: ""
    build_command: "--no-command"
    branch_pattern: coverity_scan

# script
script:
  - RAILS_ENV=test bundle exec rake db:migrate --trace
  - bundle exec rake db:test:prepare
  - bundle exec rspec spec/
  - bundle exec cucumber

# run before script
before_script:
  - mysql -e 'create database my_app_test'
  - psql -c 'create database my_app_test' -U postgres

我不确定要在 addons.coverity_scanbuild_command 部分放什么.我已经尝试将其留空,--no-commandbundle installbundle install --jobs=3 --retry=3,但他们都没有工作.--no_command,例如,给我以下信息:

I'm not sure what to put in the build_command part of addons.coverity_scan. I already tried leaving it empty, --no-command, bundle install, and bundle install --jobs=3 --retry=3, but none of them worked. --no_command, for example, gives me the following message:

Coverity Scan analysis selected for branch coverity_scan.
Coverity Scan analysis authorized per quota.
$ curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | COVERITY_SCAN_PROJECT_NAME="$PROJECT_NAME" COVERITY_SCAN_NOTIFICATION_EMAIL="<MY_EMAIL>" COVERITY_SCAN_BUILD_COMMAND="--no-command" COVERITY_SCAN_BUILD_COMMAND_PREPEND="" COVERITY_SCAN_BRANCH_PATTERN=coverity_scan bash
Note: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com
Coverity Scan configured to run on branch coverity_scan
Coverity Scan analysis authorized per quota.
Downloading Coverity Scan Analysis Tool...
2016-09-13 23:26:36 URL:https://scan.coverity.com/download/Linux [449455458/449455458] -> "/tmp/cov-analysis-Linux.tgz" [1]
Extracting Coverity Scan Analysis Tool...
/tmp/coverity-scan-analysis ~/build/<PROJECT_NAME>
~/build/<PROJECT_NAME>
Running Coverity Scan Analysis Tool...
Coverity Build Capture (64-bit) version 8.5.0.3 on Linux 3.13.0-92-generic x86_64
Internal version numbers: db70178643 p-kent-push-26368.949
[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.
Please make sure you have configured the compilers actually used in the compilation.
 For more details, please look at: 
    /home/travis/build/<PROJECT_NAME>/cov-int/build-log.txt
Extracting SCM data for 0 files...
Please see the log file '/home/travis/build/<PROJECT_NAME>/cov-int/scm_log.txt' for warnings and SCM command issues.
[WARNING] Unable to gather all SCM data - see log at /home/travis/build/<PROJECT_NAME>/cov-int/scm_log.txt for details.
Successfully added SCM data for 0 files
Tarring Coverity Scan Analysis results...
Uploading Coverity Scan Analysis results...

而且因为我使用的是 travis,所以我无法查看日志文件...

And because I'm using travis I'm not able to look into the log files...

当命令为空时,它会失败并显示错误,需要给出一个命令,但它什么都不做.

When the command is empty it fails with the error, that a command needs to be given and it does nothing.

有人可以帮助我为 Rails 应用程序进行某种标准设置吗?

Can someone help me with some kind of a std setup for a rails app?

提前致谢!

推荐答案

使用 Coverity SCAN 8.5 支持的新语言的说明可在此处找到:https://scan.coverity.com/download?tab=other.我们假设用户在尝试 TravisCI 集成之前首先阅读这些说明.还强烈建议在尝试任何 CI 之前测试本地集成以确保捕获干净.

Instructions for using Coverity SCAN the new languages supported by 8.5 are found here : https://scan.coverity.com/download?tab=other . We assume that users first read these instructions prior to attempting TravisCI integration. It is also highly recommended that local integration is tested to ensure clean captures before attempting any CI.

这篇关于如何设置 Travis/Rails 项目以提交给 Coverity Scan?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆