
language: python
python: 3.7
dist: xenial

addons:
  apt:
    packages:
      - gdb
      - apport

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi

install:
  - sudo apt-get install gcc-5 g++-5
  - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1
  - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda update -q conda
  # Useful for debugging any issues with conda
  - conda info -a
  - conda create --channel conda-forge -vv -q -n test-environment python=$TRAVIS_PYTHON_VERSION pybind11 pytest pandas numpy matplotlib scipy ipython sortedcontainers libzip boost-cpp hdf5 h5py statsmodels mypy flake8 plotly ipywidgets
  - source activate test-environment
  - CXX=g++-5 CC=g++-5 python setup.py build_ext --inplace

script:
  - which python
  - python -c 'print("hello")'
  - python -c 'import pyqstrat'
  - python -m pytest pyqstrat
  - mypy --ignore-missing-imports pyqstrat/*.py
  - flake8 --ignore W291,W293,E701 --max-line-length=160 pyqstrat/*.py
  