language: cpp
env:
  global: 
    - secure: "KXrNrSs66/J5fb8pRYTUhIjEiXizlZ7p0xVROPla+GWfwyLJIAiswbwYOBpR1kSTn51E+j6j14UWL36GC31TK5WXRJoWoyVXi1RH+zZfvESAwqI6OmhzTWQd84fyXJ+vx5Yg0qEhPGH0HFGaNrpAvsBtr8lmsoLgocEaMikqxQ8="
    
matrix:
  include:
    - os: linux
      addons:
        apt:
          packages:
            - gfortran
    - os: osx 
      osx_image: xcode10
      env: OSX=10.13
      compiler: clang
    - os: osx 
      osx_image: xcode9.2
      env: OSX=10.12
      compiler: clang
    - os: osx
      osx_image: xcode8
      env: OSX=10.11
      compiler: clang
    - os: osx
      osx_image: beta-xcode6.2
      env: OSX=10.9
      compiler: clang
  allow_failures:
    - os: osx

before_script:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then  export PLATFORM=osx$OSX-x86_64-clang`clang -dumpversion`; fi
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install bash gcc; brew link --overwrite gcc; gfortran --version; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PLATFORM=linux-x86_64-gcc`gcc -dumpversion`; fi
  - git clone https://github.com/coin-or/COIN-OR-OptimizationSuite COIN
  - cd COIN
  - export PROJECT=`echo $TRAVIS_REPO_SLUG | cut -d "/" -f 2`
  - bash ./coin.install.sh fetch --no-prompt --main-proj=$PROJECT > /dev/null

script:
  - bash ./coin.install.sh build --no-prompt --main-proj=$PROJECT --verbosity=2 --test

after_script:
  - if [ $TRAVIS_BRANCH = "master" ]; then export VERSION=trunk; else export VERSION=`echo $TRAVIS_BRANCH | cut -d "/" -f 2`; fi
  - export TGZ_FILE=$PROJECT-$VERSION-$PLATFORM.tgz
  - echo $TGZ_FILE
  - tar -czvf $TGZ_FILE build/lib/* build/bin/* build/include/* build/share/* $PROJECT/README.md $PROJECT/INSTALL $PROJECT/LICENSE $PROJECT/$PROJECT/AUTHORS
  - curl -T $TGZ_FILE -utkralphs:$BINTRAY_API -H "X-Bintray-Publish:1" -H "X-Bintray-Override:1" https://api.bintray.com/content/coin-or/download/$PROJECT/$VERSION/$TGZ_FILE
