-
Notifications
You must be signed in to change notification settings - Fork 196
/
htmlproofer.sh
executable file
·52 lines (42 loc) · 1.88 KB
/
htmlproofer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Note that a virtual environment is required when running this script in CI
set -e
# Define some config vars
export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
export REPOSITORY_NAME=${PWD##*/}
export MOVEIT_BRANCH=main
echo "Testing branch $MOVEIT_BRANCH of $REPOSITORY_NAME"
# Install htmlpoofer
gem install --user-install html-proofer -v 3.19.4 # newer 4.x requires different cmdline options
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
# Install python dependencies
pip3 install --upgrade -r requirements.txt
# Clear out any previous builds
rm -rf build
# Build API docs
mkdir -p build/html
pushd build/html
git clone https://github.com/moveit/moveit2 -b $MOVEIT_BRANCH --depth 1
pushd moveit2
sed -i "s/HTML_EXTRA_STYLESHEET =.*/HTML_EXTRA_STYLESHEET = ..\/..\/..\/theme.css/g" Doxyfile
DOXYGEN_OUTPUT_DIRECTORY="../api" doxygen
popd
rm -rf moveit2
popd
# Test build with non-ROS wrapped Sphinx command to allow warnings and errors to be caught
# TODO: Re-add the -W flag so that all warnings are treated as errors.
sphinx-build -b html . build/html
# Replace Edit on Github links with local file paths
grep -rl 'https:\/\/github.com\/moveit\/moveit2_tutorials\/blob\/main\/' ./build/ | \
xargs sed -i "s|https://github.com/moveit/moveit2_tutorials/blob/main/|file://$PWD|g"
# Replace internal links with local file paths
grep -rl 'https:\/\/moveit.picknik.ai\/rolling\/' ./build/ | \
xargs sed -i "s|https://moveit.picknik.ai/rolling/|file://$PWD|g"
# Run HTML tests on generated build output to check for 404 errors, etc
# 429 or 403 - happens when GitHub rate-limits requests
htmlproofer ./build \
--only-4xx --check-html --http-status-ignore "429" --http-status-ignore "403" \
--file-ignore ./build/html/genindex.html,./build/html/search.html,/html/api/ \
--alt-ignore '/.*/' --url-ignore '#'
# Tell GitHub Pages (on deploy) to bypass Jekyll processing
touch build/.nojekyll