Travis/Local: Difference between revisions
From charlesreid1
(→Output) |
(→Output) |
||
| Line 108: | Line 108: | ||
root@025e1ca5221b:/# conda create -n testenv --yes $DEPS pip nose setuptools python=$TRAVIS_PYTHON_VERSION | root@025e1ca5221b:/# conda create -n testenv --yes $DEPS pip nose setuptools python=$TRAVIS_PYTHON_VERSION | ||
root@025e1ca5221b:/# source activate testenv | |||
(testenv) root@025e1ca5221b:/# which python | |||
/home/travis/mc/envs/testenv/bin/python | |||
(testenv) root@025e1ca5221b:/# conda info | |||
Current conda install: | |||
platform : linux-64 | |||
conda version : 4.3.30 | |||
conda is private : False | |||
conda-env version : 4.3.30 | |||
conda-build version : not installed | |||
python version : 2.7.13.final.0 | |||
requests version : 2.14.2 | |||
root environment : /home/travis/mc (writable) | |||
default environment : /home/travis/mc/envs/testenv | |||
envs directories : /home/travis/mc/envs | |||
/root/.conda/envs | |||
package cache : /home/travis/mc/pkgs | |||
/root/.conda/pkgs | |||
channel URLs : https://repo.continuum.io/pkgs/main/linux-64 | |||
https://repo.continuum.io/pkgs/main/noarch | |||
https://repo.continuum.io/pkgs/free/linux-64 | |||
https://repo.continuum.io/pkgs/free/noarch | |||
https://repo.continuum.io/pkgs/r/linux-64 | |||
https://repo.continuum.io/pkgs/r/noarch | |||
https://repo.continuum.io/pkgs/pro/linux-64 | |||
https://repo.continuum.io/pkgs/pro/noarch | |||
https://conda.anaconda.org/conda-forge/linux-64 | |||
https://conda.anaconda.org/conda-forge/noarch | |||
config file : /root/.condarc | |||
netrc file : None | |||
offline mode : False | |||
user-agent : conda/4.3.30 requests/2.14.2 CPython/2.7.13 Linux/4.9.49-moby debian/jessie/sid glibc/2.19 | |||
UID:GID : 0:0 | |||
</pre> | </pre> | ||
Revision as of 07:05, 13 November 2017
This page covers notes on running local Travis tests (replicating the Travis environment on your local machine).
Guide here: https://github.com/erdc/proteus/wiki/Replicating-the-TravisCI-Environment-on-your-Local-Machine
Setup
Docker Pull
The Travis environment can be replicated with a Docker image. The docker image is travisci/ci-garnet and there is no latest tag.
Go to this page: https://hub.docker.com/r/travisci/ci-garnet/tags/
Click the "Tags" tab
Do a docker pull like this:
docker pull travisci/ci-garnet:packer-1510529493-6aa37a4
where the packer part comes from the latest tag.
Run the Travis Container
Run the container and have it execute the bash shell:
docker run -it travisci/ci-garnet:packer-1510529493-6aa37a4 /bin/bash
Use Travis.yml
To get the container set up before you run your tests, run the commands contained in the travis.yml script in the repository you're trying to run tests for.
Let's look at a sample travis.yml: https://github.com/soft-matter/trackpy/blob/master/.travis.yml
We have to run these commands to set up the conda environment:
Before we install anything:
if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then
wget http://repo.continuum.io/miniconda/Miniconda-3.5.5-Linux-x86_64.sh -O miniconda.sh;
else
wget http://repo.continuum.io/miniconda/Miniconda3-3.5.5-Linux-x86_64.sh -O miniconda.sh;
fi
chmod +x miniconda.sh
./miniconda.sh -b -p /home/travis/mc
export PATH=/home/travis/mc/bin:$PATH
To install stuff:
DEPS="numpy scipy matplotlib pillow pandas!=0.18.0 scikit-image pyyaml pytables numba scikit-learn" BUILD_DOCS=false conda update --yes conda conda config --append channels conda-forge conda create -n testenv --yes $DEPS pip nose setuptools python=$TRAVIS_PYTHON_VERSION source activate testenv # This is not necessary, it just outputs useful info to log for Travis CI: echo $PATH which python conda info conda list # Back to required stuff: python setup.py install
Now for the actual tests:
nosetests --nologcapture -a '!slow'
Output
root@025e1ca5221b:/# wget http://repo.continuum.io/miniconda/Miniconda-3.5.5-Linux-x86_64.sh -O miniconda.sh
[...]
root@025e1ca5221b:/# ./miniconda.sh -b -p /home/travis/mc
PREFIX=/home/travis/mc
installing: python-2.7.7-0 ...
installing: openssl-1.0.1h-0 ...
installing: pycosat-0.6.1-py27_0 ...
installing: pyyaml-3.11-py27_0 ...
installing: readline-6.2-2 ...
installing: requests-2.3.0-py27_0 ...
installing: sqlite-3.8.4.1-0 ...
installing: system-5.8-1 ...
installing: tk-8.5.15-0 ...
installing: yaml-0.1.4-0 ...
installing: zlib-1.2.7-0 ...
installing: conda-3.5.5-py27_0 ...
Python 2.7.7 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
root@025e1ca5221b:/# conda update --yes conda
root@025e1ca5221b:/# conda config --append channels conda-forge
root@025e1ca5221b:/# export PATH=/home/travis/mc/bin:$PATH
root@025e1ca5221b:/# export TRAVIS_PYTHON_VERSION="3.6"
root@025e1ca5221b:/# conda create -n testenv --yes $DEPS pip nose setuptools python=$TRAVIS_PYTHON_VERSION
root@025e1ca5221b:/# source activate testenv
(testenv) root@025e1ca5221b:/# which python
/home/travis/mc/envs/testenv/bin/python
(testenv) root@025e1ca5221b:/# conda info
Current conda install:
platform : linux-64
conda version : 4.3.30
conda is private : False
conda-env version : 4.3.30
conda-build version : not installed
python version : 2.7.13.final.0
requests version : 2.14.2
root environment : /home/travis/mc (writable)
default environment : /home/travis/mc/envs/testenv
envs directories : /home/travis/mc/envs
/root/.conda/envs
package cache : /home/travis/mc/pkgs
/root/.conda/pkgs
channel URLs : https://repo.continuum.io/pkgs/main/linux-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/linux-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/linux-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/linux-64
https://repo.continuum.io/pkgs/pro/noarch
https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
config file : /root/.condarc
netrc file : None
offline mode : False
user-agent : conda/4.3.30 requests/2.14.2 CPython/2.7.13 Linux/4.9.49-moby debian/jessie/sid glibc/2.19
UID:GID : 0:0