-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
236 lines (217 loc) · 4.03 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
236 lines (217 loc) · 4.03 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
stages:
- lint
- test
- security-bandit
- security-safety
- build
variables:
POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/poetry"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
cache:
paths:
- .cache/poetry
- .venv/
- .tox/
.lint-template: &lint-template
stage: lint
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry config cache-dir $POETRY_CACHE_DIR
- poetry install --with dev
script:
- poetry run tox -e flake8,pylint,ruff
artifacts:
reports:
junit: reports/
paths:
- .tox/
expire_in: 1 week
only:
- merge_requests
- main
- develop
.test-template: &test-template
stage: test
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry config cache-dir $POETRY_CACHE_DIR
- poetry install --with dev
script:
- poetry run pytest --cov=app --cov-report=xml --cov-report=html --cov-report=term-missing
artifacts:
reports:
junit: reports/
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- coverage.xml
- htmlcov/
- .tox/
expire_in: 1 week
only:
- merge_requests
- main
- develop
# Linux jobs
lint-linux:
<<: *lint-template
image: python:3.12-slim
tags:
- linux
- docker
test-linux-311:
<<: *test-template
image: python:3.11-slim
variables:
PYTHON_VERSION: "311"
tags:
- linux
- docker
test-linux-312:
<<: *test-template
image: python:3.12-slim
variables:
PYTHON_VERSION: "312"
tags:
- linux
- docker
test-linux-313:
<<: *test-template
image: python:3.13-slim
variables:
PYTHON_VERSION: "313"
tags:
- linux
- docker
# Windows jobs
lint-windows:
<<: *lint-template
tags:
- windows
- shell
test-windows-311:
<<: *test-template
tags:
- windows
- shell
variables:
PYTHON_VERSION: "311"
test-windows-312:
<<: *test-template
tags:
- windows
- shell
variables:
PYTHON_VERSION: "312"
test-windows-313:
<<: *test-template
tags:
- windows
- shell
variables:
PYTHON_VERSION: "313"
# macOS jobs
lint-macos:
<<: *lint-template
tags:
- macos
- shell
test-macos-311:
<<: *test-template
tags:
- macos
- shell
variables:
PYTHON_VERSION: "311"
test-macos-312:
<<: *test-template
tags:
- macos
- shell
variables:
PYTHON_VERSION: "312"
test-macos-313:
<<: *test-template
tags:
- macos
- shell
variables:
PYTHON_VERSION: "313"
# Security checks - Bandit
security-bandit:
stage: security-bandit
image: python:3.12-slim
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry config cache-dir $POETRY_CACHE_DIR
- poetry install --with dev
script:
- poetry run tox -e security-bandit
artifacts:
reports:
sast: gl-sast-report.json
paths:
- bandit-report.json
expire_in: 1 week
only:
- merge_requests
- main
- develop
tags:
- linux
- docker
# Security checks - Safety
security-safety:
stage: security-safety
image: python:3.12-slim
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry config cache-dir $POETRY_CACHE_DIR
- poetry install --with dev
script:
- poetry run tox -e security-safety
artifacts:
paths:
- safety-report.json
expire_in: 1 week
only:
- merge_requests
- main
- develop
tags:
- linux
- docker
# Build stage
build:
stage: build
image: python:3.12-slim
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry config cache-dir $POETRY_CACHE_DIR
- poetry install --with dev
script:
- poetry build
- poetry run twine check dist/*
artifacts:
paths:
- dist/
expire_in: 1 week
only:
- main
- develop
tags:
- linux
- docker
dependencies:
- lint-linux
- test-linux-311
- test-linux-312
- test-linux-313
- security-bandit
- security-safety