name: CI

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

jobs:
  lint-and-test:
    runs-on: ubuntu-latest
    # Skip CI for version bump commits since publish workflow will run tests
    if: ${{ !contains(github.event.head_commit.message, 'Bump version') }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install ruff pytest
      - name: Install package
        run: pip install -e .
      - name: Run ruff
        run: ruff check .
      - name: Run pytest
        run: pytest tests/
