diff --git a/.travis.yml b/.travis.yml index ad47d1b2a8a..5fe977de233 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,9 +33,20 @@ before_install: - chmod +x bazel-0.1.2-installer-linux-x86_64.sh - ./bazel-0.1.2-installer-linux-x86_64.sh --user +before_script: + # required for building the website docs + - (cd website && npm install && npm install gulp && which gulp) + - wget -q https://github.com/spf13/hugo/releases/download/v0.15/hugo_0.15_amd64.deb + - sudo dpkg -i hugo*.deb + - hugo version + - pip install --user requests==2.9.0 + - pip install --user LinkChecker + - linkchecker --version + script: - which gcc-4.8 - gcc --version - which g++-4.8 - - g++ --version - - scripts/travis/build.sh && scripts/travis/test.sh + - g++ --version + # TODO: change below from ; to && once all links are fixed so we fail build on bad ones + - (cd website && make site); scripts/travis/build.sh && scripts/travis/test.sh diff --git a/website/Makefile b/website/Makefile index 82454486ccc..115091acf56 100755 --- a/website/Makefile +++ b/website/Makefile @@ -1,6 +1,8 @@ setup: @brew list hugo || brew install hugo @npm install + @which gulp || npm install gulp + @pip install linkchecker serve: @hugo server --watch diff --git a/website/README.md b/website/README.md index 88b62d70ba4..57fe2ed9e75 100644 --- a/website/README.md +++ b/website/README.md @@ -13,6 +13,7 @@ Running the Heron documentation locally requires that you have the following ins * [Make](https://www.gnu.org/software/make/) * [Node.js](https://nodejs.org/en/) * [npm](https://www.npmjs.com/) +* [pip](https://pypi.python.org/pypi/pip) ### OS X Setup @@ -74,6 +75,19 @@ browser from the command line: $ open http://localhost:1313/heron ``` +## Checking Links + +To verify that the links in the docs are all valid, run `make linkchecker`, which will produce a +report of broken links. If `linkchecker` fails to install or run properly, you can install it manually. +Note that due to this [https://github.com/wummel/linkchecker/pull/657](issue), `linkchecker` +versions 9.2 and 9.3 require the python `requests` >= 2.2.0 and < 2.10.0. + +```bash +$ pip uninstall requests +$ pip install requests==2.9.0 +$ pip install linkchecker +``` + ## Publishing the Site The content on the [twitter.github.io/heron](http://twitter.github.io/heron) website is what is diff --git a/website/linkchecker.sh b/website/linkchecker.sh index e621ed95d1c..8e611791cd8 100755 --- a/website/linkchecker.sh +++ b/website/linkchecker.sh @@ -1,14 +1,26 @@ -#! bin/bash +#!/bin/bash + +set -e + +function die { + echo $1 && exit 1 +} #linkchecker removes previous runs. -pip install linkchecker +which linkchecker || die 'Linkchecker must be installed to run this script. Exiting' rm -f linkchecker-errors.csv && rm -f linkchecker-out.csv -linkchecker public/index.html --no-warnings -F csv + +set +e +linkchecker public/index.html --no-warnings -F csv +STATUS=$? +set -e + #uses error code: on fail, write linkchecker-errors.csv for debugging -if [[ $? == 1 ]]; then +if [[ $STATUS != 0 ]]; then cut -sd ';' -f 1,2 linkchecker-out.csv | tr ';' ' ' | \ awk '{ print $2 " " $1}' | sort -u >> linkchecker-errors.csv; - echo "linkchecker failed - check linkchecker-errors.csv"; + echo "linkchecker failed - check linkchecker-errors.csv"; + exit $STATUS else echo "linkchecker passes"; fi