Newer
Older
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
stages:
- test
- build
- deploy
- release
# GitLab provides a template to ensure pipelines run only for branches and tags, not for merge requests
# This prevents duplicate pipelines in merge requests.
# See https://docs.gitlab.com/ee/ci/troubleshooting.html#job-may-allow-multiple-pipelines-to-run-for-a-single-action
include:
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
variables:
VERSION: $CI_COMMIT_SHA
DEBIAN_FRONTEND: non-interactive
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
test:
image: python:slim
stage: test
cache:
paths:
- .cache/pip
before_script:
- pip install tox
except:
- schedules
script:
- tox -- --junitxml=test-report.xml --durations=50
lint:
image: python:slim
cache:
paths:
- .cache/pip
- .cache/pre-commit
variables:
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
before_script:
- pip install pre-commit
# Install git
- apt-get update -q -y && apt-get install -q -y --no-install-recommends git
except:
- schedules
script:
- pre-commit run -a
docker-build:
stage: build
image: docker:24.0.6
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
rules:
# Never run on scheduled pipelines
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
# Use commit tag when running on tagged commit
- if: $CI_COMMIT_TAG
variables:
VERSION: $CI_COMMIT_TAG
- when: on_success
script:
- ci/build.sh
bump-python-deps:
stage: release
image: registry.gitlab.teklia.com/infra/devops:latest
only:
- schedules
script:
- devops python-deps requirements.txt doc-requirements.txt
release-notes:
stage: release
image: registry.gitlab.teklia.com/infra/devops:latest
# Only run on tags
only:
- tags
script:
- devops release-notes
# Make sure docs still build correctly
.docs:
image: python:3.10
artifacts:
paths:
- public
before_script:
- pip install -e .[docs]
script:
- mkdocs build --strict --verbose
docs-build:
extends: .docs
stage: build
# Test job outside of tags to ensure the docs still can build before merging
# Does not use the `pages` name, therefore will be ignored by GitLab Pages
except:
- tags
- schedules
pages:
extends: .docs
stage: deploy
only:
- master
- tags
except:
- schedules
docs-deploy:
image: node:18
stage: deploy
dependencies:
- docs-build
before_script:
- npm install -g surge
except:
- master
- tags
- schedules
environment:
name: ${CI_COMMIT_REF_SLUG}
url: https://${CI_COMMIT_REF_SLUG}-metrics-bio.surge.sh
on_stop: docs-stop-surge
script:
- surge public ${CI_ENVIRONMENT_URL}
docs-stop-surge:
image: node:18
stage: deploy
when: manual
# Do not try to checkout the branch if it was deleted
variables:
GIT_STRATEGY: none
except:
- master
- tags
- schedules
environment:
name: ${CI_COMMIT_REF_SLUG}
url: https://${CI_COMMIT_REF_SLUG}-metrics-bio.surge.sh
action: stop
before_script:
- npm install -g surge
script:
- surge teardown ${CI_ENVIRONMENT_URL}