dist: trusty
sudo: false

language: python

cache:
  directories:
    - $HOME/.cache/pip

matrix:
  include:
    - env: PYTHON_VERSION="3.5" NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1"
        SKLEARN_VERSION="0.19.1"
    - env: PYTHON_VERSION="3.6" NUMPY_VERSION="1.13.1" SCIPY_VERSION="0.19.1"
        SKLEARN_VERSION="0.20.3"
    - env: PYTHON_VERSION="3.7" NUMPY_VERSION="*" SCIPY_VERSION="*"
        SKLEARN_VERSION="*"
    - env: PYTHON_VERSION="3.7" NUMPY_VERSION="*" SCIPY_VERSION="*"
        SKLEARN_VERSION="nightly"

install:
  # install miniconda
  - deactivate
  - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
  - MINICONDA_PATH=/home/travis/miniconda
  - chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH
  - export PATH=$MINICONDA_PATH/bin:$PATH
  - conda update --yes conda
  # create the testing environment
  - conda create -n testenv --yes python=$PYTHON_VERSION pip
  - source activate testenv
  - |
    if [ $SKLEARN_VERSION = "nightly" ]; then
        conda install --yes -c conda-forge numpy==$NUMPY_VERSION scipy==$SCIPY_VERSION
        # install nightly wheels
        pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
    else
        conda install --yes -c conda-forge numpy==$NUMPY_VERSION scipy==$SCIPY_VERSION scikit-learn==$SKLEARN_VERSION
    fi
  - pip install codecov cython nose pytest pytest-cov
  - pip install .

script:
  - pytest -v doc/*rst
  - mkdir for_test
  - cd for_test
  - pytest -v --cov=bayesclass --pyargs bayesclass

after_success:
  - codecov
