diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d820ac14f5e6a81635918dde7a122859f2e69441..8ccae3df742fb19f1a12170c6fea13ef1b86a678 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,6 @@ flake8: stage: templates variables: PROJECT_PATH: "tests/flake8_project" - PYTHON_SETUP: "pip install ${PROJECT_PATH} flake8" only: changes: - .gitlab-ci.yml diff --git a/templates/python/code_quality/flake8/flake8.yml b/templates/python/code_quality/flake8/flake8.yml index 787121ddec4a366dfd3d6c6502d11d701130caf1..90633de55d4a529001f493193e57ead8e57a692e 100644 --- a/templates/python/code_quality/flake8/flake8.yml +++ b/templates/python/code_quality/flake8/flake8.yml @@ -5,14 +5,13 @@ include: - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/python_install@0.1.0.yaml' flake8: - image: python:${IMAGE_TAG} + extend: python_install stage: code_quality variables: - IMAGE_TAG: "latest" PROJECT_PATH: "." PYTHON_SETUP: "pip install ${PROJECT_PATH}[CODE_QUALITY]" script: - *python_install + python_install - flake8 ${PROJECT_PATH} -v only: changes: diff --git a/templates/python/partial/python_install.yml b/templates/python/partial/python_install.yml index 1c71a09544859c89c6eadd29af00f74f0575397d..b3315a74cc9cb5a9b447808d3504705bc301a918 100644 --- a/templates/python/partial/python_install.yml +++ b/templates/python/partial/python_install.yml @@ -1,5 +1,11 @@ -.python_install: &python_install - - python --version # Debug - - python -m venv venv --upgrade-deps || python -m venv venv # upgrade-deps is not supported before 3.9 - - source venv/bin/activate - - ${PYTHON_SETUP} +.python_install: + image: python:${IMAGE_TAG} + variables: + IMAGE_TAG: "latest" + PROJECT_PATH: "." + PYTHON_SETUP: "pip install -r ${PROJECT_PATH}/requirements.txt" + script: + - python --version # Debug + - python -m venv venv --upgrade-deps || python -m venv venv # upgrade-deps is not supported before 3.9 + - source venv/bin/activate + - ${PYTHON_SETUP} diff --git a/tests/black_project/pyproject.toml b/tests/black_project/pyproject.toml index beec19a046b7baad20feebc9629b45159b6782ea..6e944a18cbf9702e9e228bfc6f1884c398a0b360 100644 --- a/tests/black_project/pyproject.toml +++ b/tests/black_project/pyproject.toml @@ -9,3 +9,8 @@ authors = [ { name = "Author Name", email = "author.name@example.com" }, ] description = "A description of what the package is for." + +[project.optional-dependencies] +CODE_QUALITY = [ + "flake8", +]