-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
80 lines (76 loc) · 2.25 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
stages:
- pre-analysis
- test
- package
- deploy
python:quality:
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
junit: mypy.xml
expire_in: 10 days
cache: &python-cache
key: ${CI_COMMIT_REF_SLUG}
paths:
- ".venv"
coverage: '/line-rate="0.([0-9]{1,2})\d*"/'
image: gitlab.lrz.de:5005/i4/software/docker-images/python3.9-poetry
needs: [ ]
rules: &python-rules
- changes:
- "tum_exam_scripts/**.py"
- .gitlab-ci.yml
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_COMMIT_BRANCH == "development"'
- if: '$CI_COMMIT_TAG'
script:
- poetry install
- poetry run mypy --cobertura-xml-report=. --junit-xml=mypy.xml --pretty tum_exam_scripts
- head -n 1 cobertura.xml
stage: pre-analysis
python:test:
artifacts:
when: always
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
cache: *python-cache
image: gitlab.lrz.de:5005/i4/software/docker-images/python3.9-poetry:0.1.1
needs:
- python:quality
rules: *python-rules
script:
- poetry install
- poetry run coverage run -m pytest --junitxml=report.xml tests/
- poetry run coverage report
- poetry run coverage xml
stage: test
python:package:
artifacts:
paths:
- dist
expire_in: 3 days
cache: *python-cache
image: gitlab.lrz.de:5005/i4/software/docker-images/python3.9-poetry:0.1.1
needs:
- python:test
rules: *python-rules
script:
- poetry install --no-dev
- poetry build
stage: package
python:deploy:
cache: *python-cache
image: gitlab.lrz.de:5005/i4/software/docker-images/python3.9-poetry
rules:
- if: '$CI_COMMIT_TAG'
script:
- poetry config repositories.lrz https://gitlab.lrz.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi
- poetry publish --repository lrz --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD
stage: deploy
needs:
- python:package