Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Adding [docs only] and [build docs] custom tags #199

Merged
merged 5 commits into from
Jun 8, 2017
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ env:
- PYTHON_VERSION=3.6

matrix:
- SETUP_CMD='egg_info'
TEST_CMD='python --version'
- SETUP_CMD='egg_info' TEST_CMD='python --version'

matrix:
include:
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ This does the following:
- Set up Miniconda.
- Set up the PATH appropriately.
- Set up a conda environment named 'test' and switch to it.
- Set the ``always_yes`` config option for conda to ``true`` so that you don't need to include ``--yes``.
- Register the specified channels, or if not stated the ``astropy``, ``astropy-ci-extras``, and ``openastronomy`` channels.
- Set the ``always_yes`` config option for conda to ``true`` so that you
don't need to include ``--yes``.
- Register the specified channels.
- ``export PYTHONIOENCODING=UTF8``
- Supports custom skip tags included in the commit message that are not yet
natively provided by Travis. To skip the travis build: [skip travis] or
[travis skip]. To run only the docs build: [build docs] or [docs
only]. The latter requires ``SETUP_CMD`` (see below) to be set to
"build_docs" or "build_sphinx".

Following this, various dependencies are installed depending on the following
environment variables
Expand All @@ -53,7 +59,7 @@ environment variables
* ``egg_info``: no dependencies are installed once the conda environment
has been created and any other environment variables are ignored.

* ``build_sphinx`` or ``build_docs``: the Sphinx and matplotlib packages
* ``build_docs`` or ``build_sphinx``: the Sphinx and matplotlib packages
are installed in addition to other packages that might be requested
via other environment variables.

Expand Down Expand Up @@ -206,9 +212,10 @@ The scripts include:
* ``appveyor/install-miniconda.ps1`` - set up conda on Windows
* ``appveyor/windows_sdk.cmd`` - set up the compiler environment on Windows
* ``travis/setup_dependencies_common.sh`` - set up conda packages on Linux and MacOS X
* ``travis/setup_conda.sh`` - set up conda on MacOS X or Linux, users should use this directly rather than the OS specific ones below
* ``travis/setup_conda_linux.sh`` - set up conda on Linux
* ``travis/setup_conda_osx.sh`` - set up conda on MacOS X
* ``travis/setup_conda.sh`` - set up conda on MacOS X or Linux


This repository can be cloned directly from the ``.travis.yml`` and
``appveyor.yml`` files when about to run tests and does not need to be
Expand Down
33 changes: 31 additions & 2 deletions travis/setup_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,39 @@
#
# The present script was added later.

if [[ $DEBUG == True ]]; then
set -x
fi

# First check: if the build should be run at all based on the event type

if [[ ! -z $EVENT_TYPE ]]; then
for event in $EVENT_TYPE; do
if [[ $TRAVIS_EVENT_TYPE = $event ]]; then
allow_to_build=True
fi
done
if [[ $allow_to_build != True ]]; then
travis_terminate 0
fi
fi

# Second check: if any of the custom tags are used to skip the build

TR_SKIP="\[(skip travis|travis skip)\]"
DOCS_ONLY="\[docs only|build docs\]"

# Skip build if the commit message contains [skip travis] or [travis skip]
# Remove workaround once travis has this feature natively
# https://github.com/travis-ci/travis-ci/issues/5032
echo "$TRAVIS_COMMIT_MESSAGE" | grep -E '\[(skip travis|travis skip)\]' \
&& echo "[skip travis] has been found, exiting." && exit 0
if [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E "$TR_SKIP") ]]; then
echo "Travis was requested to be skipped by the commit message, exiting."
travis_terminate 0
elif [[ ! -z $(echo $TRAVIS_COMMIT_MESSAGE | grep -E "$DOCS_ONLY") ]]; then
if [[ $SETUP_CMD != *build_docs* ]] && [[ $SETUP_CMD != *build_sphinx* ]]; then
echo "Only docs build was requested by the commit message, exiting."
travis_terminate 0
fi
fi

source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh;
15 changes: 2 additions & 13 deletions travis/setup_dependencies_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ hash -r

set -e

if [[ ! -z $EVENT_TYPE ]]; then
for event in $EVENT_TYPE; do
if [[ $TRAVIS_EVENT_TYPE = $event ]]; then
allow_to_build=True
fi
done
if [[ $allow_to_build != True ]]; then
travis_terminate 0
fi
fi

# We need to do this before updating conda, as $CONDA_CHANNELS may be a
# conda environment variable for some Miniconda versions, too that needs to
# be space separated.
Expand Down Expand Up @@ -255,7 +244,7 @@ fi

# DOCUMENTATION DEPENDENCIES
# build_sphinx needs sphinx and matplotlib (for plot_directive).
if [[ $SETUP_CMD == build_sphinx* ]] || [[ $SETUP_CMD == build_docs* ]]; then
if [[ $SETUP_CMD == *build_sphinx* ]] || [[ $SETUP_CMD == *build_docs* ]]; then
# Check whether there are any version setting env variables, pin them if
# there are (only need to deal with the case when they aren't listed in
# CONDA_DEPENDENCIES, otherwise this was already dealt with)
Expand Down Expand Up @@ -428,7 +417,7 @@ fi
# cache before starting the tests/docs build. See details in
# https://github.com/matplotlib/matplotlib/issues/5836

if [[ $SETUP_CMD == build_sphinx* ]] || [[ $SETUP_CMD == build_docs* ]]; then
if [[ $SETUP_CMD == *build_sphinx* ]] || [[ $SETUP_CMD == *build_docs* ]]; then
python -c "import matplotlib.pyplot"
fi

Expand Down