language: cpp
cache: ccache

branches:
    only:
        - master
        - coverity_scan

# not container-based
sudo: required

env:
  global:
    # below is coveralls token
    - secure: "fZqRStzy+aN3BPTRcc97+J4oidbIXcHlAQo2Sc25WGS1pV4+NOiM/gJeh+7WDfPmszXZBHdyyg/XPXeI86OMikXL7DaG53D/6Zq+qzVehyTlHi3sT93sDs53FbwAqa5F/dDf+z74VK7P+pQZkAr96ra8sU0Pz9nWr/8XhSpdZlE="

    # below is coverity token
    - secure: "WXFslB4aWOcCtMYnNlIYLkxi0aQ8R9ApMmV3fWlGN98gm2+5aaDKsRxpy9Q25ghQNgouS894klSqJhfB9Xa7SW389LHVor3FIYvYHZC0vSQQjFMg4/kUZg+t3HXhRt4254sxIJrTXSeF/3nOq1HMVIk4UanVUp7aihEyNcfJ6rk="


matrix:
  include:
    - os: osx
      osx_image: xcode10.1 # osx 10.13
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=NORMAL

    - os: osx
      osx_image: xcode11.3 # osx 10.14.6
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=NORMAL

    - os: osx
      osx_image: xcode11.4 # osx 10.15
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=NORMAL

    - os: linux
      dist: bionic
      compiler: gcc
      python: "3.7"
      env:
        - CMS_CONFIG=NORMAL

    - os: linux
      dist: bionic
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=NORMAL

    - os: linux
      dist: bionic
      compiler: gcc
      python: "2.7"
      env:
        - CMS_CONFIG=NORMAL_PYTHON2

    - os: linux
      dist: bionic
      compiler: clang
      python: "2.7"
      env:
        - CMS_CONFIG=NORMAL_PYTHON2

    - os: linux
      dist: bionic
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=GAUSS

    - os: linux
      dist: bionic
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=INTREE_BUILD

    - os: linux
      dist: bionic
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=STATS

    - os: linux
      dist: bionic
      compiler: clang
      python: "3.7"
      env:
        - CMS_CONFIG=STATIC

    - os: linux
      dist: bionic
      compiler: gcc
      python: "3.7"
      addons:
         apt:
            packages: mingw-w64
      env:
        - CMS_CONFIG=MINGW32
        - CC=x86_64-w64-mingw32-gcc-posix
        - CXX=x86_64-w64-mingw32-g++-posix

    #- os: linux
      #compiler: gcc
      #env: COVERITY_SCAN=1 CMS_CONFIG=NORMAL

    #- CMS_CONFIG=LARGEMEM_GAUSS
    #- CMS_CONFIG=ONLY_SIMPLE
    #- CMS_CONFIG=NOZLIB
    #- CMS_CONFIG=RELEASE
    #- CMS_CONFIG=NOSQLITE
    #- CMS_CONFIG=NOPYTHON
    #- CMS_CONFIG=SQLITE
    #- CMS_CONFIG=M4RI
    #- CMS_CONFIG=SLOW_DEBUG
    #- CMS_CONFIG=NOTEST
    #- CMS_CONFIG=ONLY_SIMPLE_STATIC

  allow_failures:
    # Covertiy scan might fail
    - env: COVERITY_SCAN=1 CMS_CONFIG=NORMAL

addons:
  coverity_scan:
    project:
      name: "msoos/cryptominisat"
      description: "Advanced SAT solver"
    notification_email: soos.mate@gmail.com
    build_command_prepend: "cmake ."
    build_command: "make"
    branch_pattern: coverity_scan

  sonarcloud:
    organization: "msoos-github"
    token:
      secure: "dtJVVMl23o7LVhjk4M3eGOc4e7NGaWQ/mRBLxOTkg1fsspi4drrzID24hD4YxTt2sYkwdxOLrKMuXdFs28L0Dc3K/2ktJW2vz+HzasDScIAaec2Mv0siT/O6PIBzT0BUo1tZrap4zQBGFziDpUFPBIR55OOI7OfKIh9fbtfuCwE="

before_install:
  # OSX below
  # we probably want to install python 3 though...
  #- if [[ "$TRAVIS_OS_NAME" == "osx"   ]]; then brew update; fi
  #- if [[ ("$TRAVIS_OS_NAME" == "osx")  &&  ("$CMS_CONFIG" != "NORMAL_PYTHON2") ]]; then brew upgrade python; fi
  #
  # linux below
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y --force-yes help2man; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y --force-yes python3-pip; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y --force-yes libboost-test-dev; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y --force-yes python3-setuptools; fi

#coveralls
  - if [[ "$CMS_CONFIG" == "COVERAGE" ]]; then ./scripts/travis-install-lcov.sh; fi
# lit
  # OSX below
  - if [[ ("$TRAVIS_OS_NAME" == "osx") && ("$CMS_CONFIG" != "NORMAL_PYTHON2") ]]; then sudo pip3 install --upgrade pip; pip3 install lit; fi
  # - if [[ "$TRAVIS_OS_NAME" == "osx"   ]]; then curl --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py -o get-pip.py; fi
  #- if [[ "$TRAVIS_OS_NAME" == "osx"   ]]; then sudo python get-pip.py; fi
  #- export PATH=$PATH:/Users/travis/Library/Python/2.7/bin
  #
  # linux below
  - if [[ ("$TRAVIS_OS_NAME" == "linux") && ("$CMS_CONFIG" != "NORMAL_PYTHON2") ]]; then sudo -H pip3 install --upgrade pip; pip3 install --user lit; which lit; fi
  - if [[ ("$TRAVIS_OS_NAME" == "linux") && ("$CMS_CONFIG" == "NORMAL_PYTHON2") ]]; then sudo -H pip install --upgrade pip; pip install --user lit; which lit; fi
  #
install:
  - git submodule init
  - git submodule update
  - mkdir -p build

script:
  - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./scripts/travis-cmake.sh ; fi
