on:
  push:
    branches: "**"

jobs:
  pylint:
    runs-on: docker
    container: forgejo.neshweb.net/ci-docker-images/python-neshweb:3.11
    steps:
      - name: Checkout source code
        uses: actions/checkout@v4
      - name: Install packages
        run: |
          pip install -e .[lint] --disable-pip-version-check --no-cache-dir -q
          python -m pip list --format=columns --disable-pip-version-check
      - name: Run pylint
        run: |
          pylint --version
          pylint **/*.py --exit-zero --rc-file pyproject.toml

  mypy:
    runs-on: docker
    container: forgejo.neshweb.net/ci-docker-images/python-neshweb:3.11
    steps:
      - name: Checkout source code
        uses: actions/checkout@v4
      - name: Install packages
        run: |
          pip install -e .[typing] --disable-pip-version-check --no-cache-dir -q
          python -m pip list --format=columns --disable-pip-version-check
      - name: Run mypy
        run: |
          mypy --version
          mypy .

  tests:
    runs-on: docker
    strategy:
      matrix:
        container: [ "3.10", "3.11", "3.12", "3.13" ]
    container: forgejo.neshweb.net/ci-docker-images/python-neshweb:${{ matrix.container }}
    steps:
      - name: Checkout source code
        uses: actions/checkout@v4
      - name: Install packages
        run: |
          python --version
          python -m venv .venv
          source .venv/bin/activate
          echo $VIRTUAL_ENV
          pip install -e .[testing] --disable-pip-version-check --no-cache-dir -q
          python -m pip list --format=columns --disable-pip-version-check
      - name: Run pytest
        run: |
          source .venv/bin/activate
          python -m pytest