Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F8199689
D243.1760328085.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D243.1760328085.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
__pycache__
*.pyc
/venv
+.coverage
+coverage.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,21 +10,29 @@
script: &push
- if [ -n "${CI_COMMIT_REF_SLUG}" ]; then sudo -u podman podman push "$IMAGE"; fi
-unit-test-master:
+.unit-test:
stage: unit-test
+ artifacts:
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: coverage.xml
+
+unit-test-master:
+ extends: ['.unit-test']
image: docker.io/buildbot/buildbot-master:v4.2.1
script:
- - /buildbot_venv/bin/pip3 install jsonschema backports.tarfile
+ - /buildbot_venv/bin/pip3 install jsonschema backports.tarfile coverage
- . /buildbot_venv/bin/activate
- ./lilybuild/run-tests.sh master
unit-test-worker:
- stage: unit-test
+ extends: ['.unit-test']
image: alpine
script:
- apk add --no-cache python3 py3-virtualenv
- virtualenv --python=python3 /buildbot_venv
- - /buildbot_venv/bin/pip3 install 'twisted[tls]' jsonschema backports.tarfile pycobertura
+ - /buildbot_venv/bin/pip3 install 'twisted[tls]' jsonschema backports.tarfile pycobertura coverage
- . /buildbot_venv/bin/activate
- ./lilybuild/run-tests.sh worker
diff --git a/lilybuild/run-tests.sh b/lilybuild/run-tests.sh
--- a/lilybuild/run-tests.sh
+++ b/lilybuild/run-tests.sh
@@ -1,13 +1,22 @@
#!/bin/sh
d="$(dirname "$(realpath "$0")")"
+ret=0
+exclude_arg="--omit=lilybuild/lilybuild/tests/**/*"
if [ "$1" = "master" ]; then
- python -m unittest discover -s "$d"/lilybuild/tests -p '*_test.py' -t "$d"
+ python -m coverage run -m unittest discover -s "$d"/lilybuild/tests -p '*_test.py' -t "$d"
+ ret="$?"
elif [ "$1" = "worker" ]; then
- python -m unittest discover -s "$d"/lilybuild/tests -p '*_test_worker.py' -t "$d"
+ python -m coverage run -m unittest discover -s "$d"/lilybuild/tests -p '*_test_worker.py' -t "$d"
+ ret="$?"
else
echo 'Specify tests to run'
echo "$0 [master|worker]"
exit 1
fi
+
+python -m coverage report "$exclude_arg"
+python -m coverage xml "$exclude_arg"
+
+exit "$ret"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 12, 9:01 PM (19 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
512263
Default Alt Text
D243.1760328085.diff (2 KB)
Attached To
Mode
D243: Add coverage in jobs
Attached
Detach File
Event Timeline
Log In to Comment