-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
116 lines (97 loc) · 2.33 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Global --------------------------
variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
cache:
key: "${CI_JOB_NAME}"
paths:
- .cache/pip
- .venv
stages:
- quality
- tests
- publish
# Jobs templates ------------------
.install-deps-template: &install-deps
before_script:
- pip install poetry
- poetry --version
- poetry config virtualenvs.in-project true
- poetry config http-basic.simulation gitlab-ci-token "${CI_JOB_TOKEN}"
- poetry install -v
.quality-template: &quality
<<: *install-deps
image: python:3.8
stage: quality
.test-template: &test
<<: *install-deps
stage: tests
script: make test-junit
coverage: '/TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d{1,2}\%)/'
artifacts:
reports:
cobertura: coverage.xml
junit: report.xml
when: always
expire_in: 1 week
only:
- master
- merge_requests
- tags
# Quality jobs ----------------------
check-black:
<<: *quality
script: make check-black
check-flake8:
<<: *quality
script: make check-flake8
check-isort:
<<: *quality
script: make check-isort
check-mypy:
<<: *quality
script: make check-mypy
check-safety:
<<: *quality
script: make check-safety
# Tests jobs ------------------------
python3.8:
<<: *test
image: python:3.8
python3.10:
<<: *test
image: python:3.10
# Publish jobs ----------------------
gitlab-package:
image: python:3.8
stage: publish
before_script:
- pip install poetry
- poetry --version
- poetry config virtualenvs.in-project true
- poetry config http-basic.simulation gitlab-ci-token "${CI_JOB_TOKEN}"
- poetry install -v
- poetry build
# need to use inline username and password since config would use an extra file for basic auth credentials
script:
- poetry config repositories.gitlab "https://git-service.ait.ac.at/api/v4/projects/${CI_PROJECT_ID}/packages/pypi"
- poetry publish -r gitlab -u gitlab-ci-token -p "${CI_JOB_TOKEN}"
only:
- tags
pages:
<<: *install-deps
image: python:3.8
stage: publish
script:
- make docs
- mv site public
# make extra copy of docs for viewing offline (without a server)
- make docs-offline
- mv site offline-docs
- tar -zcf offline-docs.tar.gz offline-docs
artifacts:
paths:
- public
- offline-docs.tar.gz
expire_in: 1 week
only:
- master