Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ---------------------------
# Testing workflow
# ---------------------------
# test template used in other jobs
# see python.yml for example
.test:
extends:
# https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:pytest
- .python:pytest
stage: Testing
variables:
# target for coverage
COVERAGE_TARGET: "dqsegdb"
# don't need the git repo
GIT_STRATEGY: none
# configure pytest
PYTEST_OPTIONS: "-ra -v --pyargs dqsegdb.tests"
# use python3
PYTHON: "python3"
script:
# run the tests
- !reference [".python:pytest", script]
# run --help on each one (with coverage)
- PREFIX=$(${PYTHON} -c "import sys; print(sys.prefix)")
- for entrypoint in $(ls ${PREFIX}/bin/*dqsegdb);
do
echo -e "\x1B[92m$ ${entrypoint} --help...\x1B[0m";
${PYTHON} -m coverage run
--append
--source=dqsegdb
${entrypoint} --help
; done
# upload coverage file as an artifact to be combined later
artifacts:
when: always
paths:
- .coverage-*
# disable coverage total for test jobs, this is reported
# by the coverage job
coverage: null