name: CMake-ROS

on:
  push:
    branches: 
      - master
  pull_request:
    branches: 
      - '**'

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: Release

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  build:
    # The CMake configure and build commands are platform agnostic and should work equally
    # well on Windows or Mac.  You can convert this to a matrix build if you need
    # cross-platform coverage.
    # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
    name: ${{ matrix.ros_distribution }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ros_distribution: [ humble, jazzy, kilted, lyrical, rolling]
        include:
        - ros_distribution: 'humble'
          skip_keys: ""
        - ros_distribution: 'jazzy'
          skip_keys: ""
        - ros_distribution: 'kilted'
          skip_keys: ""
        - ros_distribution: 'lyrical'
          skip_keys: "libpointmatcher"
        - ros_distribution: 'rolling'
          skip_keys: ""
    container:
      image: osrf/ros:${{ matrix.ros_distribution }}-desktop-full
    steps:   
    - uses: actions/checkout@v4
    - uses: ros-tooling/setup-ros@v0.7
      with:
        required-ros-distributions: ${{ matrix.ros_distribution }}
    - uses: ros-tooling/action-ros-ci@v0.4
      with:
        package-name: rtabmap
        target-ros2-distro: ${{ matrix.ros_distribution }}
        rosdep-skip-keys: "${{ matrix.skip_keys }}"
      
