name: Tests

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

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install -r requirements.txt
        python -m pip install .
    - name: Set up SSH
      run: |
        ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""
        cp ~/.ssh/id_ed25519.pub ~/.ssh/authorized_keys
        chmod og-rw ~
        ssh -o StrictHostKeyChecking=no localhost id
        mkdir -p ~/.ssh/controlmasters
        echo -e "Host localhost\n  ControlPath ~/.ssh/controlmasters/%C\n  ControlPersist 1h\n  ControlMaster auto" > ~/.ssh/config
    - name: Test with pytest
      run: |
        pytest tests
