name: CI

on:
  push:
    branches: ["main"]
  pull_request:
    branches:
      - '*'

jobs:
  build-test:
    runs-on: ubuntu-24.04 # may use an older version to test
    strategy:
      matrix:
        openfoam-version: [2406, 2412, 2506]
      fail-fast: false
    name: Test with OpenFOAM ${{ matrix.openfoam-version }}
    steps:
      - uses: actions/checkout@v5
      - name: Set up OpenFOAM
        uses: gerlero/setup-openfoam@v1
        with:
          openfoam-version: ${{ matrix.openfoam-version }}
      - name: Install Python and dependencies
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install build dependencies
        run: |
          python -m pip install --upgrade pip
      - name: Build package
        run: |
          pip install .[dev]
      - name: Run tests
        run: |
          pytest