name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    env:
      FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
    strategy:
      matrix:
        python-version: ["3.10", "3.11", "3.12", "3.13"]

    steps:
      - uses: actions/checkout@v4

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

      - name: Install dependencies
        run: pip install -e ".[dev]" bandit

      - name: SAST Security Scan
        run: bandit -r src/openetruscan/

      - name: Lint with Ruff
        run: ruff check .

      - name: Run tests
        run: pytest tests/ -v --tb=short

      - name: Run tests with coverage
        if: matrix.python-version == '3.12'
        run: pytest tests/ --cov=openetruscan --cov-report=term-missing
