mirror of
https://github.com/saymrwulf/zipline.git
synced 2026-05-14 20:58:10 +00:00
113 lines
5.5 KiB
YAML
113 lines
5.5 KiB
YAML
language: python
|
|
fast_finish: true
|
|
python:
|
|
- 2.7
|
|
- 3.5
|
|
- 3.6
|
|
env:
|
|
global:
|
|
# 1. Generated a token for travis at https://anaconda.org/quantopian/settings/access with scope api:write.
|
|
# Can also be done via anaconda CLI with
|
|
# $ TOKEN=$(anaconda auth --create --name my_travis_token)
|
|
# 2. Generated secure env var below with travis gem via
|
|
# $ travis encrypt ANACONDA_TOKEN=$TOKEN
|
|
# See https://github.com/travis-ci/travis.rb#installation.
|
|
# If authenticating travis gem with github, a github token with the following scopes
|
|
# is sufficient: ["read:org", "user:email", "repo_deployment", "repo:status", "write:repo_hook"]
|
|
# See https://docs.travis-ci.com/api#external-apis.
|
|
- secure: "MxLrJ0ry2NtZXp4zESb0KP+AUuVns96XfPyZgmxrMOjH4epqLiP5NxaY/5UF9oTEdNQDnPO3Rw7M8rH8vuX5dzOVzP2/miAc+ltFQmlaXuERY5fu2LYTST8MCxokiuD4fdaFPFiaCCSrk+zQZSX2uDn161vK+FqZyGAQ9EEJebQ="
|
|
- CONDA_ROOT_PYTHON_VERSION: "2.7"
|
|
matrix:
|
|
- OLD_PANDAS=1
|
|
- NEW_PANDAS=1
|
|
matrix:
|
|
exclude:
|
|
- python: 2.7
|
|
env: NEW_PANDAS=1
|
|
- python: 3.6
|
|
env: OLD_PANDAS=1
|
|
# include:
|
|
# # Workaround Travis OSX not natively supporting Python.
|
|
# - os: osx
|
|
# language: generic
|
|
# env: TRAVIS_PYTHON_VERSION=2.7 OLD_PANDAS=1
|
|
# - os: osx
|
|
# language: generic
|
|
# env: TRAVIS_PYTHON_VERSION=3.5 OLD_PANDAS=1
|
|
# - os: osx
|
|
# language: generic
|
|
# env: TRAVIS_PYTHON_VERSION=3.5 NEW_PANDAS=1
|
|
|
|
cache:
|
|
directories:
|
|
- $HOME/.cache/.pip/
|
|
|
|
before_install:
|
|
- source ./ci/travis/install_miniconda.sh
|
|
- |
|
|
if [ "$OLD_PANDAS" ]; then
|
|
NUMPY_VERSION=1.11.3 PANDAS_VERSION=0.18.1 SCIPY_VERSION=0.17.1
|
|
else
|
|
NUMPY_VERSION=1.14.1 PANDAS_VERSION=0.22.0 SCIPY_VERSION=1.0.0 STATSMODELS_VERSION=0.9.0 PANDAS_DATAREADER_VERSION=0.4.0 DASK_VERSION=0.17.1
|
|
fi
|
|
- source ./ci/travis/overwrite_requirements.sh
|
|
- cat etc/requirements_locked.txt
|
|
|
|
install:
|
|
- conda info -a
|
|
- conda install conda=4.3.30 conda-build=3.0.28 anaconda-client=1.6.3 --yes -q
|
|
- conda list
|
|
|
|
- TALIB_VERSION=$(cat ./etc/requirements_locked.txt | grep "ta-lib" | sed "s/ta-lib==\([^ ]*\) *.*/\1/")
|
|
- CERTIFI_VERSION=$(cat ./etc/requirements_locked.txt | grep "certifi" | sed "s/certifi==\([^ ]*\) *.*/\1/")
|
|
- IFS='.' read -r -a NPY_VERSION_ARR <<< "$NUMPY_VERSION"
|
|
- CONDA_NPY=${NPY_VERSION_ARR[0]}${NPY_VERSION_ARR[1]}
|
|
- CONDA_PY=$TRAVIS_PYTHON_VERSION
|
|
|
|
- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" && "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then DO_UPLOAD="true"; else DO_UPLOAD="false"; fi
|
|
- |
|
|
for recipe in $(ls -d conda/*/ | xargs -I {} basename {}); do
|
|
if [[ "$recipe" = "zipline" ]]; then continue; fi
|
|
|
|
conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --skip-existing --old-build-string -c quantopian -c quantopian/label/ci
|
|
RECIPE_OUTPUT=$(conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --old-build-string --output)
|
|
if [[ -f "$RECIPE_OUTPUT" && "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
|
|
done
|
|
# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
|
|
# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
|
|
- python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
|
|
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
|
|
# Since conda installs latest certifi by default, we would fail to uninstall that new version when trying to install the pinned version using pip later in the build:
|
|
# "Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall."
|
|
- conda create -n testenv --use-local --yes -c quantopian -c quantopian/label/ci pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION pandas=$PANDAS_VERSION scipy=$SCIPY_VERSION ta-lib=$TALIB_VERSION libgfortran=3.0 certifi=$CERTIFI_VERSION
|
|
- source activate testenv
|
|
|
|
# XXX: With TRAVIS and CI both set, pip installing bcolz tries to compile it with coverage on py2, which fails to link against gcov on OSX.
|
|
# https://github.com/Blosc/bcolz/blob/8234a7505da5188dbaf415b7e36d4609d2c8c2f1/setup.py#L134-L136
|
|
- TRAVIS='' EXTERNAL_REQUIREMENTS='coveralls' etc/dev-install --cache-dir="$HOME/.cache/.pip/pip_np$CONDA_NPY"
|
|
|
|
before_script:
|
|
- pip freeze | sort
|
|
script:
|
|
- flake8 zipline tests
|
|
- nosetests --with-coverage
|
|
# deactivate env to get access to anaconda command
|
|
- source deactivate
|
|
|
|
# unshallow the clone so the conda build can clone it.
|
|
- git fetch --unshallow --tags
|
|
- exec 3>&1; ZP_OUT=$(conda build conda/zipline --python=$CONDA_PY --numpy=$CONDA_NPY -c quantopian -c quantopian/label/ci | tee >(cat - >&3))
|
|
- ZP_OUTPUT=$(echo "$ZP_OUT" | grep "anaconda upload " | awk '{print $NF}')
|
|
- if [ -z "$ZP_OUTPUT" ]; then exit 1; fi
|
|
# test that we can conda install zipline in a new env
|
|
- conda create -n installenv --yes -q --use-local python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION zipline -c quantopian -c https://conda.anaconda.org/quantopian/label/ci
|
|
- if [[ "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
|
|
# reactivate env (necessary for coveralls)
|
|
- source activate testenv
|
|
|
|
after_success:
|
|
- coveralls
|
|
|
|
branches:
|
|
only:
|
|
- master
|