From 925acc6e451b03ba73844964ac6e4b46d089b2fd Mon Sep 17 00:00:00 2001
From: Dorian Turba <froggit.commit.z3jqj@simplelogin.com>
Date: Wed, 12 Jul 2023 12:10:06 +0200
Subject: [PATCH] template testing

---
 .gitlab-ci.yml                                | 11 +++++++++++
 CONTRIBUTING.md                               |  6 ++++++
 README.md                                     |  2 ++
 tests/pytest_project/pyproject.toml           | 19 +++++++++++++++++++
 .../src/test_project/__init__.py              |  3 +++
 tests/pytest_project/src/test_project/main.py | 11 +++++++++++
 .../pytest_project/src/test_project/py.typed  |  0
 tests/pytest_project/tests/test_main.py       |  8 ++++++++
 8 files changed, 60 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 CONTRIBUTING.md
 create mode 100644 tests/pytest_project/pyproject.toml
 create mode 100644 tests/pytest_project/src/test_project/__init__.py
 create mode 100644 tests/pytest_project/src/test_project/main.py
 create mode 100644 tests/pytest_project/src/test_project/py.typed
 create mode 100644 tests/pytest_project/tests/test_main.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..a2c7cc4
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,11 @@
+stages:
+  - test
+
+include:
+    - local: 'templates/python/testing/pytest/pytest.yml'
+
+pytest:
+    variables:
+        IMAGE_TAG: "latest"
+        PROJECT_PATH: "tests/test_project"
+        PYTHON_SETUP: "pip install ${PROJECT_PATH}[TESTS]"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..0878b5f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,6 @@
+# Contributing to r2devops_catalog
+
+## How to test templates locally
+
+Install `gitlab_runner`: https://docs.gitlab.com/runner/install/index.html
+
diff --git a/README.md b/README.md
index e69de29..5c57134 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,2 @@
+# CI templates for R2DevOps open source catalog
+This repository contains CI templates for R2DevOps open source catalog.
diff --git a/tests/pytest_project/pyproject.toml b/tests/pytest_project/pyproject.toml
new file mode 100644
index 0000000..69a3320
--- /dev/null
+++ b/tests/pytest_project/pyproject.toml
@@ -0,0 +1,19 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "test_project"
+version = "0.1.0"
+authors = [
+    { name = "Author Name", email = "author.name@example.com" },
+]
+description = "A description of what the package is for."
+
+[tool.pytest.ini_options]
+minversion = "6.0"
+addopts = "-rA -q --strict-markers"
+testpaths = [
+    "tests",
+    "integration",
+]
diff --git a/tests/pytest_project/src/test_project/__init__.py b/tests/pytest_project/src/test_project/__init__.py
new file mode 100644
index 0000000..673c4cf
--- /dev/null
+++ b/tests/pytest_project/src/test_project/__init__.py
@@ -0,0 +1,3 @@
+from test_project.main import main
+
+__all__ = ['main']
diff --git a/tests/pytest_project/src/test_project/main.py b/tests/pytest_project/src/test_project/main.py
new file mode 100644
index 0000000..28caf00
--- /dev/null
+++ b/tests/pytest_project/src/test_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()
diff --git a/tests/pytest_project/src/test_project/py.typed b/tests/pytest_project/src/test_project/py.typed
new file mode 100644
index 0000000..e69de29
diff --git a/tests/pytest_project/tests/test_main.py b/tests/pytest_project/tests/test_main.py
new file mode 100644
index 0000000..0c0a1de
--- /dev/null
+++ b/tests/pytest_project/tests/test_main.py
@@ -0,0 +1,8 @@
+"""Sample test module."""
+
+from test_project import main
+
+
+def test_main():
+    """Test main function."""
+    assert main()
-- 
GitLab