Skip to content

Commit

Permalink
add travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine Lytwynec committed Dec 11, 2014
1 parent d8fa605 commit b022e82
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: python
python: "2.7"
# This part isn't needed until we are running latexpdf builds.
# before_install:
# MacTex is used locally (MacOSX) by the docs team,
# but since we are using a linux machine for travis,
# we can use texlive-full instead.
# - "sudo apt-get update"
# - "sudo apt-get install texlive-full git python-dev -y"
install:
- "pip install -r shared/travis_requirements.txt"
script: "./run_tests.sh"
98 changes: 98 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Each documentation project is in a directory in the en_us folder.
# To generate docs for a project, Go to a project directory and
# run `make HTML` and `make latexpdf`.

# The directory that this script is located in.
BASE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# FAILED_BUILDS are builds that had either a SPHINX_ERROR
# or a BUILD_ERROR
FAILED_BUILDS=()

# BUILD_ERRORS are errors that resulted in the doc build
# exiting with a non-zero exit status.
BUILD_ERRORS=0

# SPHINX_ERRORS are errors that are reported by sphinx
# but do not cause the doc build to return a non-zero exit
# status. These are considered a build failure from a CI
# perspective though.
SPHINX_ERRORS=0

# SPHINX_WARNING are warning messages generated by sphinx
# while building the docs. They should not cause the CI
# build to fail.
SPHINX_WARNINGS=0

projects=(
"en_us/course_authors"
"en_us/data"
"en_us/install_operations"
"en_us/mobile"
"en_us/olx"
"en_us/ORA2"
"en_us/release_notes"
"en_us/students"
)

for project in "${projects[@]}"; do
cd $BASE_DIR/$project
echo "--> Starting build for $PWD"
project_build_status=0

# Make sure log dir exists
err_log_dir=$BASE_DIR/test_root/$project
err_log_file=$err_log_dir/err.log
mkdir -p $err_log_dir

# Generate html docs.
# -w writes warnings and errors to the specified file in
# addition to stderr.
# -n runs in nit-picky mode.
# -E Don’t use a saved environment (the structure caching all
# cross-references), but rebuild it completely.
make html SPHINXOPTS="-E -n -w $err_log_file"

if [ $? -gt 0 ]; then
project_build_status=1
BUILD_ERRORS=$((BUILD_ERRORS + 1))
fi

# Get errors and warnings from the error log
IFS=$'\n' read -d '' -r -a error_log < $err_log_file

num_errors=`echo ${error_log[@]} | grep -o 'ERROR:' | wc -l`
num_warnings=`echo ${error_log[@]} | grep -o 'WARNING:' | wc -l`

echo SPHINX ERRORS: $num_errors
echo SPHINX WARNINGS: $num_warnings
echo

if [ $num_errors -gt 0 ]; then
project_build_status=1
SPHINX_ERRORS=$((SPHINX_ERRORS + num_errors))
fi

if [ $num_warnings -gt 0 ]; then
SPHINX_WARNINGS=$((SPHINX_WARNINGS + num_warnings))
fi

if [ $project_build_status -gt 0 ]; then
FAILED_BUILDS+=($project)
fi
done

# Report and exit with the correct code
echo '********** All builds done ************'
echo TOTAL SPHINX ERRORS: $SPHINX_ERRORS
echo TOTAL SPHINX WARNINGS: $SPHINX_WARNINGS
echo OTHER BUILD ERRORS: $BUILD_ERRORS

if [ ${#FAILED_BUILDS[@]} -gt 0 ]; then
echo "There were errors while building the following projects:"
for project in "${FAILED_BUILDS[@]}"; do
echo $project
done
else
echo "All builds passed."
fi
4 changes: 4 additions & 0 deletions shared/travis_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used for documentation gathering
sphinx==1.1.3
sphinx_rtd_theme==0.1.5
sphinxcontrib-napoleon==0.2.6

0 comments on commit b022e82

Please sign in to comment.