stages:
    - templates

include:
    - local: 'templates/python/testing/pytest/pytest.yml'
    - local: 'templates/python/code_quality/flake8/flake8.yml'
    - local: 'templates/python/code_quality/black/black.yml'
    - local: 'templates/python/code_quality/isort/isort.yml'
    - local: 'templates/python/code_quality/mypy/mypy.yml'
    - local: 'templates/python/code_quality/ruff/ruff.yml'

pytest:
    stage: templates
    variables:
        PROJECT_PATH: "tests/pytest_project"
        PYTHON_SETUP: "pip install ${PROJECT_PATH}[TESTS]"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/testing/pytest/**/*
            - tests/pytest_project/**/*

tests:
    extends: $PROJECT
    stage: templates
    variables:
        PROJECT_PATH: "tests/$PROJECT_project"
    parallel:
        matrix:
          - PROJECT: [flake8, black, isort, mypy, ruff]
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/$PROJECT/**/*
            - tests/$PROJECT_project/**/*

flake8:
    stage: templates
    variables:
        PROJECT_PATH: "tests/flake8_project"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/flake8/**/*
            - tests/flake8_project/**/*

black:
    stage: templates
    variables:
        PROJECT_PATH: "tests/black_project"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/black/**/*
            - tests/black_project/**/*


isort:
    stage: templates
    variables:
        PROJECT_PATH: "tests/isort_project"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/isort/**/*
            - tests/isort_project/**/*

mypy:
    stage: templates
    variables:
        PROJECT_PATH: "tests/mypy_project"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/mypy/**/*
            - tests/mypy_project/**/*

ruff:
    stage: templates
    variables:
        PROJECT_PATH: "tests/ruff_project"
    only:
        changes:
            - .gitlab-ci.yml
            - pyproject.toml
            - templates/python/code_quality/ruff/**/*
            - tests/ruff_project/**/*
