-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.gitlab-ci.yml
369 lines (349 loc) · 11.5 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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
stages:
- build
- install
- deploy
build:
stage: build
image: ubuntu:20.04
script:
- apt-get update
- apt-get install -y python3-venv python3-pip git
- python3 -m venv env
- env/bin/pip install --upgrade pip
- env/bin/pip install build
- env/bin/python -m build --sdist
artifacts:
paths:
- dist/
- tests/
- tox.ini
install-tox:
stage: install
image: iffregistry.fz-juelich.de/scientific-it-systems/gr-test/python-testing
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_MESSAGE =~ /RebuildReferenceImages\([][ ?*_a-zA-Z0-9-]*\)/'
when: never
- if: '$GR_REBUILD_REFERENCE'
when: never
- when: on_success
variables:
GIT_STRATEGY: none
GR_VERSION: minimum
needs:
- build
script:
- export GR_TEST_BASE_PATH=`pwd`/test_result/
- tox
artifacts:
paths:
- test_result/
when: on_failure
rebuild-images:
stage: install
image: iffregistry.fz-juelich.de/scientific-it-systems/gr-test/python-testing:latest
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_MESSAGE =~ /RebuildReferenceImages\([][ ?*_a-zA-Z0-9-]*\)/'
when: on_success
- if: '$GR_REBUILD_REFERENCE'
when: on_success
variables:
GR_VERSION: minimum
needs:
- build
script:
- mkdir -p ~/.ssh
- cat $SSH_KEY | base64 -d > ~/.ssh/id_rsa
- mv $SSH_KNOWN_HOSTS ~/.ssh/known_hosts
- chmod 600 ~/.ssh/id_rsa
- git clone [email protected]:Scientific-IT-Systems/gr-test.git
- pip3.8 install -e gr-test/
- pip3.8 install dist/gr-*.tar.gz
- cd gr-test
- git checkout -b update-files/job-$CI_JOB_ID
- if [[ -z "$GR_REBUILD_REFERENCE" ]]; then
export GR_REBUILD_REFERENCE=`echo $CI_COMMIT_MESSAGE | sed 's/.*RebuildReferenceImages(\([][ ?*_a-zA-Z0-9-]*\)).*/\1/'` ;
fi
- if [[ $GR_REBUILD_REFERENCE == "all" ]] || [[ -z "$GR_REBUILD_REFERENCE" ]]; then
pyenv exec gr_test --create=REFERENCE python ;
else
pyenv exec gr_test --create=REFERENCE --filter ${GR_REBUILD_REFERENCE} -- python ;
fi
- git config user.name "GR-Test Reference Bot"
- git config user.email "$GITLAB_USER_EMAIL"
- git status
- git add -A gr_test/python_data/
- git commit -m "Rebuilt python reference data in build job $CI_JOB_ID"
- 'git push -o merge_request.description="Job initiator: @$GITLAB_USER_LOGIN" -o merge_request.label="auto-create" -o merge_request.label="reference-files-update" -o merge_request.remove_source_branch -o merge_request.create origin update-files/job-$CI_JOB_ID'
check-codestyle:
stage: build
image: ubuntu:20.04
script:
- apt-get update
- apt-get install -y python3-venv python3-pip git
- python3 -mvenv env
- env/bin/pip install --upgrade pip
- env/bin/pip install flake8-docstrings
# Check against PEP8 and PEP257
# Ignore line length check (E501)
# Ignore single-line docstring check (D200)
- env/bin/python3 -m flake8 --ignore E501,D200 gr/pygr/mlab.py grm/*
install-ubuntu2004-python3:
stage: install
image: ubuntu:20.04
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- apt-get update
- apt-get install -y python3-venv python3-pip
- python3 -m venv env
- env/bin/pip install --upgrade pip
- env/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png env/bin/python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- env/bin/python -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-ubuntu2204-python3:
stage: install
image: ubuntu:22.04
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- apt-get update
- apt-get install -y python3-venv python3-pip
- python3 -m venv env
- env/bin/pip install --upgrade pip
- env/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png env/bin/python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- env/bin/python -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-debian11-python3:
stage: install
image: debian:11
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- apt-get update
- apt-get install -y python3-venv python3-pip
- python3 -m venv env
- env/bin/pip install --upgrade pip
- env/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png env/bin/python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- env/bin/python -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-debian11-armhf-python3:
stage: install
image: debian:11
tags:
- armhf
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- apt-get update
- apt-get install -y python3-venv python3-pip python3-numpy
- python3 -m venv --system-site-packages env
- env/bin/pip install --upgrade pip
- env/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png env/bin/python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- env/bin/python -c 'import gr3'
artifacts:
paths:
- install/gks.png
# CentOS 7 reached EOL on 2024-06-30, thus use vault-mirrors
install-centos7-python2:
stage: install
image: centos:7
variables:
GIT_STRATEGY: none
script:
- sed -i
-e 's/^mirrorlist/#mirrorlist/g'
-e 's%#baseurl=http://mirror.centos.org%baseurl=http://vault.centos.org%g'
/etc/yum.repos.d/CentOS-*
- rm -rf install && mkdir install && cd install
- yum install -y python
- curl -LO https://bootstrap.pypa.io/pip/2.7/get-pip.py
- python get-pip.py
- pip install --upgrade pip==20.3.4
- pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- python -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-rockylinux8-python3:
stage: install
image: rockylinux:8
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- dnf install -y python3-pip
- python3 -m pip install --upgrade pip
- python3 -m pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png python3 -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- python3 -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-fedora36-python3:
stage: install
image: fedora:36
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- dnf install -y python3-pip
- python3 -m pip install --upgrade pip
- python3 -m pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png python3 -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- python3 -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-opensuse15-python3:
stage: install
image: opensuse/leap:15
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- zypper install -y python3-pip
- python3 -m pip install --upgrade pip
- python3 -m pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png python3 -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- python3 -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-arch-python3:
stage: install
image: archlinux:base
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- pacman -Syu --noconfirm python-pip
- python3 -m venv ./venv
- ./venv/bin/pip install --upgrade pip
- ./venv/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png ./venv/bin/python3 -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- ./venv/bin/python3 -c 'import gr3'
artifacts:
paths:
- install/gks.png
install-freebsd13-python3:
stage: install
image: freebsd:13
tags:
- libvirt
variables:
GIT_STRATEGY: none
script:
- rm -rf install && mkdir install && cd install
- sudo pkg install -y python3 py311-pip py311-numpy
- python3 -m venv --system-site-packages env
- env/bin/pip install --upgrade pip
- env/bin/pip install ../dist/gr-*.tar.gz
- GKS_WSTYPE=png env/bin/python -c 'import gr; gr.polyline([0, 1], [0, 1]); gr.updatews()'
- env/bin/python -c 'import gr3'
artifacts:
paths:
- install/gks.png
deploy-to-github:
stage: deploy
image: ubuntu:20.04
variables:
GIT_STRATEGY: none
only:
- branches@Scientific-IT-Systems/python-gr
- tags@Scientific-IT-Systems/python-gr
script:
- apt-get update
- apt-get install -y git python3-pip
- python3 -m pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@iffgit.fz-juelich.de/Scientific-IT-Systems/github-binary-upload.git
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$SCIAPP_PYTHON_GR_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "github.com $GITHUB_HOST_KEY" >> ~/.ssh/known_hosts)
- git clone --mirror "$CI_REPOSITORY_URL" gr_mirror
- cd gr_mirror && git push --mirror [email protected]:sciapp/python-gr.git && cd -
- if echo "$CI_COMMIT_TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "$SCIAPP_PYTHON_GR_ACCESS_TOKEN" | github-binary-upload --user jheinen sciapp/python-gr "$CI_COMMIT_TAG" dist/gr-*.tar.gz;
fi
deploy-to-pypi:
stage: deploy
image: ubuntu:20.04
variables:
GIT_STRATEGY: none
only:
- tags@Scientific-IT-Systems/python-gr
script:
- rm -rf deploy && mkdir deploy && cd deploy
- apt-get update
- apt-get install -y python3-pip python3-venv git
- python3 -m venv env
- env/bin/pip install --upgrade pip
- env/bin/pip install twine
- echo "[distutils]" > ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- echo "username=$PYPIUSERNAME" >> ~/.pypirc
- echo "password=$PYPIPASSWORD" >> ~/.pypirc
- env/bin/twine upload --repository pypi ../dist/gr-*.tar.gz
deploy-to-obs:
stage: deploy
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/$CI_JOB_NAME
variables:
GIT_STRATEGY: none
only:
- tags@Scientific-IT-Systems/python-gr
script:
- mkdir -p "${HOME}/.config/osc" && ln -s "${OSCRC}" "${HOME}/.config/osc/oscrc"
- osc co science:gr-framework/python-gr
- export VERSION=`echo "$CI_COMMIT_TAG" | sed 's/^v//'` ;
sed 's/\(.*revision">\).*\(<.*\)/\1tags\/'$CI_COMMIT_TAG'\2/'
science\:gr-framework/python-gr/_service |
sed 's/\(.*version">\)[[:digit:]].*\(<.*\)/\1'$VERSION'\2/'
> science\:gr-framework/python-gr/_service.new &&
mv -f science\:gr-framework/python-gr/_service.new
science\:gr-framework/python-gr/_service
- osc commit science\:gr-framework/python-gr/_service -m "Release $CI_COMMIT_TAG"
deploy-to-aur:
stage: deploy
needs:
- deploy-to-github
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/$CI_JOB_NAME
only:
- tags@Scientific-IT-Systems/python-gr
script:
- git config --global --add safe.directory "$(pwd)"
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$AUR_GR_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "aur.archlinux.org $AUR_HOST_KEY" >> ~/.ssh/known_hosts)
- if echo "$CI_COMMIT_TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
git clone "ssh://[email protected]/python-gr-framework.git";
cd "python-gr-framework";
sed -i -e "/^pkgver=/c\pkgver=\"${CI_COMMIT_TAG#v}\"" -e "/^pkgrel=/c\pkgrel=\"1\"" PKGBUILD;
(
source PKGBUILD;
curl -o source -L "${source[0]}";
SHA256SUM="$(sha256sum source | awk '{ print $1 }')";
sed -i "/^sha256sums=/c\sha256sums=(\"${SHA256SUM}\")" PKGBUILD;
);
makepkg --printsrcinfo > .SRCINFO;
git commit -a -m "Update to version ${CI_COMMIT_TAG#v}";
git push;
fi