Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker Testing to travisCI #473

Merged
merged 43 commits into from
Dec 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2892881
Add Docker Testing to travisCI
canyon289 Dec 29, 2018
35f22bb
Fix docker commands
canyon289 Dec 29, 2018
21b1337
Fix linting docker command
canyon289 Dec 29, 2018
22953bf
Fix sphinx and linting
canyon289 Dec 29, 2018
2f49b07
Fix sphinx build error
canyon289 Dec 29, 2018
09bc4d6
Add env variables for sphinx and pandoc to container
canyon289 Dec 29, 2018
9dd1431
Fix travis file
canyon289 Dec 29, 2018
412304c
Fix closing quotation issue
canyon289 Dec 29, 2018
b77b93d
Add coverage to default docker testing
canyon289 Dec 29, 2018
db48853
Fix unexpected end of file problem
canyon289 Dec 29, 2018
ec5c5b6
Add environmental vars in docker run command
canyon289 Dec 29, 2018
10ba4a4
Update docker version
canyon289 Dec 29, 2018
31ff663
Print docker version
canyon289 Dec 29, 2018
9bbb9bb
Another try with sphinx command
canyon289 Dec 29, 2018
89f86e7
Revert travis sphinx build
canyon289 Dec 29, 2018
78c4c8d
Another try at travis-sphinx
canyon289 Dec 29, 2018
eed1ea7
Practice makes perfect
canyon289 Dec 29, 2018
cba3545
Add language env variables to dockerfile
canyon289 Dec 29, 2018
ff28dcb
Remove latest image tag
canyon289 Dec 29, 2018
92d8400
Change conda env variable name in .bashrc
canyon289 Dec 29, 2018
5e0fafc
Add more debugging info to travis file
canyon289 Dec 29, 2018
29da59b
Fix doc deploy command
canyon289 Dec 29, 2018
8ce0af1
Add coveralls install
canyon289 Dec 29, 2018
7b2578d
Fix spaces in travis-sphinx deploy
canyon289 Dec 29, 2018
17fa7af
Add travis branch env var to arviz_sphinx container
canyon289 Dec 29, 2018
efe7c6b
Add env vars to coveralls and travis-sphinx
canyon289 Dec 29, 2018
ff8b886
Fix placement of env variable for travis-sphinx
canyon289 Dec 29, 2018
6b0e0a3
Fix env variable arguments yet again
canyon289 Dec 29, 2018
20329e3
Add more env variables and coveralls token
canyon289 Dec 29, 2018
e8b32d9
Add more env vars into travis-sphinx
canyon289 Dec 29, 2018
4feb8ac
Attempt to fix line continuation
canyon289 Dec 29, 2018
9d19a3b
Export coveralls env var and single line travis-sphinx
canyon289 Dec 29, 2018
128242f
Update travis file
canyon289 Dec 30, 2018
4b2098b
Add comments and remove unneeded code
canyon289 Dec 30, 2018
6f3cde5
Add travis-sphinx back into requirements-dev.txt
canyon289 Dec 30, 2018
f68296f
Make testing more explicit in travis file
canyon289 Dec 30, 2018
588658f
Try travis file copy hack for coveralls
canyon289 Dec 30, 2018
92b47ff
Fix copy mistake
canyon289 Dec 30, 2018
d3d2c04
Add .coveragerc file
canyon289 Dec 30, 2018
35c6e98
Try cp with sudo
canyon289 Dec 30, 2018
aad23df
Add sudo to cp
canyon289 Dec 30, 2018
5ceaee5
Add opt
ahartikainen Dec 30, 2018
45b6206
Remove opt
ahartikainen Dec 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[paths]
source =
/home/travis/build/arviz-devs/arviz

52 changes: 38 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ dist: xenial

language: python

services:
- docker

matrix:
include:
- name: "Python 3.6 Unit Test"
Expand All @@ -18,32 +21,53 @@ matrix:
env: PYSTAN_VERSION=latest NAME="SPHINX"

addons:
apt_packages:
- pandoc
apt:
packages:
- docker-ce

cache:
directories:
- $HOME/.theano
- $HOME/miniconda
before_install:
- docker pull conda/miniconda3
- docker --version

install:
- sudo apt-get -qq update
- . ./scripts/install_miniconda.sh
- conda info -a
- . ./scripts/create_testenv.sh
# Build docker image
- . ./scripts/container.sh --build

# Print conda details
- docker run --rm arviz:latest /bin/bash -c "conda info -a"

# Print conda environment details
- docker run --rm arviz:latest /bin/bash -c "source /root/.bashrc && conda list"

# Install packages needed for service integration
- if [[ $NAME == UNIT ]]; then pip install coveralls ; fi
- if [[ $NAME == SPHINX ]]; then pip install travis-sphinx ; fi

before_script:
# Doesn't affect testing anymore but leaving for reference
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
- export MKL_THREADING_LAYER=GNU

script:
- if [[ $NAME == LINT ]]; then . ./scripts/lint.sh ; fi
- if [[ $NAME == UNIT ]]; then pytest -v arviz/tests/ --cov=arviz/ ; fi
- if [[ $NAME == SPHINX ]]; then travis-sphinx build --nowarn --source=doc ; fi

# Tests command is default in dockerfile cmd
- if [[ $NAME == UNIT ]]; then docker run --mount type=bind,source="$(pwd)",target=/opt/arviz --name arviz_test arviz:latest /bin/bash -c \
"source /root/.bashrc && pytest -v arviz/tests/ --cov=arviz/";
fi

- if [[ $NAME == LINT ]]; then docker run arviz:latest /bin/bash -c \
"source /root/.bashrc && ./scripts/lint.sh";
fi

# Awkward line spacing to avoid travis-ci errors
- if [[ $NAME == SPHINX ]]; then docker run --mount type=bind,source="$(pwd)",target=/opt/arviz --name arviz_sphinx arviz:latest /bin/bash -c \
"source /root/.bashrc && travis-sphinx build --nowarn --source=doc";
fi

after_success:
- echo $(pwd)
- ls -la
- if [[ $NAME == SPHINX ]]; then travis-sphinx deploy; fi
- if [[ $NAME == UNIT ]]; then coveralls ; fi
- if [[ $NAME == UNIT ]]; then sudo cp -r ../arviz /opt && coveralls; fi
9 changes: 7 additions & 2 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ ENV PYTHON_VERSION=${PYTHON_VERSION}
ENV PYSTAN_VERSION=${PYSTAN_VERSION}
ENV DOCKER_BUILD=true

RUN apt-get update && apt-get install -y git build-essential \
# For Sphinx documentation builds
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get update && apt-get install -y git build-essential pandoc \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements and environment installation scripts
Expand All @@ -34,4 +38,5 @@ COPY $SRC_DIR /opt/arviz
RUN rm -f arviz/tests/saved_models/*.pkl
RUN find -type d -name __pycache__ -exec rm -rf {} +

CMD ["/bin/bash", "-c", "source /root/.bashrc && pytest -vv arviz/tests && echo Finished Testing"]
CMD ["/bin/bash", "-c", "source /root/.bashrc && pytest -vv arviz/tests --cov=arviz/ && \
echo Finished Testing"]
2 changes: 1 addition & 1 deletion scripts/create_testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [[ $* != *--global* ]]; then
if [ "$DOCKER_BUILD" = true ] ; then
# Also add it to root bash settings to set default if used later
echo "Creating .bashrc profile for docker image"
echo "set env=${ENVNAME}" > /root/.bashrc
echo "set conda_env=${ENVNAME}" > /root/.bashrc
echo "source activate ${ENVNAME}" >> /root/.bashrc
fi
fi
Expand Down