name: CI - Linux - ROS

on:
  push:
    branches:
      - devel
      - master
  pull_request:
    branches:
      - devel
      - master

jobs:
  CI:
    strategy:
      matrix:
        env:
          - {ROS_DISTRO: humble}
          - {ROS_DISTRO: jazzy}
          - {ROS_DISTRO: kilted}
          - {ROS_DISTRO: rolling}
    env:
      CCACHE_DIR: /github/home/.ccache # Enable ccache
      UPSTREAM_WORKSPACE: dependencies.rosinstall
      CMAKE_ARGS: -DBUILD_WITH_OSQP=ON -DBUILD_WITH_PROXQP=ON -DBUILD_WITH_VECTORIZATION_SUPPORT=OFF  # Simde is not available yet
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          submodules: recursive
      # This step will fetch/store the directory used by ccache before/after the ci run
      - uses: actions/cache@v5
        with:
          path: ${{ env.CCACHE_DIR }}
          key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
      # Run industrial_ci
      - uses: 'ros-industrial/industrial_ci@0f4bd2d1b926eac95fd6bc5bd1fcb3051a6e927d'
        env: ${{ matrix.env }}
