name: CI - MacOS/Linux via pip

on:
  push:
    paths-ignore:
      - .gitlab-ci.yml
      - .gitignore
      - '*.md'
      - CITATION.*
      - LICENSE
      - colcon.pkg
      - .pre-commit-config.yaml
      - CHANGELOG.md
      - development/*.md
  pull_request:
    paths-ignore:
      - .gitlab-ci.yml
      - .gitignore
      - '*.md'
      - CITATION.*
      - LICENSE
      - colcon.pkg
      - .pre-commit-config.yaml
      - CHANGELOG.md
      - development/*.md
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
    CTEST_OUTPUT_ON_FAILURE: 1
    CTEST_PARALLEL_LEVEL: 4

jobs:
  coal-pip:
    name: "CI on ${{ matrix.os }} / py ${{ matrix.python-version }} with pip"
    runs-on: "${{ matrix.os }}-latest"

    strategy:
      fail-fast: false
      matrix:
        os: ["ubuntu", "macos"]
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
        exclude:
          - os: "macos"
            python-version: "3.8"  # Not available on arm64
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'true'
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - run: python -m pip install -U pip
      - run: python -m pip install cmeel-assimp cmeel-octomap cmeel-qhull eigenpy[build]
      - run: echo "CMAKE_PREFIX_PATH=$(cmeel cmake)" >> $GITHUB_ENV
      - run: cmake -B build -S . -DCOAL_HAS_QHULL=ON
      - run: cmake --build build -j 4
      - run: cmake --build build -t test
