# This workflow will install dependencies, lint code, check code security, and run tests for an array of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python CI Build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

    steps:
    - uses: actions/checkout@v4

    - name: Install uv
      uses: astral-sh/setup-uv@v4
      with:
        version: "latest"
        enable-cache: true
        cache-dependency-glob: "uv.lock"

    - name: Set up Python ${{ matrix.python-version }}
      run: uv python install ${{ matrix.python-version }}

    - name: Install dependencies
      run: uv sync --all-extras --dev

    - name: Lint code
      uses: astral-sh/ruff-action@v1
      with:
        args: "check ."

    - name: Check code security
      run: uv run bandit -c pyproject.toml -r .
        
    - name: Run tests
      run: uv run pytest tests
