From df6009d6bff734f2838a677f53deed866f49424e Mon Sep 17 00:00:00 2001 From: Stefan Fabian Date: Tue, 3 Sep 2024 10:33:15 +0200 Subject: [PATCH] Add CI for ROS2. (#17) * Initial ros2 pipeline. * Don't run noetic CI on jazzy. * Updated documentation build. * Github only supports one pages deployment, so we only deploy on latest branch. * Updated documentation build. * Updated documentation setup step. * Added missing sudo. * Updated docs conf. * Add asan to CI tests to find memory issues. * Build hector_math_py before building documentation to enable automatic generation of graphics. * Disable asan new-delete-type-mismatch since rcutils triggers it. * $default-branch is only available in templates not in actual workflow instances. Only deploy if not a PR. * Changed upload pages artifact version to v3. * Update sourcing of built packages. * Make entire documentation deploy job conditional on "is not a pull request" not just the deploy step. * Fixed check for GITHUB_REF_NAME in docs build. * Install python3-git in docs workflow. --- .github/build_docs_on_github.sh | 154 ---------------------- .github/workflows/{ci.yml => ci-ros1.yml} | 6 +- .github/workflows/ci-ros2.yml | 54 ++++++++ .github/workflows/documentation.yml | 59 ++++++--- docs/conf.py | 107 ++------------- 5 files changed, 111 insertions(+), 269 deletions(-) delete mode 100755 .github/build_docs_on_github.sh rename .github/workflows/{ci.yml => ci-ros1.yml} (94%) create mode 100644 .github/workflows/ci-ros2.yml diff --git a/.github/build_docs_on_github.sh b/.github/build_docs_on_github.sh deleted file mode 100755 index 3786cbe..0000000 --- a/.github/build_docs_on_github.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -set -x - -# file adapted from https://tech.michaelaltfield.net/2020/07/18/sphinx-rtd-github-pages-1 by Michael Altfield -# added doxygen code documentation and downgraded docutils (otherwise bullet points are not shown correctly) - -##################### -# GO TO DOCS FOLDER # -##################### - -cd ../hector_math || { echo "Error: Failed to change directory"; exit 1; } - -################### -# INSTALL DEPENDS # -################### - -apt-get update -apt-get -y install git rsync python3-sphinx python3-sphinx-rtd-theme python3-stemmer python3-git python3-pip python3-virtualenv python3-setuptools - -python3 -m pip install --upgrade rinohtype pygments breathe sphinxcontrib-video -python3 -m pip install -I docutils==0.16 - -##################### -# DECLARE VARIABLES # -##################### -export REPO_NAME="${GITHUB_REPOSITORY##*/}" -git config --global --add safe.directory /__w/${REPO_NAME}/${REPO_NAME} -pwd -ls -lah -export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) - -# make a new temp dir which will be our GitHub Pages docroot -docroot=$(mktemp -d) - -############## -# BUILD DOCS # -############## - -# first, cleanup any old builds' static assets -make -C docs clean -if [ $? -ne 0 ]; then - echo "Failed to clean docs" - exit 1 -fi - - - -# only build documentation for master branch - -current_version="master" - -git checkout "${current_version}" -# make the current language available to conf.py -export current_version - -echo "INFO: Building sites for ${current_version}" - -# skip this branch if it doesn't have our docs dir & sphinx config -if [ ! -e 'docs/conf.py' ]; then - echo -e "\tINFO: Couldn't find 'docs/conf.py' (skipped)" - exit 2 -fi - -#languages="en `find docs/locales/ -mindepth 1 -maxdepth 1 -type d -exec basename '{}' \;`" -current_language='en' - -# make the current language available to conf.py -export current_language - -########## -# BUILDS # -########## -echo "INFO: Building for ${current_language}" -# HTML # -sphinx-build -b html docs/ docs/_build/html/${current_language}/"${current_version}" -D language="${current_language}" - -# PDF # Not working somehow rinoh fails due to @endverbatim and @see tags -#echo "Start pdf build" -#sphinx-build -b rinoh docs/ docs/_build/rinoh -D language="${current_language}" -#mkdir -p "${docroot}/${current_language}/${current_version}" -#cp "docs/_build/rinoh/target.pdf" "${docroot}/${current_language}/${current_version}/hector_math-docs_${current_language}_${current_version}.pdf" -#echo "End pdf build" - -# EPUB # -sphinx-build -b epub docs/ docs/_build/epub -D language="${current_language}" -mkdir -p "${docroot}/${current_language}/${current_version}" -cp "docs/_build/epub/target.epub" "${docroot}/${current_language}/${current_version}/hector_math-docs_${current_language}_${current_version}.epub" - -# copy the static assets produced by the above build into our docroot -rsync -av "docs/_build/html/" "${docroot}/" - -# return to master branch -git checkout master - -####################### -# Update GitHub Pages # -####################### - -git config --global user.name "${GITHUB_ACTOR}" -git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" - -pushd "${docroot}" || exit 1 - -# don't bother maintaining history; just generate fresh -git init -git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" -git checkout -b gh-pages - -# add .nojekyll to the root so that github won't 404 on content added to dirs -# that start with an underscore (_), such as our "_content" dir.. -touch .nojekyll - -# add redirect from the docroot to our default docs language/version -cat >index.html < - - - hector_math Docs - - - -

Please wait while you're redirected to our master.

- - -EOF - -# Add README -cat >README.md <