name: CI

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

env:
  PYTHON_VERSION: "3.11"

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

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

      - name: Install system deps
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y -qq libsndfile1

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install ruff

      - name: Lint with ruff
        run: |
          ruff check src/ tests/

      - name: Test with pytest
        run: |
          python -m pytest tests/ -v --tb=short -x
