# After changing this file, check it on:
#   http://lint.travis-ci.org/
language: python
sudo: false

python:
  - '3.4'
  - '3.5'
  - '3.6'
  - '3.7'
  - '3.8'
  - '3.9-dev'
  - 'nightly'
  - 'pypy3'


env:
  - TEST_PYCRYPTO=1

matrix:
  allow_failures:
    - python: 'nightly'
    - python: 'pypy3'
  include:
    - python: '3.5'
      env:
        - USE_WHEEL=1
        - TESTMODE=full

# In order to test with and without some libraries, we explicitly
# install deps instead of installing from the requirements file

addons:
  apt:
    packages:
    - libatlas-dev
    - libatlas-base-dev
    - liblapack-dev
    - gfortran
    - libgmp-dev
    - libmpfr-dev

before_install:
  - export PYTHONFAULTHANDLER=1
  - export PATH=/usr/lib/ccache:$PATH
  - mkdir builds
  - pushd builds
  # Install gmpy2 dependencies
  - mkdir -p $HOME/.local
  - wget https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
  - tar xzvf mpc-1.0.3.tar.gz
  - pushd mpc-1.0.3
  - ./configure --prefix=$HOME/.local
  - make
  - make install
  - popd
  - export CPATH=$HOME/.local/include
  - export LIBRARY_PATH=$HOME/.local/lib
  - export LD_LIBRARY_PATH=$HOME/.local/lib
  - travis_retry pip install gmpy2
  - if [ "${TESTMODE}" == "full" ]; then pip install coverage; fi
  - travis_retry pip install -U pip setuptools
  - if [ "${USE_WHEEL}" == "1" ]; then pip install wheel; fi
  - if [ "${TEST_PYCRYPTO}" == "1" ]; then pip install pycrypto>=2.6.1; fi
  - travis_retry pip install nose numpy click nose-timer
  - python -V
  - popd
  - set -o pipefail

install:
  - travis_retry pip install -e .

script:
  - nosetests -v --with-timer --timer-top-n 10
  - if [ "${TESTMODE}" == "full" ]; then coverage run `which nosetests`; coverage report -i phe/*; fi
  - if [ "${USE_WHEEL}" == "1" ]; then python setup.py bdist_wheel; fi