-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
285 lines (252 loc) · 6.45 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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
stages:
- version
- tox
- behave-test
- build
- publish
- doc-build
- page-build
- doc-serve
- page-serve
variables:
GIT_SUBMODULE_STRATEGY: recursive
VERSION_FILE: version.sh
GIT_DEPTH: 500
KIND_VERSION: 0.9.0
KUBERNETES_VERSION: 1.19.1
DOCKER_VERSION: 19.03.12
HELM_VERSION: 3.3.1
JUPYTER_VERSION: 0.9.1
SPHINX_VERSION: 5.1.1
DOC_PORT_PREFIX: 11
HUGO_VERSION: 0.76.3-ext-ubuntu
HUGO_ENV: production
NEXUS_HOST: zsibio.ii.pw.edu.pl
PIP_SNAPSHOT_REPO: http://${NEXUS_HOST}/nexus/repository/bdg-pip/simple
MAVEN_SNAPSHOT_REPO: https://zsibio.ii.pw.edu.pl/nexus/repository/maven-snapshots/
PAGE_URL: pysequila.biodatageeks.org
SEQUILA_VERSION: 1.0.1+g68cb8220-SNAPSHOT
SPARK_IMAGE: jupyter/pyspark-notebook:spark-3.2.1
SCALA_VERSION: "2.12"
VENV_NAME: pysequila
.python37Vars: &python37Vars
PYTHON_VERSION: "3.7"
.python38Vars: &python38Vars
PYTHON_VERSION: "3.8"
.python39Vars: &python39Vars
PYTHON_VERSION: "3.9"
.publishSnapshotVar: &publishSnapshotVar
PYPI_REPO: "zsibio"
DOC_URL_PREFIX: "$PAGE_URL/snapshot"
DOC_URL: "https://$PAGE_URL/doc/snapshot/"
VERSIONED: "true"
.publishReleaseVar: &publishReleaseVar
PYPI_REPO: "pypi"
DOC_URL_PREFIX: "$PAGE_URL"
DOC_URL: "https://$PAGE_URL/doc/"
VERSIONED: "true"
.publishMasterVar: &publishMasterVar
PYPI_REPO: "pypi"
DOC_URL_PREFIX: "$PAGE_URL"
DOC_URL: "https://$PAGE_URL/doc/"
VERSIONED: "false"
# --------------------------------- STAGE: version ---------------------------------------------------------------------
version-branch:
stage: version
image:
name: mdomke/git-semver:v4.0.1
entrypoint: [""]
script:
- cd /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME && git-semver --format x.y.z+m | sed -e 's/$/-SNAPSHOT/g' | xargs -I {} echo "export VERSION={}" > $VERSION_FILE
- cat $VERSION_FILE
artifacts:
paths:
- $VERSION_FILE
tags: [ docker ]
except: [ master, tags ]
version-tag:
stage: version
image:
name: mdomke/git-semver:v4.0.1
entrypoint: [""]
script:
- cd /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME && git-semver --no-hash --no-pre | xargs -I {} echo "export VERSION={}" > $VERSION_FILE
- cat $VERSION_FILE
artifacts:
paths:
- $VERSION_FILE
tags: [ docker ]
except:
- branches
tox:
variables:
<<: *python37Vars
stage: tox
image: python:$PYTHON_VERSION
cache:
key: $CI_PROJECT_PATH
paths:
- "/root/.cache/"
before_script:
- pip install -U -r requirements.txt
script:
- tox
artifacts:
paths:
- htmlcov/
tags: [ docker ]
behave-test:
stage: behave-test
variables:
<<: *python39Vars
image:
name: $SPARK_IMAGE
before_script:
- pip install -U -e .
- pip install behave==1.2.6 inflect==5.3.0 coverage
- export PYSPARK_SUBMIT_ARGS="--packages org.biodatageeks:sequila_${SCALA_VERSION}:${SEQUILA_VERSION} --repositories $MAVEN_SNAPSHOT_REPO --driver-memory 4g pyspark-shell"
script:
- coverage run $(which behave)
- coverage report
artifacts:
paths:
- /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/docs/build/
tags: [ docker ]
.build: &build
image: python:$PYTHON_VERSION
cache:
key: $CI_PROJECT_PATH
paths:
- "/root/.cache/"
before_script:
- source $VERSION_FILE
- pip install -U -r requirements.txt
script:
- python setup.py sdist bdist_wheel
- twine check dist/*
artifacts:
paths:
- /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/dist/
tags: [ docker ]
build-python37:
stage: build
variables:
<<: *python37Vars
<<: *build
except: [ master ]
.publish: &publish
image: python:$PYTHON_VERSION
cache:
key: $CI_PROJECT_PATH
paths:
- "/root/.cache/"
before_script:
- source $VERSION_FILE
- pip install -U -r requirements.txt
script:
- twine upload --repository=$PYPI_REPO dist/* --config-file=/root/pypi/.pypirc
tags: [ docker ]
publishSnapshotpython37:
stage: publish
variables:
<<: *python37Vars
<<: *publishSnapshotVar
<<: *publish
except: [ master, tags ]
publishReleasetpython37:
stage: publish
variables:
<<: *python37Vars
<<: *publishReleaseVar
<<: *publish
only:
- tags
except:
- branches
.doc-build: &doc-build
stage: doc-build
variables:
<<: *python39Vars
image:
name: $SPARK_IMAGE
before_script:
- source $VERSION_FILE
- pip install -U sphinx==$SPHINX_VERSION nbsphinx sphinx_rtd_theme rst2pdf sphinxcontrib-github_ribbon sphinxcontrib-bibtex pysequila==$VERSION --extra-index-url=$PIP_SNAPSHOT_REPO --trusted-host $NEXUS_HOST
- export PYSPARK_SUBMIT_ARGS="--packages org.biodatageeks:sequila_${SCALA_VERSION}:${SEQUILA_VERSION} --repositories $MAVEN_SNAPSHOT_REPO --driver-memory 4g pyspark-shell"
script:
- cd docs && ./docs.sh html
artifacts:
paths:
- /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/docs/build/
tags: [ docker ]
.page-build: &page-build
stage: page-build
image:
name: klakegg/hugo:$HUGO_VERSION
entrypoint: [""]
before_script:
- apt update && apt-get install -y gettext
script:
- envsubst < page/config-template.toml > page/config.toml
- cd page && hugo --enableGitInfo=false
artifacts:
paths:
- /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/page/docs/
tags: [ docker ]
doc-buildSnapshot:
<<: *doc-build
except: [ master, tags ]
doc-buildRelease:
<<: *doc-build
needs:
- publishReleasetpython37
only:
- tags
page-buildSnapshot:
variables:
<<: *publishSnapshotVar
<<: *page-build
except: [ master, tags ]
page-buildRelease:
variables:
<<: *publishReleaseVar
<<: *page-build
only:
- tags
page-buildMaster:
variables:
<<: *publishMasterVar
<<: *page-build
only:
- master
doc-serve:
stage: doc-serve
image:
name: docker:$DOCKER_VERSION
before_script:
- source $VERSION_FILE
script:
- cd /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/docs
- ../build_image.sh "doc" 81 80
tags: [ docker ]
except: [ master]
page-serve:
stage: page-serve
image:
name: docker:$DOCKER_VERSION
before_script:
- source $VERSION_FILE
script:
- cd /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/page
- ../build_image.sh "page" 85 84
tags: [ docker ]
except: [ master]
page-serve-master:
stage: page-serve
image:
name: docker:$DOCKER_VERSION
script:
- cd /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/page
- ../build_image.sh "page" 85 84
tags: [ docker ]
only: [ master ]