|
1 | 1 | #!/bin/bash |
2 | 2 | # Note that a virtual environment is required when running this script in CI |
| 3 | +# |
| 4 | +# Usage: ./htmlproofer.sh [ros_distro] |
| 5 | +# ros_distro: ROS distro to build docs against (e.g. rolling, jazzy, humble). |
| 6 | +# Defaults to the ROS_DISTRO environment variable, or "rolling". |
3 | 7 | set -e |
4 | 8 |
|
| 9 | +# Resolve the target ROS distro from the first argument, the ROS_DISTRO env var, or fall back to rolling |
| 10 | +ROS_DISTRO_ARG=${1:-${ROS_DISTRO:-rolling}} |
| 11 | + |
| 12 | +# Map the ROS distro to the corresponding moveit2 git branch. |
| 13 | +# main serves both rolling and jazzy; humble has its own branch. |
| 14 | +case "$ROS_DISTRO_ARG" in |
| 15 | + humble) MOVEIT_BRANCH=humble ;; |
| 16 | + *) MOVEIT_BRANCH=main ;; |
| 17 | +esac |
| 18 | + |
5 | 19 | # Define some config vars |
6 | 20 | export NOKOGIRI_USE_SYSTEM_LIBRARIES=true |
7 | 21 | export REPOSITORY_NAME=${PWD##*/} |
8 | | -export MOVEIT_BRANCH=main |
9 | | -echo "Testing branch $MOVEIT_BRANCH of $REPOSITORY_NAME" |
| 22 | +export MOVEIT_BRANCH |
| 23 | +echo "Testing branch $MOVEIT_BRANCH of $REPOSITORY_NAME (ROS distro: $ROS_DISTRO_ARG)" |
10 | 24 |
|
11 | 25 | # Install htmlpoofer |
12 | 26 | gem install --user-install html-proofer -v 3.19.4 # newer 4.x requires different cmdline options |
@@ -38,8 +52,8 @@ grep -rl 'https:\/\/github.com\/moveit\/moveit2_tutorials\/blob\/main\/' ./build |
38 | 52 | xargs sed -i "s|https://github.com/moveit/moveit2_tutorials/blob/main/|file://$PWD|g" |
39 | 53 |
|
40 | 54 | # Replace internal links with local file paths |
41 | | -grep -rl 'https:\/\/moveit.picknik.ai\/rolling\/' ./build/ | \ |
42 | | - xargs sed -i "s|https://moveit.picknik.ai/rolling/|file://$PWD|g" |
| 55 | +grep -rl "https:\/\/moveit.picknik.ai\/${ROS_DISTRO_ARG}\/" ./build/ | \ |
| 56 | + xargs sed -i "s|https://moveit.picknik.ai/${ROS_DISTRO_ARG}/|file://$PWD|g" |
43 | 57 |
|
44 | 58 | # Run HTML tests on generated build output to check for 404 errors, etc |
45 | 59 | # 429 or 403 - happens when GitHub rate-limits requests |
|
0 commit comments