|
| 1 | +#!/bin/bash |
| 2 | +# This script is meant to be called by the "install" step defined in |
| 3 | +# .travis.yml. See http://docs.travis-ci.com/ for more details. |
| 4 | +# The behavior of the script is controlled by environment variabled defined |
| 5 | +# in the .travis.yml in the top level folder of the project. |
| 6 | + |
| 7 | +set -e |
| 8 | + |
| 9 | +echo 'List files from cached directories' |
| 10 | +if [ -d $HOME/download ]; then |
| 11 | + echo 'download:' |
| 12 | + ls $HOME/download |
| 13 | +fi |
| 14 | +if [ -d $HOME/.cache/pip ]; then |
| 15 | + echo 'pip:' |
| 16 | + ls $HOME/.cache/pip |
| 17 | +fi |
| 18 | + |
| 19 | +# Deactivate the travis-provided virtual environment and setup a |
| 20 | +# conda-based environment instead |
| 21 | +deactivate |
| 22 | + |
| 23 | +# Add the miniconda bin directory to $PATH |
| 24 | +export PATH=/home/travis/miniconda3/bin:$PATH |
| 25 | +echo $PATH |
| 26 | + |
| 27 | +# Use the miniconda installer for setup of conda itself |
| 28 | +pushd . |
| 29 | +cd |
| 30 | +mkdir -p download |
| 31 | +cd download |
| 32 | +if [[ ! -f /home/travis/miniconda3/bin/activate ]] |
| 33 | +then |
| 34 | + if [[ ! -f miniconda.sh ]] |
| 35 | + then |
| 36 | + wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ |
| 37 | + -O miniconda.sh |
| 38 | + fi |
| 39 | + chmod +x miniconda.sh && ./miniconda.sh -b -f |
| 40 | + conda update --yes conda |
| 41 | + echo "Creating environment to run tests in." |
| 42 | + conda create -n testenv --yes python="$PYTHON_VERSION" |
| 43 | +fi |
| 44 | +cd .. |
| 45 | +popd |
| 46 | + |
| 47 | +# Activate the python environment we created. |
| 48 | +source activate testenv |
| 49 | + |
| 50 | +# Install requirements via pip in our conda environment |
| 51 | +pip install -r requirements.txt |
| 52 | + |
| 53 | +# Install the following only if running tests |
| 54 | +if [[ "$SKIP_TESTS" != "true" ]]; then |
| 55 | + # PyTorch |
| 56 | + conda install --yes pytorch torchvision -c pytorch |
| 57 | + |
| 58 | + # Installation |
| 59 | + python setup.py install |
| 60 | +fi |
0 commit comments