name: Build and test Python MapScript

on:
  push:
    branches:
      - '*'
    except:
      - /^(cherry-pick-)?backport-\d+-to-/

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
    env:
      MAPSCRIPT_PYTHON_ONLY: 'true'

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: ./ci/ubuntu/setup.sh

      - name: Build
        run: ./ci/ubuntu/build.sh
