name: "Test code"

env:
  COLUMNS: 120

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

jobs:
  pytest:
    name: "Pytest"
    strategy:
      matrix:
        python-version: ["3.11", "3.12"]
    runs-on: "ubuntu-latest"
    env:
      OS: "ubuntu-latest"
      PYTHON: "${{ matrix.python-version }}"
    steps:
      - name: "⤵️ Check out code from GitHub"
        uses: "actions/checkout@v4"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v4"
        with:
          python-version: "${{ matrix.python-version }}"
      - name: "⚙️ Install Poetry"
        uses: "abatilo/actions-poetry@v2.3.0"
        with:
          poetry-version: 1.5.1
      - name: "⚙️ Install dependencies"
        run: "poetry install"
      - name: "🚀 Run pytest with coverage"
        run: poetry run pytest --cov=APsystemsEZ1 tests/
