when:
  - event: push
    branch: main

matrix:
  PYTHON_VERSION:
    - 3.13.2
    - 3.12.9

steps:
  - name: lint
    image: pipelinecomponents/ruff
    commands:
      - ruff check .

  - name: test
    image: python:${PYTHON_VERSION}-slim
    environment:
      DJANGO_SETTINGS_MODULE: config.settings
      DEPLOYMENT: Test
      ENV_PATH: .env.ci
    commands:
      - python -m venv venv
      - . venv/bin/activate
      - python -m pip install --disable-pip-version-check --no-input --quiet -r requirements/test.txt
      - python -m pytest --cov --cov-report term

services:
  - name: database
    image: postgres:17-alpine
    environment:
      POSTGRES_PASSWORD: teilchensammler
      POSTGRES_DB: teilchensammler_test
      POSTGRES_INITDB_ARGS: --nosync --no-instructions