Skip to content

Commit 174fe5d

Browse files
author
Joe Hamman
authored
Build documentation on TravisCI (#1908)
* test sphinx doc build on travis * test_env name for all environments * don't run unit tests on doc build * fix travis yaml * semicolons * sphinx_rtd_theme * install theme after the activating environment * fix list formatting in installing.rst * fail travis doc build only when full errors (not warnings) are found * flake8 for docs build
1 parent b6a0d60 commit 174fe5d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.travis.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ matrix:
4545
env: CONDA_ENV=py36-rasterio1.0alpha
4646
- python: 3.6
4747
env: CONDA_ENV=py36-zarr-dev
48+
- python: 3.5
49+
env: CONDA_ENV=docs
4850
allow_failures:
4951
- python: 3.6
5052
env:
@@ -86,16 +88,25 @@ before_install:
8688
- conda info -a
8789

8890
install:
89-
- conda env create --file ci/requirements-$CONDA_ENV.yml
91+
- if [[ "$CONDA_ENV" == "docs" ]]; then
92+
conda env create -n test_env --file doc/environment.yml;
93+
else
94+
conda env create -n test_env --file ci/requirements-$CONDA_ENV.yml;
95+
fi
9096
- source activate test_env
9197
- conda list
92-
- python setup.py install
98+
- pip install --no-deps -e .
9399
- python xarray/util/print_versions.py
94100

95101
script:
96102
- flake8 -j auto xarray
97103
- python -OO -c "import xarray"
98-
- py.test xarray --cov=xarray --cov-config ci/.coveragerc --cov-report term-missing --verbose $EXTRA_FLAGS
104+
- if [[ "$CONDA_ENV" == "docs" ]]; then
105+
conda install -c conda-forge sphinx_rtd_theme;
106+
sphinx-build -n -b html -d _build/doctrees doc _build/html;
107+
else
108+
py.test xarray --cov=xarray --cov-config ci/.coveragerc --cov-report term-missing --verbose $EXTRA_FLAGS;
109+
fi
99110

100111
after_success:
101112
- coveralls

doc/environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ dependencies:
1818
- sphinx-gallery
1919
- zarr
2020
- iris
21+
- flake8

doc/installing.rst

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Testing
7878
-------
7979

8080
To run the test suite after installing xarray, first install (via pypi or conda)
81+
8182
- `py.test <https://pytest.org>`__: Simple unit testing library
8283
- `mock <https://pypi.python.org/pypi/mock>`__: additional testing library required for python version 2
8384

0 commit comments

Comments
 (0)