From 3ff604e41cac07441b9df70876b726256c06b6ff Mon Sep 17 00:00:00 2001
From: Dorian Turba <froggit.commit.z3jqj@simplelogin.com>
Date: Wed, 19 Jul 2023 10:14:18 +0200
Subject: [PATCH] test flake8 extends

---
 .gitlab-ci.yml                                 | 13 +++++++++++++
 .../python/code_quality/flake8/flake8_2.yml    | 18 ++++++++++++++++++
 templates/python/partial/python_install_2.yml  | 11 +++++++++++
 3 files changed, 42 insertions(+)
 create mode 100644 templates/python/code_quality/flake8/flake8_2.yml
 create mode 100644 templates/python/partial/python_install_2.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 59c495f..bb7d28f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ stages:
 include:
     - local: 'templates/python/testing/pytest/pytest.yml'
     - local: 'templates/python/code_quality/flake8/flake8.yml'
+    - local: 'templates/python/code_quality/flake8/flake8_2.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'
@@ -30,6 +31,18 @@ flake8:
             - templates/python/code_quality/flake8/**/*
             - tests/flake8_project/**/*
 
+
+flake8_2:
+    stage: templates
+    variables:
+        PROJECT_PATH: "tests/flake8_project"
+    only:
+        changes:
+            - .gitlab-ci.yml
+            - pyproject.toml
+            - templates/python/code_quality/flake8/**/*
+            - tests/flake8_project/**/*
+
 #flake8-plugin:
 #    stage: templates
 #    variables:
diff --git a/templates/python/code_quality/flake8/flake8_2.yml b/templates/python/code_quality/flake8/flake8_2.yml
new file mode 100644
index 0000000..9e41fea
--- /dev/null
+++ b/templates/python/code_quality/flake8/flake8_2.yml
@@ -0,0 +1,18 @@
+include:
+  - local: 'templates/python/partial/python_install_2.yml'
+
+flake8_2:
+    extends:
+        - .python_install
+    stage: code_quality
+    variables:
+        PYTHON_SETUP: "pip install flake8"
+    script:
+        - !reference [.python_install, script]
+        - flake8 ${PROJECT_PATH} -v
+    only:
+        changes:
+            - ${PROJECT_PATH}/**/*.py
+            - .gitlab-ci.yml
+            - ${PROJECT_PATH}/pyproject.toml
+            - ${PROJECT_PATH}/.flake8
diff --git a/templates/python/partial/python_install_2.yml b/templates/python/partial/python_install_2.yml
new file mode 100644
index 0000000..b3315a7
--- /dev/null
+++ b/templates/python/partial/python_install_2.yml
@@ -0,0 +1,11 @@
+.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}
-- 
GitLab