diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..a2c7cc4c55a0f761c0a0542c456dd5f1275e3ddf --- /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 0000000000000000000000000000000000000000..0878b5fbe8c786855821260143aba2f2ce349fa2 --- /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 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5c5713499f1519569bd630ad9ba9e60d92af5bcc 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 0000000000000000000000000000000000000000..69a33200081eacfb75d3a7d51966ba4c046e60b5 --- /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 0000000000000000000000000000000000000000..673c4cf50eb7f6029e07e44501c8d60f1d631535 --- /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 0000000000000000000000000000000000000000..28caf00b6f3b52955a2bc069b315fe44940eabb8 --- /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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/pytest_project/tests/test_main.py b/tests/pytest_project/tests/test_main.py new file mode 100644 index 0000000000000000000000000000000000000000..0c0a1de27ba48328e022ec7c0e0387e39aa75c74 --- /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()