From 12b509d8f497a51b95f29e788c18d4022ab5e7bf Mon Sep 17 00:00:00 2001
From: Tsegelnik Nikita <tsegelnik@jinr.ru>
Date: Mon, 20 Mar 2023 17:59:22 +0300
Subject: [PATCH] adding CI script with tests

---
 .gitlab-ci.yml                                | 23 +++++++++++++++++++
 pytest.ini                                    |  4 ++++
 .../{dayabay_v0.py => test_dayabay_v0.py}     |  0
 3 files changed, 27 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100755 pytest.ini
 rename tests/models/{dayabay_v0.py => test_dayabay_v0.py} (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..1200204
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,23 @@
+stages:
+    - tests
+
+tests:
+    image: git.jinr.ru:5005/gna/gna-base-docker-image:latest
+    stage: tests
+
+    script:
+    - python3 -m pip install -r dagflow/requirements.txt
+    - coverage run --source=. -m pytest
+    - coverage report
+    - coverage xml
+    coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
+    artifacts:
+        paths:
+            - tests
+        reports:
+            coverage_report:
+                coverage_format: cobertura
+                path: coverage.xml
+    only:
+        - master
+        - merge_requests
diff --git a/pytest.ini b/pytest.ini
new file mode 100755
index 0000000..70e258f
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,4 @@
+[pytest]
+testpaths=tests
+; uncomment below to include coverage into default pytest run
+; addopts= --cov-report term --cov=./ --cov-report xml:cov.xml
diff --git a/tests/models/dayabay_v0.py b/tests/models/test_dayabay_v0.py
similarity index 100%
rename from tests/models/dayabay_v0.py
rename to tests/models/test_dayabay_v0.py
-- 
GitLab