-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
239 lines (231 loc) · 6.08 KB
/
.gitlab-ci.yml
File metadata and controls
239 lines (231 loc) · 6.08 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
237
238
239
---
stages:
- lint
- test
- release
- deploy
lint:score:
stage: lint
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
DJANGO_SETTINGS_MODULE: moo.settings.test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- mkdir -p public/badges public/lint
- echo undefined > public/badges/lint.score
script:
- uv sync
- uv run pylint --fail-under=8 --output-format=text moo | tee /tmp/pylint.txt
- sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/lint.score
after_script:
- uv run anybadge --overwrite --label lint --value=$(cat public/badges/lint.score) --file=public/badges/lint.svg 4=red 6=orange 8=yellow 10=green
- |
echo "Your score is: $(cat public/badges/lint.score)"
artifacts:
paths:
- public
when: always
cache:
paths:
- .cache/uv
lint:codeclimate:
stage: lint
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
DJANGO_SETTINGS_MODULE: moo.settings.test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- uv sync
- uv run pylint --fail-under=8 --output-format=pylint_gitlab.GitlabCodeClimateReporter moo > codeclimate.json
artifacts:
reports:
codequality: codeclimate.json
when: always
cache:
paths:
- .cache/uv
lint:html:
stage: lint
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
DJANGO_SETTINGS_MODULE: moo.settings.test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- mkdir -p public/lint
script:
- uv sync
- uv run pylint --fail-under=8 --output-format=pylint_gitlab.GitlabPagesHtmlReporter moo > public/lint/index.html
artifacts:
paths:
- public
when: always
cache:
paths:
- .cache/uv
test:core:
stage: test
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
PYTHONUNBUFFERED: 1
COVERAGE_FILE: .coverage.core
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- uv sync
- uv run pytest -n auto moo/core/tests/ moo/shell/tests/ --junitxml=junit-core.xml --cov moo --cov-report term
artifacts:
when: always
reports:
junit: junit-core.xml
paths:
- .coverage.core
- junit-core.xml
cache:
paths:
- .cache/uv
test:verbs:
stage: test
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
PYTHONUNBUFFERED: 1
COVERAGE_FILE: .coverage.verbs
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- uv sync
- uv run pytest -n auto moo/bootstrap/default_verbs/tests/ --junitxml=junit-verbs.xml --cov moo --cov-report term
artifacts:
when: always
reports:
junit: junit-verbs.xml
paths:
- .coverage.verbs
- junit-verbs.xml
cache:
paths:
- .cache/uv
test:coverage:
stage: test
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
UV_CACHE_DIR: .cache/uv
PYTHONUNBUFFERED: 1
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- moo/**/*.py
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs:
- job: test:core
artifacts: true
- job: test:verbs
artifacts: true
script:
- uv sync
- uv run coverage combine .coverage.core .coverage.verbs
- uv run coverage report
- uv run coverage xml
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- coverage.xml
cache:
paths:
- .cache/uv
release:
stage: release
tags:
- shacklyn
image: registry.gitlab.com/bubblehouse/runner-base:1.3.1
variables:
GIT_COMMITTER_EMAIL: phil@bubblehouse.org
GIT_COMMITTER_NAME: Phil Christensen
GIT_AUTHOR_EMAIL: phil@bubblehouse.org
GIT_AUTHOR_NAME: Phil Christensen
GIT_CREDENTIALS: philchristensen:${GITLAB_TOKEN}
DOCKER_REGISTRY_USER: philchristensen
DOCKER_REGISTRY_PASSWORD: ${GITLAB_TOKEN}
HELM_REGISTRY_USERNAME: philchristensen
HELM_REGISTRY_PASSWORD: ${GITLAB_TOKEN}
DOCKER_BUILDKIT: 1
UV_CACHE_DIR: .cache/uv
PYPI_TOKEN: ${TWINE_PASSWORD}
script:
- npm install
- docker buildx install
- docker buildx create --bootstrap --use --name=$CI_PROJECT_NAME --driver=kubernetes '--driver-opt="nodeselector=kubernetes.io/arch=amd64"'
- docker buildx create --bootstrap --append --name=$CI_PROJECT_NAME --driver=kubernetes '--driver-opt="nodeselector=kubernetes.io/arch=arm64","tolerations=key=kubernetes.io/arch,value=arm64,operator=Equal,effect=NoSchedule"'
# semantic-release-pypi always uses `python3` but doing this anywhere else breaks the image
- ln -sf python3.11 /usr/bin/python3
- npx semantic-release
only:
refs:
- main
cache:
paths:
- .cache/uv
- node_modules/
pages:
stage: deploy
tags:
- shacklyn
image: hugomods/hugo:exts
variables:
GIT_SUBMODULE_STRATEGY: recursive
needs:
- job: lint:score
artifacts: true
optional: true
- job: lint:html
artifacts: true
optional: true
- job: test:coverage
artifacts: true
optional: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- hugo -s extras/pages --destination ../../public
artifacts:
paths:
- public