Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Speed up circle artifacts #309

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

Merged
merged 6 commits into from
Oct 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
machine:

environment:

PLOTLY_PACKAGE_ROOT: /home/ubuntu/python-api
PLOTLY_CONFIG_DIR: ${HOME}/.plotly
PLOTLY_PYTHON_VERSIONS: 2.7.8 3.3.3 3.4.1
PLOTLY_CORE_REQUIREMENTS_FILE: ${PLOTLY_PACKAGE_ROOT}/requirements.txt
PLOTLY_OPTIONAL_REQUIREMENTS_FILE: ${PLOTLY_PACKAGE_ROOT}/optional-requirements.txt

dependencies:

override:

# run all the pre-written installers (this will take a *while*)
Expand All @@ -19,8 +23,11 @@ dependencies:
- cd ~ && python -c "import plotly"

cache_directories:

- "~/.pyenv/versions" # attempt to just cache installed pyenv things

test:

override:

# run test suite in all our python versions
Expand All @@ -34,6 +41,6 @@ test:
- sudo chmod -R 777 ${PLOTLY_CONFIG_DIR} && python -c "import plotly"

# test core things in the general 2.7 version that circle has
- nosetests -xv plotly/tests/test_core --with-coverage --cover-package=plotly
- nosetests -x plotly/tests/test_core --with-coverage --cover-package=plotly
- mkdir "${CIRCLE_ARTIFACTS}/2.7" || true
- coverage html -d "${CIRCLE_ARTIFACTS}/2.7" --title=2.7
22 changes: 12 additions & 10 deletions circle/setup.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
#!/bin/bash

echo "running setup routine with python versions:"
SIG="☁☀☂"

echo "${SIG} Running setup routine with Python versions:"
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
echo " ${version}"
echo "${SIG} ${version}"
done

PROGNAME=$(basename $0)
function error_exit
{
echo -e "${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
echo -e "${SIG} ${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
exit 1
}

# PYENV shims need to be infront of the rest of the path to work!
echo "adding pyenv shims to the beginning of the path in this shell"
echo "${SIG} Adding pyenv shims to the beginning of the path in this shell."
export PATH="/home/ubuntu/.pyenv/shims:$PATH"

# for each version we want, setup a functional virtual environment
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
echo Setting up Python ${version}
echo "${SIG} Setting up Python ${version}"

# exporting this variable (in this scope) chooses the python version
export PYENV_VERSION=${version}
echo "Using pyenv version $(pyenv version)"
echo "${SIG} Using pyenv version $(pyenv version)"

# this was a major issue previously, sanity check that we're using the
# version we *think* we're using (that pyenv is pointing to)
echo "python -c 'import sys; print(sys.version)'"
echo "${SIG} python -c 'import sys; print(sys.version)'"
python -c 'import sys; print(sys.version)'

# install core requirements all versions need
pip install -r ${PLOTLY_CORE_REQUIREMENTS_FILE} ||
error_exit "${LINENO}: can't install core reqs for Python ${version}"
error_exit "${SIG} ${LINENO}: can't install core reqs for Python ${version}."

pip install -r ${PLOTLY_OPTIONAL_REQUIREMENTS_FILE} ||
error_exit "${LINENO}: can't install optional for Python ${version}"
error_exit "${SIG} ${LINENO}: can't install optional for Python ${version}."

# install some test tools
pip install nose coverage ||
error_exit "${LINENO}: can't install test tools for Python ${version}"
error_exit "${SIG} ${LINENO}: can't install test tools for Python ${version}."
done
52 changes: 20 additions & 32 deletions circle/test.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,47 @@
#!/bin/bash

echo "running test routine with python versions:"
SIG="☁☀☂"

echo "${SIG} Running test routine with python versions:"
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
echo " ${version}"
echo "${SIG} ${version}"
done

PROGNAME=$(basename $0)
function error_exit
{
echo -e "${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
echo -e "${SIG} ${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2
exit 1
}

# PYENV shims need to be infront of the rest of the path to work!
echo "adding pyenv shims to the beginning of the path in this shell"
echo "${SIG} Adding pyenv shims to the beginning of the path in this shell."
export PATH="/home/ubuntu/.pyenv/shims:$PATH"

# for each version we want, setup a functional virtual environment
for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do
echo Testing Python ${version}
echo "${SIG} Testing Python ${version}"

# exporting this variable (in this scope) chooses the python version
export PYENV_VERSION=${version}
echo "Using pyenv version $(pyenv version)"
echo "${SIG} Using pyenv version $(pyenv version)."

# this was a major issue previously, sanity check that we're using the
# version we *think* we're using (that pyenv is pointing to)
echo "python -c 'import sys; print(sys.version)'"
echo "${SIG} Running: python -c 'import sys; print(sys.version)'. We've got:"
python -c 'import sys; print(sys.version)'


echo "install plotly (ignoring possibly cached versions)"
pip install -I ${PLOTLY_PACKAGE_ROOT} ||
error_exit "${LINENO}: can't install plotly package from project root"

echo "import plotly to create .plotly dir if DNE"
python -c 'import plotly' ||
error_exit "${LINENO}: can't import plotly package"

# echo "${HOME}"
# echo "${PLOTLY_CONFIG_DIR}"
#
# # test that it imports when you don't have write permissions
# sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" ||
# error_exit "${LINENO}: permissions test 444 on .plotly dir failed"
#
# # test that setting write permissions will work for import (and tests)
# sudo chmod -R 666 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" ||
# error_exit "${LINENO}: permissions test 666 on .plotly dir failed"

echo "running tests for Python ${version} as user '$(whoami)'"
nosetests -xv plotly/tests --with-coverage --cover-package=plotly ||
error_exit "${LINENO}: test suite failed for Python ${version}"
mkdir "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" || true
coverage html -d "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" \
--title=${PYENV_VERSION}
echo "${SIG} Install plotly (ignoring possibly cached versions)."
pip install -I ${PLOTLY_PACKAGE_ROOT} >/dev/null ||
error_exit "${SIG} ${LINENO}: can't install plotly package from project root"

echo "${SIG} Import plotly to create .plotly dir if DNE."
python -c 'import plotly' >/dev/null ||
error_exit "${SIG} ${LINENO}: can't import plotly package"

echo "${SIG} Running tests for Python ${version} as user '$(whoami)'."
nosetests -x plotly/tests ||
error_exit "${SIG} ${LINENO}: test suite failed for Python ${version}"

done