name: tests

on: [pull_request, workflow_dispatch]

jobs:
  build-test:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: |
          set -ex
          curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - --yes
          $HOME/.poetry/bin/poetry install

      - name: Test with pytest
        run: |
          set -ex
          $HOME/.poetry/bin/poetry run pytest
