summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2016-08-22 16:57:53 -0500
committerAdam J. Stewart <ajstewart426@gmail.com>2016-08-30 15:21:15 -0500
commitd2d6c91b6664352ddc1d41dd8bec3cbe837992de (patch)
tree2932a662912a3c49f9f41fbe591d70de4145c959 /share
parent679f787a65bf4d8b3aa0c7931da7771bb0b8fb1e (diff)
downloadspack-d2d6c91b6664352ddc1d41dd8bec3cbe837992de.tar.gz
spack-d2d6c91b6664352ddc1d41dd8bec3cbe837992de.tar.bz2
spack-d2d6c91b6664352ddc1d41dd8bec3cbe837992de.tar.xz
spack-d2d6c91b6664352ddc1d41dd8bec3cbe837992de.zip
Run documentation tests when documentation is modified
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/qa/run-doc-tests40
-rwxr-xr-xshare/spack/qa/run-flake8-tests1
2 files changed, 38 insertions, 3 deletions
diff --git a/share/spack/qa/run-doc-tests b/share/spack/qa/run-doc-tests
index e5b684fe59..2be5793d36 100755
--- a/share/spack/qa/run-doc-tests
+++ b/share/spack/qa/run-doc-tests
@@ -1,4 +1,40 @@
#!/usr/bin/env bash
+#
+# Description:
+# Builds Spack documentation and checks for
+# possible syntax errors. Treats warnings as
+# fatal errors.
+#
+# Usage:
+# run-doc-tests
+#
+# Notes:
+# Requires sphinx. Can be installed by running:
+# `spack install py-sphinx`
+# or:
+# `pip install sphinx`
+# and adding the bin directory to your PATH.
+#
+
+QA_DIR="$(dirname "$0")"
+SPACK_ROOT="$QA_DIR/../../.."
+DOC_DIR="$SPACK_ROOT/lib/spack/docs"
+
+# Move to documentation directory
+# Allows script to be run from anywhere
+cd "$DOC_DIR"
+
+# Gather array of changed files
+changed=($("$QA_DIR/changed_files" lib/spack/docs))
+
+# Cleanup temporary files upon exit or when script is killed
+trap 'make clean' EXIT SIGINT SIGTERM
+
+# Only run tests if documentation was updated
+if [[ "${changed[@]}" ]]; then
+ # Treat warnings as fatal errors
+ make SPHINXOPTS=-W
+else
+ echo No documentation was modified.
+fi
-# pass
-exit 0
diff --git a/share/spack/qa/run-flake8-tests b/share/spack/qa/run-flake8-tests
index 6c9f8968e2..6c7b4f2c79 100755
--- a/share/spack/qa/run-flake8-tests
+++ b/share/spack/qa/run-flake8-tests
@@ -28,7 +28,6 @@ SPACK_ROOT="$QA_DIR/../../.."
# Move to root directory of Spack
# Allows script to be run from anywhere
-SPACK_ROOT="$(dirname "$0")/../../.."
cd "$SPACK_ROOT"
# Gather array of changed files