Verify optional ROS 2 overlay template #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: verify_template_ros2_overlay | |
| run-name: Verify optional ROS 2 overlay template | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "master" | |
| - "main" | |
| - "develop" | |
| tags: | |
| - "v*.*.*" | |
| paths: | |
| - CMakeLists.txt | |
| - cmake/** | |
| - src/** | |
| - ros2/** | |
| - build_ros2.sh | |
| - add_ros2_support.sh | |
| - generate_version.sh | |
| - tailor_template_cleanup.sh | |
| - doc/ros2_overlay.md | |
| - doc/template_usage.md | |
| - doc/bootstrap_prompts.md | |
| - README.md | |
| - AGENTS.md | |
| - CLAUDE.md | |
| - python/COLCON_IGNORE | |
| - lib/COLCON_IGNORE | |
| - examples/COLCON_IGNORE | |
| - tests/COLCON_IGNORE | |
| - tests/cmake/VerifyTemplateProjectRos2Overlay.cmake | |
| - tests/cmake/VerifyTemplateProjectNestedInstallHeaders.cmake | |
| - tests/cmake/VerifyTemplateProjectCudaSources.cmake | |
| - tests/template_test/testRos2OverlayStatic.py | |
| - tests/template_test/testWorkflowTemplates.py | |
| - .github/workflows/build_ros2_overlay.yml | |
| - .github/workflows/build_ros2_overlay.yml.tpl | |
| pull_request: | |
| branches: | |
| - "master" | |
| - "main" | |
| - "develop" | |
| - "dev*" | |
| paths: | |
| - CMakeLists.txt | |
| - cmake/** | |
| - src/** | |
| - ros2/** | |
| - build_ros2.sh | |
| - add_ros2_support.sh | |
| - generate_version.sh | |
| - tailor_template_cleanup.sh | |
| - doc/ros2_overlay.md | |
| - doc/template_usage.md | |
| - doc/bootstrap_prompts.md | |
| - README.md | |
| - AGENTS.md | |
| - CLAUDE.md | |
| - python/COLCON_IGNORE | |
| - lib/COLCON_IGNORE | |
| - examples/COLCON_IGNORE | |
| - tests/COLCON_IGNORE | |
| - tests/cmake/VerifyTemplateProjectRos2Overlay.cmake | |
| - tests/cmake/VerifyTemplateProjectNestedInstallHeaders.cmake | |
| - tests/cmake/VerifyTemplateProjectCudaSources.cmake | |
| - tests/template_test/testRos2OverlayStatic.py | |
| - tests/template_test/testWorkflowTemplates.py | |
| - .github/workflows/build_ros2_overlay.yml | |
| - .github/workflows/build_ros2_overlay.yml.tpl | |
| jobs: | |
| overlay-build: | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ros:jazzy | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trust checked-out Git worktree | |
| shell: bash | |
| run: | | |
| git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| git -C "${GITHUB_WORKSPACE}" rev-parse --is-inside-work-tree | |
| - name: Install ROS 2 overlay dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends build-essential cmake git libeigen3-dev python3-colcon-common-extensions python3-pytest python3-yaml ros-dev-tools | |
| - name: Synchronize ROS package metadata | |
| shell: bash | |
| run: | | |
| test -x ./generate_version.sh || { | |
| echo "::error::generate_version.sh is missing or not executable." | |
| exit 1 | |
| } | |
| grep -q -- "--sync-ros2" ./generate_version.sh || { | |
| echo "::error::generate_version.sh does not support --sync-ros2." | |
| exit 1 | |
| } | |
| grep -q -- "ROS2_PROJECT_METADATA_SYNC=1" ./generate_version.sh || { | |
| echo "::error::generate_version.sh predates full project metadata sync." | |
| exit 1 | |
| } | |
| ./generate_version.sh --sync-ros2 | |
| git diff --exit-code -- ros2/*/package.xml | |
| - name: Resolve ROS 2 package dependencies | |
| run: | | |
| rosdep update | |
| rosdep install --from-paths ros2 -i -r -y --rosdistro jazzy | |
| - name: Build and test ROS 2 overlay | |
| shell: bash | |
| run: ./build_ros2.sh --clean --no-version-sync | |
| - name: Verify installed core header layout | |
| shell: bash | |
| run: | | |
| core_cmake_name_="$(sed -nE 's/^[[:space:]]*set[[:space:]]*[(][[:space:]]*project_name[[:space:]]+"?([^" )]+)"?.*/\1/p' CMakeLists.txt | head -n1)" | |
| core_shim_cmake_="$(grep -l '_ros2_overlay_nested_version_file' ros2/*/CMakeLists.txt | head -n1 || true)" | |
| [[ -n "${core_cmake_name_}" ]] || { echo "Could not resolve the core CMake project name." >&2; exit 1; } | |
| [[ -n "${core_shim_cmake_}" ]] || { echo "Could not locate the ROS 2 core shim package." >&2; exit 1; } | |
| core_ros_package_="$(basename "$(dirname "${core_shim_cmake_}")")" | |
| test -f "ros2/install/${core_ros_package_}/include/${core_cmake_name_}/wrapped_impl/CWrapperPlaceholder.h" || { | |
| echo "Core header was not installed below the exported include root." >&2 | |
| exit 1 | |
| } | |
| test ! -e "ros2/install/${core_ros_package_}/wrapped_impl/CWrapperPlaceholder.h" || { | |
| echo "Core header leaked to the package install-prefix root." >&2 | |
| exit 1 | |
| } | |
| - name: Run static ROS 2 overlay checks | |
| shell: bash | |
| run: | | |
| python3 -m pytest -q \ | |
| tests/template_test/testRos2OverlayStatic.py \ | |
| tests/template_test/testWorkflowTemplates.py | |
| expected_version="$( | |
| sed -nE 's/^Project version core: ([0-9]+\.[0-9]+\.[0-9]+)$/\1/p' VERSION | |
| )" | |
| if [[ ! "${expected_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::VERSION did not contain a strict X.Y.Z Project version core." | |
| exit 1 | |
| fi | |
| cmake \ | |
| -DTEST_TEMPLATE_SOURCE_DIR="${PWD}" \ | |
| -DTEST_BINARY_ROOT="${RUNNER_TEMP}/ros2_overlay_static" \ | |
| -DEXPECTED_VERSION="${expected_version}" \ | |
| -P tests/cmake/VerifyTemplateProjectRos2Overlay.cmake | |
| rollout-rehearsal: | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ros:jazzy | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trust checked-out Git worktree | |
| shell: bash | |
| run: | | |
| git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| git -C "${GITHUB_WORKSPACE}" rev-parse --is-inside-work-tree | |
| - name: Install ROS 2 overlay dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends build-essential cmake git libeigen3-dev python3-colcon-common-extensions python3-pytest python3-yaml ros-dev-tools | |
| - name: Synchronize ROS package metadata | |
| shell: bash | |
| run: | | |
| test -x ./generate_version.sh || { | |
| echo "::error::generate_version.sh is missing or not executable." | |
| exit 1 | |
| } | |
| grep -q -- "--sync-ros2" ./generate_version.sh || { | |
| echo "::error::generate_version.sh does not support --sync-ros2." | |
| exit 1 | |
| } | |
| grep -q -- "ROS2_PROJECT_METADATA_SYNC=1" ./generate_version.sh || { | |
| echo "::error::generate_version.sh predates full project metadata sync." | |
| exit 1 | |
| } | |
| ./generate_version.sh --sync-ros2 | |
| git diff --exit-code -- ros2/*/package.xml | |
| - name: Resolve ROS 2 package dependencies | |
| run: | | |
| rosdep update | |
| rosdep install --from-paths ros2 -i -r -y --rosdistro jazzy | |
| - name: Rehearse default-tailored overlay | |
| shell: bash | |
| run: | | |
| set -Eeuo pipefail | |
| scratch_dir="$(mktemp -d)" | |
| target_dir="${scratch_dir}/target" | |
| git clone --no-local "${GITHUB_WORKSPACE}" "${target_dir}" | |
| git -C "${target_dir}" checkout --detach "${GITHUB_SHA}" | |
| (cd "${target_dir}" && ./tailor_template_cleanup.sh --apply --yes) | |
| test -f "${target_dir}/.github/workflows/build_ros2_overlay.yml" | |
| test ! -e "${target_dir}/.github/workflows/build_ros2_overlay.yml.tpl" | |
| ! grep -q "VerifyTemplateProject" "${target_dir}/.github/workflows/build_ros2_overlay.yml" | |
| (cd "${target_dir}" && ./build_ros2.sh --clean --no-version-sync) | |
| - name: Rehearse additive rollout | |
| shell: bash | |
| run: | | |
| set -Eeuo pipefail | |
| scratch_dir="$(mktemp -d)" | |
| target_dir="${scratch_dir}/target" | |
| git clone --no-local "${GITHUB_WORKSPACE}" "${target_dir}" | |
| git -C "${target_dir}" checkout --detach "${GITHUB_SHA}" | |
| (cd "${target_dir}" && ./tailor_template_cleanup.sh --apply --yes --remove-ros2) | |
| ./add_ros2_support.sh --root "${target_dir}" --apply --yes --verify | |
| (cd "${target_dir}" && ./build_ros2.sh --clean --no-version-sync) | |
| (cd "${target_dir}" && cmake -S . -B build_plain -DENABLE_TESTS=OFF && cmake --build build_plain -j2) |