Search code examples
c++11githubcmaketravis-cicoverity

How to setup Coverity Scan on GitHub with TravisCI?


I've managed to setup TravisCI for my C++ hosted on Github project, it works fine.
I would like to move on to static analysis of my C++ code with Coverity Scan.
Automatic upload with TravisCI to Scan Coverity is possible but I can't find a way to make it work.

My git repository is simple, there are two branches: master and coverity_scan.

To avoid triggering static analysis each time I'm pushing something, all stuff related to Scan Coverity is filled in coverity_scan branch:

language: cpp

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: "UEHXnbNPk49F6Ta/+d+UZl74EhtIevExwCo1l6qBndw+LvIXQDNSfsFiIJsZVfSgacBEOtd7CSY6rtccDpGeS9oX5/G/pnCz/2Cu+NOCCWlpy/S3qcUtdz52nMVatTgRhEi14WfrghpHk7nxxSi1W5+VIBfew+In11V1Xln3W06hhGOOK17Ljik18LbjSY1K9yVwK60r3tzwzSBMm/MArsqCeigzw15c0THQUtLlaLg/5nfP31f1QV9W1WlF4zIHjzd0970M385vNDDPyG+qRCfMPDEJrWb9/hJVi5x2poHLDObSE25rSQqfzc5nfiSDbH888mkdbBZXSwMVveVEhufyEk0nxI0Tddh/WNYFs+7g1gyV9409Tj288Omx++zpb0jM7/++wgkRwvBnqfBN7GWxoZJ9rHTxauJ+IIOR1jvskCTFMFMLI3C1+IpT4SgV0i6v2PtRsdGbXgI9qywhmPEjC+lS6Nu/rZQItr27rZowvw1ITYwJrDX4YQOAZxJkYNLFdGfqEMSjx0nfq6Kpl/4PaHQ7X0OtnJNgssMk3LNcYEwV1tLhTt+qODONjB7yWilcsWo8yVurr4vnFS2nIV7N4XgBvJcZHWfovxiQhfJU2UQxDvCYlDJ0RpM8kxpze+LR2vh+BbYOgPcr7YKG9MoAbsQXDGiF7yTz1VjVQr4="

addons:
  coverity_scan:
    project:
      name: LeFlou/Citadel
    build_command_prepend: "cmake"
    build_command: "make"
    branch_pattern: coverity_scan
  apt:
    sources:
    - ubuntu-toolchain-r-test
    packages:
    - gcc-4.8
    - g++-4.8
    - clang

compiler:
  - gcc
  - clang

before_script:
  - cmake .

script:
  - make

install:
# Use g++4.8 and not 4.6 (C++11 missing)
  - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi

branches:
  only:
    - coverity_scan

I want to trigger static analysis only when I push to coverity_scan, not building on TravisCI.
However, continuous integration must be working on master branch.

For the moment, code is only built but never uploaded to Coverity Scan.
What's wrong in my configuration ?

Edit:
I noticed in TravisCI validator multiple addons generate errors, only the last entry is processed. On the other hand, coverity_scan seem to build without trouble (I need apt to install more recent versions of g++, this is related to C++11 features).

Edit 20150910:
I merged both addons sections and this works.
But I'm still stuck on "Submitted first build" step.
I also changed COVERITY_SCAN_TOKEN, still this does not submit the build to Coverity Scan TravisCI build with these changes


Solution

  • I think your problem is in build_command_prepend, it's cmake . and not cmake.