name: CMake-ROS on: push: branches: - jazzy-devel paths-ignore: &platform_only - '.github/workflows/android.yml' - '.github/workflows/ios.yml' - 'app/android/**' - 'app/ios/**' - 'docker/noble/android/**' pull_request: branches: - '**' paths-ignore: *platform_only workflow_dispatch: env: BUILD_TYPE: Release concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: build: name: ${{ matrix.ros_distribution }}${{ matrix.use_ros2_testing && '-testing' || '' }} runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.ros_distribution }}-${{ matrix.use_ros2_testing }} cancel-in-progress: true strategy: fail-fast: false matrix: ros_distribution: [ jazzy ] # Build against both main (what users install) and ros2-testing (closest to # what the buildfarm builds bloom releases against). use_ros2_testing: [ false, true ] include: - ros_distribution: 'jazzy' skip_keys: "" # When releasing to ROS2, the skip_keys should be empty, patch these deps in package.xml instead. container: image: osrf/ros:${{ matrix.ros_distribution }}-desktop-full steps: - uses: actions/checkout@v4 - name: Restore test data id: cache-testdata uses: actions/cache@v4 with: path: data/tests/*.db key: testdata-${{ hashFiles('data/tests/manifest.txt') }} - name: Fetch test data if: steps.cache-testdata.outputs.cache-hit != 'true' shell: bash run: | # The ROS images are slim; fetch_test_data.sh needs curl, and 7-Zip for # the assets that come as an archive. The package holding it is # p7zip-full up to Ubuntu 24.04 and 7zip on the newer ones. command -v curl >/dev/null || (apt-get update && apt-get install -y --no-install-recommends curl) command -v 7z >/dev/null || command -v 7zz >/dev/null || (apt-get update && \ (apt-get install -y --no-install-recommends p7zip-full || \ apt-get install -y --no-install-recommends 7zip)) bash scripts/fetch_test_data.sh # `${{ github.workspace }}` is expanded by the runner on the *host* # (/home/runner/work/...), but this job runs in a container where the runner # bind-mounts that directory somewhere else (/__w/...). Baking the host path # into RTABMAP_TEST_DATA_ROOT points every data-driven test at a directory # that does not exist in the container: the integration tests silently skip # and the ones that imread() committed fixtures abort outright. # # Resolve the path inside the container instead. A `run` step's cwd is the # checkout root -- the same assumption the relative `scripts/...` and # `data/tests/*.db` paths in the steps above already rely on -- so derive it # from $PWD rather than trusting a path computed outside the container. The # existence checks then turn that into a verified precondition: a wrong # mount point or a failed fetch fails here, with the path printed, instead # of degrading into skipped tests. - name: Resolve test data root in the container id: testdata shell: bash run: | root="$PWD/data" test -f "$root/samples/17.jpg" || { echo "::error::test data root $root is missing committed fixtures"; exit 1; } ls "$root"/tests/*.db >/dev/null || { echo "::error::no test databases in $root/tests"; exit 1; } echo "root=$root" >> "$GITHUB_OUTPUT" # The osrf/ros image ships ros2-apt-source (main), which conflicts with the # ros2-testing-apt-source package setup-ros tries to install. Remove it so # setup-ros can switch the image to the testing repo. - name: Remove ROS main apt source if: matrix.use_ros2_testing run: dpkg --purge ros2-apt-source - uses: ros-tooling/setup-ros@v0.7 with: required-ros-distributions: ${{ matrix.ros_distribution }} use-ros2-testing: ${{ matrix.use_ros2_testing }} # setup-ros doesn't upgrade on noble/resolute, so the packages preinstalled # in the image would stay at their main versions. Upgrade them to testing. - name: Upgrade ROS packages to testing if: matrix.use_ros2_testing run: apt-get update && apt-get dist-upgrade -y - uses: ros-tooling/action-ros-ci@v0.4 with: package-name: rtabmap target-ros2-distro: ${{ matrix.ros_distribution }} rosdep-skip-keys: "${{ matrix.skip_keys }}" coverage-result: false extra-cmake-args: -DTEST_DATA_ROOT=${{ steps.testdata.outputs.root }}