2014-04-26 06:56:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2018-04-18 06:55:14 +02:00
|
|
|
# Short circuit tests and linting jobs if there are no code changes involved.
|
|
|
|
if [[ $TOXENV != docs ]]; then
|
|
|
|
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]
|
|
|
|
then
|
|
|
|
echo "This is not a PR -- will do a complete build."
|
|
|
|
else
|
|
|
|
# Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
|
|
|
|
# may include more changes than desired if the history is convoluted.
|
|
|
|
# Instead, explicitly fetch the base branch and compare against the
|
|
|
|
# merge-base commit.
|
|
|
|
git fetch -q origin +refs/heads/$TRAVIS_BRANCH
|
|
|
|
changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
|
|
|
|
echo "Files changed:"
|
|
|
|
echo "$changes"
|
|
|
|
if ! echo "$changes" | grep -qvE '(\.rst$)|(^docs)|(^news)|(^\.github)'
|
|
|
|
then
|
|
|
|
echo "Only Documentation was updated -- skipping build."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-05-29 21:14:21 +02:00
|
|
|
# Export the correct TOXENV when not provided.
|
|
|
|
echo "Determining correct TOXENV..."
|
|
|
|
if [[ -z "$TOXENV" ]]; then
|
|
|
|
if [[ ${TRAVIS_PYTHON_VERSION} == pypy* ]]; then
|
2018-12-13 15:24:53 +01:00
|
|
|
export TOXENV=pypy
|
2018-05-29 21:14:21 +02:00
|
|
|
else
|
|
|
|
# We use the syntax ${string:index:length} to make 2.7 -> py27
|
|
|
|
_major=${TRAVIS_PYTHON_VERSION:0:1}
|
|
|
|
_minor=${TRAVIS_PYTHON_VERSION:2:1}
|
|
|
|
export TOXENV="py${_major}${_minor}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "TOXENV=${TOXENV}"
|
2018-05-26 13:16:12 +02:00
|
|
|
|
2018-05-29 21:14:21 +02:00
|
|
|
# Print the commands run for this test.
|
|
|
|
set -x
|
|
|
|
if [[ "$GROUP" == "1" ]]; then
|
|
|
|
# Unit tests
|
2018-10-25 17:35:25 +02:00
|
|
|
tox -- --use-venv -m unit
|
2018-05-29 21:14:21 +02:00
|
|
|
# Integration tests (not the ones for 'pip install')
|
2018-10-09 08:23:03 +02:00
|
|
|
tox -- --use-venv -m integration -n 4 --duration=5 -k "not test_install"
|
2018-05-29 21:14:21 +02:00
|
|
|
elif [[ "$GROUP" == "2" ]]; then
|
|
|
|
# Separate Job for running integration tests for 'pip install'
|
2018-10-09 08:23:03 +02:00
|
|
|
tox -- --use-venv -m integration -n 4 --duration=5 -k "test_install"
|
2017-07-06 01:51:42 +02:00
|
|
|
else
|
2018-05-29 21:14:21 +02:00
|
|
|
# Non-Testing Jobs should run once
|
2017-07-06 01:51:42 +02:00
|
|
|
tox
|
|
|
|
fi
|