# Test Travis CL

language: python

# can eventually include OSX here.
matrix:
    include:
        - os: linux
          env: PY=2.7

# whitelist
branches:
  only:
    - master

addons:
    apt:
        packages:
            - opencl-headers
            - fglrx
            - libblas-dev
            - libatlas-dev
            - libatlas-base-dev
            - liblapack-dev
            - gfortran
            - libhdf5-serial-dev

before_install:
    - echo $TRAVIS_OS_NAME
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
          wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
      fi
    - bash miniconda.sh -b -p $HOME/miniconda
    - export PATH="$HOME/miniconda/bin:$PATH"
    - hash -r
    - conda update --yes conda

    # Useful for debugging any issues with conda
    - conda info -a

    # could install other dependencies, but they're locked to specific
    # versions in build/requirements.txt
    - conda install --yes python=$PY numpy scipy cython pylint
    - sudo apt-get update; sudo apt-get install python-pyopencl python-matplotlib
    

install:
  - pip install -r build_tools/requirements.txt

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start
  
script:
  - cd ..
  # this should be the directory above the sasview directory, where we want to
  # clone the sasmodels
  - export WORKSPACE=$(pwd)
  #- export WORKSPACE=/home/travis/build/SasView/
  #- cd $WORKSPACE
  - git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git sasmodels
  #- export PYTHONPATH=$WORKSPACE/sasview/sasview-install:$WORKSPACE/sasview/utils:$PYTHONPATH
  - cd $WORKSPACE
  - ls -ltr
  - if [ ! -d "utils" ]; then mkdir utils; fi
  - /bin/sh -xe sasview/build_tools/travis_build.sh
#  - /bin/sh -xe sasview/build_tools/jenkins_linux_test.sh
  - export LC_ALL=en_US.UTF-8
  - export LANG=en_US.UTF-8
#  - python setup.py docs; echo 0
#  - python setup.py bdist_egg --skip-build

