language: shell

# this gives us extra memory:
sudo: required

os:
  - linux

service:
  - docker

env:
    # Not working - CONDA_PYTHON=2.7
  - CONDA_PYTHON=3.5
  - CONDA_PYTHON=3.6
  - CONDA_PYTHON=3.7

before_install:
  - docker pull cmungall/sparqlprog
  - docker run -d -p 4242:9083 -e PORT=9083 --name sparqlprog_pengines cmungall/sparqlprog
  # set conda path info
  - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
      MINICONDA_PATH=$HOME/miniconda;
      MINICONDA_SUB_PATH=$MINICONDA_PATH/bin;
    elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
      MINICONDA_PATH=/c/tools/miniconda3/;
      MINICONDA_PATH_WIN=`cygpath --windows $MINICONDA_PATH`;
      MINICONDA_SUB_PATH=$MINICONDA_PATH/Scripts;
    fi;
  # obtain miniconda installer
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
      wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    elif  [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
      wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
    fi;


install:
  # install miniconda
  # pip and conda will also need OpenSSL for Windows
  - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then
      bash miniconda.sh -b -p $HOME/miniconda;
    elif  [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
      choco install openssl.light;
      choco install miniconda3 --params="'/AddToPath:1 /D:$MINICONDA_PATH_WIN'";
    fi;
  - export PATH="$MINICONDA_PATH:$MINICONDA_SUB_PATH:$PATH";
  # for conda version 4.4 or later
  - source $MINICONDA_PATH/etc/profile.d/conda.sh;
  - hash -r;
  - conda config --set always_yes yes --set changeps1 no;
  - conda update -q conda;
  - echo "Python $CONDA_PYTHON running on $TRAVIS_OS_NAME";
  - conda create --name test-environment python=$CONDA_PYTHON || conda create --name test-environment -c conda-forge python=$CONDA_PYTHON;
  - conda activate test-environment;
  - conda --version ; python --version ; pip --version;
  - pip install -r requirements.txt;
  - pip install -r requirements-dev.txt;

script:
  - conda --version && python --version && pip --version;
  - make test;

services:
  - docker
