-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
86 lines (78 loc) · 2.02 KB
/
.gitlab-ci.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cache:
paths:
- .cache/pip
- .venv/
- .mypy_cache/
before_script:
- python3 --version ; python3 -m pip --version # For debugging
# - python3 -m pip install virtualenv
- if [ ! -d ".venv" ]; then python3 -m venv .venv; fi # only create a new venv if there is none
- source .venv/bin/activate
- pip install --upgrade pip
- pip install -r requirements.txt
stages:
- build
- test
- deploy
code-analysis:
stage: test
tags:
- shell-executor
allow_failure: true
script:
- pip install mypy mypy-gitlab-code-quality
- mypy src/epc/tofCam_lib src/epc/tofCam_gui --no-error-summary > mypy-out.txt
after_script:
- echo "Collecting mypy results:"
- cat mypy-out.txt
- mypy-gitlab-code-quality < mypy-out.txt > codequality.json
artifacts:
reports:
codequality: codequality.json
build-job:
stage: build
script:
# build number is added to the version number if it is not a tag
- if [ -z "$CI_COMMIT_TAG" ]; then echo "__version__ = '$(python setup.py --version)-${CI_PIPELINE_IID}'" > src/epc/_version.py; fi
- python -m build --sdist --wheel .
artifacts:
paths:
- dist/*
tags:
- shell-executor
test-job:
stage: test
script:
- pip install .
- pytest -m "not systemTest" --cov=src --cov-report term --cov-report xml:coverage.xml --junitxml=test_report.xml
coverage: '/TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
junit: test_report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
tags:
- shell-executor
test-tox:
stage: test
script:
- tox
tags:
- shell-executor
deploy-test-pypi-job:
stage: deploy
script:
- TWINE_PASSWORD=${CI_TEST_PYPI_TOCKEN} TWINE_USERNAME=__token__ twine upload --repository testpypi dist/*
only:
- master
tags:
- shell-executor
deploy-pypi-job:
stage: deploy
script:
- TWINE_PASSWORD=${CI_PYPI_TOCKEN} TWINE_USERNAME=__token__ twine upload dist/*
only:
- tags
tags:
- shell-executor