# Travis CI configuration

# macOS
os: osx

before_install:
    # first uninstall a conflicting package
    - brew cask uninstall oclint

    # update and install required packages
    - brew update
    - brew install gcc
    # - brew install cmake # cmake is already installed in the default mac image

before_script:
    - mkdir build
    - cd build
    - cmake ..
  
script:
    - make -j 8

# Travis CI configuration
#
# Environment info
# https://docs.travis-ci.com/user/reference/overview/
# https://docs.travis-ci.com/user/reference/osx/
# https://docs.travis-ci.com/user/reference/trusty/

language: c

os:
    - linux
    - osx

# linux configuration; container-based environments (default for linux) require the following setup block
addons:
  apt:
    packages:
      - gfortran
      - libblas-dev
      - liblapack-dev

env:
    - FC=/usr/local/bin/gfortran-7
    - FC=/usr/bin/gfortran

# mac configuration
before_install:
    # first uninstall a conflicting package
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask uninstall oclint; fi

    # install required packages
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python; fi
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@7; fi
    # - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake; fi  # cmake is already installed in the default mac image

    # common configuration
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pyenv shell 3.6.3; fi
    - pip3 install numpy

install:
    - mkdir build && cd build
    - cmake .. -DBUILD_TESTING=ON
    - make -j 8 install

matrix:
  exclude:
    - os: linux
      env: FC=/usr/local/bin/gfortran-7
    - os: osx
      env: FC=/usr/bin/gfortran

script:
    # beamdyn unit tests
    - ctest -R beamdyn_utest

    # beamdyn regression tests
    - ctest -R bd_

    # subset of openfast regression tests
    # do not run
    # - 3, 4, 7, 15, 16, 17 since the free yaw is not well trusted
    # - 20, 21 because theyre too long
    # THIS IS COMMENTED UNTIL TESTS CAN RELIABLY DETERMINE REGRESSION
    # CURRENTLY, TESTS FAIL WITH VERY MINOR DIFFERENCES
    # - ctest -VV -j 18 -I 1,1,1,2,5,6,8,9,10,11,12,13,14,18,19,22,23,24,25,26

Expand TravisCI build and testing
Expand TravisCI build and testing
