diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9451895dbcef2646dfb15ded64e881b7a06a27d7..c77ac8aff5b73cc63d0adc58d618e0d3d263fb61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ stages: - templates include: + - local: 'templates/python/python_install.yml' - local: 'templates/python/testing/pytest/pytest.yml' - local: 'templates/python/code_quality/flake8/flake8.yml' - local: 'templates/python/code_quality/black/black.yml' @@ -9,8 +10,21 @@ include: - local: 'templates/python/code_quality/mypy/mypy.yml' - local: 'templates/python/code_quality/ruff/ruff.yml' +python_install: + stage: templates + variables: + PROJECT_PATH: "tests/python_install_project" + PYTHON_SETUP: "pip install ${PROJECT_PATH}" + only: + changes: + - .gitlab-ci.yml + - pyproject.toml + - templates/python/partial/python_install/**/* + - tests/python_install_project/**/* + pytest: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/pytest_project" PYTHON_SETUP: "pip install ${PROJECT_PATH}[TESTS]" @@ -23,6 +37,7 @@ pytest: flake8: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/flake8_project" only: @@ -34,6 +49,7 @@ flake8: black: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/black_project" only: @@ -46,6 +62,7 @@ black: isort: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/isort_project" only: @@ -57,6 +74,7 @@ isort: mypy: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/mypy_project" only: @@ -68,6 +86,7 @@ mypy: ruff: stage: templates + needs: ["python_install"] variables: PROJECT_PATH: "tests/ruff_project" only: diff --git a/r2_metadata/python_install.r2.yml b/r2_metadata/python_install.r2.yml index 34664030adfda9b60271e09b32d934e770e40ab5..da70b1697533404d77fe8697351c6d1558c7f155 100644 --- a/r2_metadata/python_install.r2.yml +++ b/r2_metadata/python_install.r2.yml @@ -1,6 +1,6 @@ files: - template: ../templates/python/partial/python_install.yml - documentation: ../templates/python/partial/README.md + template: ../templates/python/partial/python_install/python_install.yml + documentation: ../templates/python/partial/python_install/README.md data: description: "Job that is meant to be extend by jobs that need a python environment." icon: ðŸ diff --git a/templates/python/partial/README.md b/templates/python/partial/python_install/README.md similarity index 100% rename from templates/python/partial/README.md rename to templates/python/partial/python_install/README.md diff --git a/templates/python/partial/python_install.yml b/templates/python/partial/python_install/python_install.yml similarity index 100% rename from templates/python/partial/python_install.yml rename to templates/python/partial/python_install/python_install.yml diff --git a/tests/python_install_project/pyproject.toml b/tests/python_install_project/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..5a1a5ebd45766c243ac6c005fb1ef1ef82873801 --- /dev/null +++ b/tests/python_install_project/pyproject.toml @@ -0,0 +1,11 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "python_install_project" +version = "0.1.0" +authors = [ + { name = "Author Name", email = "author.name@example.com" }, +] +description = "A description of what the package is for." diff --git a/tests/python_install_project/src/python_install_project/__init__.py b/tests/python_install_project/src/python_install_project/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d4cc63e287d1f9b8e3f12a55c9a24e34eb3241c3 --- /dev/null +++ b/tests/python_install_project/src/python_install_project/__init__.py @@ -0,0 +1,3 @@ +from pytest_project.main import main + +__all__ = ['main'] diff --git a/tests/python_install_project/src/python_install_project/main.py b/tests/python_install_project/src/python_install_project/main.py new file mode 100644 index 0000000000000000000000000000000000000000..28caf00b6f3b52955a2bc069b315fe44940eabb8 --- /dev/null +++ b/tests/python_install_project/src/python_install_project/main.py @@ -0,0 +1,11 @@ +"""Sample main module.""" + + +def main() -> bool: + """Sample main function.""" + print("Hello, world!") + return True + + +if __name__ == '__main__': + main()