forked from quantopian/zipline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
85 lines (77 loc) · 4.22 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
language: python
sudo: false
fast_finish: true
python:
- 2.7
- 3.5
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: "qQ3vMSXUybUyKljJjgcVT9YaWcZ0PkdLZSFj6BVuo82SWO7e4L+hC8pqsa1Sm/EjyetVwfKk5lkvruPpro++8hDPLq3ahNOMmm4axfcWvACpW+acD/VCA5D8Dxz2ohrvpwsqo7BmIV6OUtIO5JeePHP1SqaIdVZFJ0pIAZToEWQ="
- CONDA_ROOT_PYTHON_VERSION: "2.7"
matrix:
- NUMPY_VERSION=1.11.1 SCIPY_VERSION=0.17.1
cache:
directories:
- $HOME/.cache/.pip/
before_install:
- if [ ${CONDA_ROOT_PYTHON_VERSION:0:1} == "2" ]; then wget https://repo.continuum.io/miniconda/Miniconda2-4.3.30-Linux-x86_64.sh -O miniconda.sh; else wget https://repo.continuum.io/miniconda/Miniconda3-4.3.30-Linux-x86_64.sh -O miniconda.sh; fi
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
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_talib.txt | sed "s/TA-Lib==\(.*\)/\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);'
- conda create -n testenv --debug --use-local --yes -c quantopian pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION libgfortran=3.0 ta-lib=$TALIB_VERSION
- source activate testenv
- CACHE_DIR="$HOME/.cache/.pip/pip_np""$CONDA_NPY"
- pip install --upgrade pip coveralls --cache-dir=$CACHE_DIR
- pip install -r etc/requirements.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_dev.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_blaze.txt --cache-dir=$CACHE_DIR # this uses git requirements right now
- pip install -r etc/requirements_talib.txt --cache-dir=$CACHE_DIR
- pip install -e .[all] --cache-dir=$CACHE_DIR
before_script:
- pip freeze | sort
script:
- flake8 zipline tests
- nosetests --with-coverage
# deactive env to get access to anaconda command
- source deactivate
# unshallow the clone so the conda build can clone it.
- git fetch --unshallow
- 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
- 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