when:
  - event: push
    branch: main

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

  - name: test
    image: python:3.13-slim
    environment:
      DJANGO_SETTINGS_MODULE: config.settings
      DEPLOYMENT: Test
      ENV_PATH: .env.ci
    commands:
      - python -m venv venv
      - . venv/bin/activate
      - echo VENV is $VIRTUAL_ENV
      - python -m pip install --root-user-action=ignore --disable-pip-version-check --no-input --quiet -r requirements/test.txt
      - python -m pytest

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