# After changing this file, check it on:
# http://lint.travis-ci.org/
sudo: false
cache:
  directories:
    - $HOME/download
    - $HOME/.cache/pip

language: python
python:
  - "2.7"
  - "3.3"

# command to install dependencies
before_install:
# Install miniconda to avoid compiling scipy
  - mkdir -p download
  - cd download
  - wget -c https://repo.continuum.io/miniconda/Miniconda2-4.1.11-Linux-x86_64.sh -O miniconda.sh
  - chmod +x miniconda.sh
  - ./miniconda.sh -b
  - cd ..
  - export PATH=/home/travis/miniconda2/bin:$PATH

addons:
  apt_packages:
   - texlive-latex-recommended
   - texlive-latex-extra
   - texlive-fonts-recommended
   - dvipng

install:
# In Python 3.3, we test the min version of NumPy and SciPy. In Python 2.7, we test more recent version.
  - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then conda create --yes -q -n pyenv mkl python=2.7 numpy=1.9.1 scipy=0.14.0 nose=1.3.0 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx mkl-service libgfortran=1; fi
  - if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then conda create --yes -q -n pyenv mkl python=3.3 numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx mkl-service; fi
  - source activate pyenv
  - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install pydot; else pip install pydot-ng; fi
  - pip install . --no-deps
  - pip install flake8-future-import nose-parameterized==0.5.0 sphinx_rtd_theme

# command to run tests
env:
  - PART="theano/tests/test_flake8.py" DOC=1
  - PART="-e test_flake8.py theano/compat theano/compile theano/d3viz theano/gof theano/misc theano/sandbox theano/scalar theano/scan_module theano/sparse theano/tests theano/typed_list"
  - PART="theano/tensor"

matrix:
  fast_finish: true
  include:
    - python: "3.3"
      env: PART="-e test_flake8.py ." THEANO_FLAGS="mode=FAST_COMPILE"
    - python: "2.7"
      env: PART="-e test_flake8.py ." THEANO_FLAGS="mode=FAST_COMPILE,floatX=float32"

script:
  - export THEANO_FLAGS=$THEANO_FLAGS,warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc.cxxflags=-pipe
  - python --version
  - uname -a
  - free -m
  - df -h
  - ulimit -a
  # Move out of Theano so the import will use the installed version
  - cd ..
  # Move to the path of the installed version
  - cd $(python -c 'import theano; import os; print(os.path.split(theano.__file__)[0])')
  - echo "$PART"
  - cd -; cd Theano
  - python -c 'import theano; print(theano.config.__str__(print_doc=False))'
  - python -c 'import theano; assert(theano.config.blas.ldflags != "")'
  - theano-nose -v $PART
  - if [[ $DOC == "1" ]]; then python doc/scripts/docgen.py --nopdf --check; fi
  - if [[ $DOC == "1" ]]; then python doc/scripts/docgen.py --test --check; fi

after_failure:
  - cat /home/travis/.pip/pip.log
