sudo: false

branches:
only:
  - master

env:
  global:
    - BINSTAR_USER: jlaura
  matrix:
    - PYTHON_VERSION: 3.5

os:
  - linux
  - osx

before_install:

install:
  # We do this conditionally because it saves us some downloading if the
  # version is the same.
  - if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      if [ "$PYTHON_VERSION" == 2.7 ]; then
        wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
      else
        wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
      fi
    else
      if ["$PYTHON_VERSION" == 2.7]; then
        curl -o miniconda.sh  https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh;
      else
        curl -o miniconda.sh  https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh;
      fi
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda update -q conda
  # Useful for debugging any issues with conda
  - conda info -a

  # Install not using env because build needs to be in root env
  - conda config --add channels conda-forge
  - conda config --add channels jlaura
  - conda install python=$PYTHON_VERSION
  - conda install -c conda-forge gdal h5py
  - conda install pandas sqlalchemy pyyaml networkx affine
  - conda install -c jlaura pvl protobuf

  # Development installation
  - conda install nose coverage sh anaconda-client
  - pip install coveralls pytest

  # Straight from the menpo team
  - if [["$TRAVIS_OS_NAME" == "osx"]]; then
      curl -o condaci.py https://raw.githubusercontent.com/menpo/condaci/v0.4.8/condaci.py;
    else
      wget https://raw.githubusercontent.com/menpo/condaci/v0.4.8/condaci.py -O condaci.py;
    fi
  - python condaci.py setup


script:
  - nosetests --with-coverage --cover-package=plio
  # After test success, package and upload to Anaconda
  - ~/miniconda/bin/python condaci.py build ./conda

after_success:
  - coveralls

notifications:
  webhooks:
    on_success: always
    on_failure: always
    on_start: never
  email:
      recipients:
        - jlaura@usgs.gov
      on_success: always
      on_failure: always
