language: python

sudo: false

cache:
  directories:
    - ~/.cache/pip

env:
  global:
    - PIP_WHEEL_DIR=$HOME/.cache/pip/wheels
    - PIP_FIND_LINKS=file://$HOME/.cache/pip/wheels

virtualenv:
  system_site_packages: true

addons:
  apt:
    packages:
    - libgdal1h
    - gdal-bin
    - libgdal-dev
    - libatlas-dev
    - libatlas-base-dev
    - gfortran
    - python-numpy
    - python-scipy

python:
- '2.7'

before_install:
  - pip install -U pip
  - pip install wheel

install:
  - "pip wheel -r requirements/dev.txt"
  - "pip install -r requirements/dev.txt"

script:
- nosetests

deploy:
  provider: pypi
  user: devseed
  password:
    secure: WtawFW/999XYszmZfj1Qk82l00OSyP2JBVOOGCERrW1gVO7MYtYsgP31HKRSzNTCTHJNVDpdK4WZWY6zPQqC3l2UfWYYsvRn0hCoI8AJxE5VCUEg6Ccpe6fMJuhp1pq6Zy7yrfBSZcOB9aqSHLBJsunD2o3mNlTC8WV8vNK74ck=
  on:
    repo: developmentseed/landsat-util
    branch: master

after_deploy:
  if [ "$TRAVIS_BRANCH" == "master" ]; then
    echo "Start Docker Hub Push"
    VER=$(python -c "import landsat; print landsat.__version__")
    docker build . -t developmentseed/landsat-util:$VER
    docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}
    docker push developmentseed/landsat-util:$VER
  fi
