Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85710351
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/.gitignore b/.gitignore
index b31b8a1..880c314 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
\#*
.#*
*~
__pycache__
*.pyc
/venv
+.coverage
+coverage.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8ba7c2f..d29705a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,57 +1,65 @@
stages:
- unit-test
- build
default:
image: quay.io/podman/stable
.push:
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
.build:
stage: build
before_script:
- 'if [ -n "${CI_COMMIT_REF_SLUG}" ]; then sudo -u podman podman login -u "$REGISTRY_USER" --password-stdin "$REGISTRY" <<< "$REGISTRY_PASSWORD"; fi'
- IMAGE_PREFIX="$REGISTRY/infra/lilybuild"
- IMAGE_VER="${CI_COMMIT_REF_SLUG-none}"
build:master:
extends: .build
script:
- IMAGE="$IMAGE_PREFIX/buildbot-master:$IMAGE_VER"
- sudo -u podman ./build-master.sh -t "$IMAGE"
- *push
build:worker:
extends: .build
script:
- IMAGE="$IMAGE_PREFIX/buildbot-worker:$IMAGE_VER"
- sudo -u podman ./build-worker.sh -t "$IMAGE"
- *push
build:volume-helper:
extends: .build
script:
- IMAGE="$IMAGE_PREFIX/volume-helper:$IMAGE_VER"
- sudo -u podman ./build-volume-helper.sh -t "$IMAGE"
- *push
diff --git a/lilybuild/run-tests.sh b/lilybuild/run-tests.sh
index 061fc9f..4eb4f59 100755
--- 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/x-diff
Expires
Fri, Sep 18, 11:30 PM (7 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1768478
Default Alt Text
(3 KB)
Attached To
Mode
rB lilybuild
Attached
Detach File
Event Timeline
Log In to Comment