#
# Derived from
# https://github.com/steveno/ctags/blob/master/.travis.yml
#

language: c

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

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: "FZunj1O8PR/2DEEN1tUAFzSxeo3jf2oOLkP7SmOSdeZ8W8QPo/5Nfhlhl0uambYOXOre/p/mCNXjudtsTwKHtq4uP6fejjPJl5cmHBCm/KtIoLnUaDyaSjoq6tKi2duJJhwY9H6X5ILtDxWveRbs5NhmKo9H+c1vHsBg0Wbuslg="

  addons:
    coverity_scan:
      project:
        name: "fishman/ctags"
      description: "Build submitted via Travis CI"
    notification_email: coverityctags@gmail.com
    build_command_prepend: "./autogen.sh ; ./configure ; make clean"
    build_command:   "make -j 4 CFLAGS=-O0"
    branch_pattern: master

sudo: false

addons:
  apt:
    packages:
      - lcov
      - binutils-mingw-w64-i686
      - gcc-mingw-w64-i686
      - libjansson-dev
      - libyaml-dev

env:
  - TARGET=Unix
  - TARGET=Mingw32

# Only with gcc get the mingw-w64 cross compilers
before_install:
  - if [ $CC = 'gcc' ] && [ $TRAVIS_OS_NAME = 'linux' ]; then gem install lcoveralls; fi
# Build and run tests. Only with gcc cross compile
script:
  - ./misc/travis-check.sh
after_success:
  - if [ $CC = 'gcc' ] && [ $TRAVIS_OS_NAME = 'linux' ]; then lcov -c -b . -d . -o coverage.info && lcoveralls --root . --retry-count 5 coverage.info; fi

# Build Matrix configuration
# By default Travis CI runs all possible environment/target combinations.
# This setting allows the exclusion of undesired combination.
# For more information:
# http://docs.travis-ci.com/user/customizing-the-build/#Build-Matrix
matrix:
  exclude:
    - compiler: clang
      env: TARGET=Mingw32
    - os: osx
      env: TARGET=Mingw32
