@@ -17,6 +17,7 @@ matrix:
1717 dist : xenial
1818 env :
1919 - cmake_option="-DCORENRN_ENABLE_MPI=ON"
20+ - BUILD_DOCUMENTATION=ON
2021 - os : linux
2122 dist : xenial
2223 env :
@@ -84,6 +85,7 @@ addons:
8485 sources :
8586 - ubuntu-toolchain-r-test
8687 packages :
88+ - doxygen
8789 - bison
8890 - flex
8991 - libboost-all-dev
@@ -105,6 +107,15 @@ addons:
105107# Set up environments
106108# =============================================================================
107109before_install :
110+ # quickly return if this is a docs-only PR
111+ - |
112+ if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
113+ if ! git diff --name-only ${TRAVIS_COMMIT_RANGE} | grep -qvE '(\.md)$|(\.txt)$|^(docs/)' ; then
114+ echo "Skipping CI build since we have docs-only changes for ${TRAVIS_COMMIT_RANGE} :"
115+ git diff --name-only ${TRAVIS_COMMIT_RANGE}
116+ exit
117+ fi
118+ fi
108119 # brew installed flex and bison is not in $PATH
109120 # unlink python2 and use python3 as it's required for nmodl
110121 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
@@ -114,27 +125,36 @@ before_install:
114125 else
115126 pyenv global $PYTHON_VERSION;
116127 fi
117- # install NMODL dependencies
118- - if [[ "$USE_NMODL" == "ON" || "$USE_ISPC" == "ON" ]]; then
119- pip3 install jinja2 pyyaml pytest "sympy<1.6";
120- fi
121128 - if [ -n "$GCC_VERSION" ]; then
122129 export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}";
123130 $CXX --version;
124131 fi
132+
133+ install :
125134 # install ISPC compiler (only for mac or linux build for now)
126135 - if [[ "$USE_ISPC" == "ON" ]]; then
127- ispc_version="v1.12.0";
128- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
129- url_os="linux";
130- ispc_version_suffix="b";
131- else
132- url_os="macOS";
133- ispc_version_suffix="";
134- fi;
135- url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz";
136- wget -O ispc.tar.gz $url;
137- mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1;
136+ ispc_version="v1.12.0";
137+ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
138+ url_os="linux";
139+ ispc_version_suffix="b";
140+ else
141+ url_os="macOS";
142+ ispc_version_suffix="";
143+ fi;
144+ url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz";
145+ wget -O ispc.tar.gz $url;
146+ mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1;
147+ fi
148+
149+ # install NMODL dependencies
150+ - if [[ "$USE_NMODL" == "ON" || "$USE_ISPC" == "ON" ]]; then
151+ pip3 install --upgrade pip;
152+ pip3 install jinja2 pyyaml pytest "sympy<1.6";
153+ fi
154+ # install documentation dependencies
155+ - if [ "$BUILD_DOCUMENTATION" = "ON" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
156+ pip3 install --upgrade pip;
157+ pip3 install --user -r docs/docs_requirements.txt --upgrade;
138158 fi
139159# =============================================================================
140160# Build, test and install
@@ -154,3 +174,32 @@ script:
154174 - cmake --build .
155175 - ctest --output-on-failure
156176 - make install
177+
178+
179+ # =============================================================================
180+ # Prepare Documentation
181+ # =============================================================================
182+ after_success :
183+ - if [ "$BUILD_DOCUMENTATION" = "ON" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
184+ echo "------- Build Doxygen Documentation -------";
185+ pushd $TRAVIS_BUILD_DIR/build;
186+ make docs;
187+ echo "-------- Disable jekyll --------";
188+ pushd $TRAVIS_BUILD_DIR/build/docs;
189+ touch .nojekyll;
190+ fi
191+
192+
193+ # =============================================================================
194+ # Documentation deployment
195+ # =============================================================================
196+ deploy :
197+ provider : pages
198+ skip_cleanup : true
199+ github_token : $GITHUB_TOKEN
200+ keep_history : false
201+ local_dir : $TRAVIS_BUILD_DIR/build/docs
202+ target_branch : gh-pages
203+ on :
204+ branch : master
205+ condition : $BUILD_DOCUMENTATION = ON && $TRAVIS_OS_NAME = linux
0 commit comments