-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
272 lines (257 loc) · 8.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
variables:
DEBIAN_FRONTEND: noninteractive
APT_GET_INSTALL: "apt-get install --no-install-recommends -q -y"
stages:
- pre
- build_test
- deploy
pre-commit_alpine:
stage: pre
image:
# https://hub.docker.com/_/alpine
name: alpine:latest
script:
- date
- cat /etc/os-release
- apk add --no-cache bash gcc git libc-dev npm py3-pip python3-dev
- pip install pre-commit
# run pre-commit
- pre-commit --version
- pre-commit run --all-files
pycodestyle_alpine:
stage: pre
image:
# https://hub.docker.com/_/alpine
name: alpine:latest
script:
- date
- cat /etc/os-release
- apk add --no-cache py3-pycodestyle
# check PEP 8 code style (pycodestyle was formerly called pep8)
- pycodestyle --version
- pycodestyle --show-source --show-pep8 --statistics $(find -name "*.py")
pylint_debian:
stage: pre
image:
# https://hub.docker.com/_/debian
name: debian:latest
script:
- date
- cat /etc/os-release
- apt-get update
- $APT_GET_INSTALL libudunits2-0 pylint3 python3-jsonschema python3-netcdf4 python3-pip python3-pytest python3-pytest-cov python3-pytest-xdist python3-recommonmark
# install dependencies (cfchecker via pip)
- pip3 install cfchecker
# run pylint
- pylint --version
- pylint --reports=n --disable=all --enable=similarities $(find -name "*.py") || echo "exit status:"$?
- pylint $(find -name "*.py")
- echo -e "\nskipped files:"
- echo -e "$(grep -irl skip-file *)"
build_pages:
stage: build_test
image:
# https://hub.docker.com/_/debian
name: debian:latest
script:
- date
- cat /etc/os-release
- apt-get update
# get and install necessary packages:
# python3-sphinx-argparse is buggy on debian:latest
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983875;msg=9
- $APT_GET_INSTALL latexmk libudunits2-0 make rsync python3-jsonschema python3-netcdf4 python3-pip python3-pytest python3-pytest-cov python3-pytest-xdist python3-recommonmark python3-setuptools python3-sphinx python3-wheel texlive-fonts-recommended texlive-latex-extra texlive-latex-recommended
# install pydabu
- pip3 install cfchecker sphinx-jsonschema sphinx-argparse
- env python3 setup.py check_modules
- pip3 install .
# build
- ./create_doc
# create data for pages:
- mv manual_pydabu_html public
- mv manual_pydabu.pdf public/
# create badges, which could be used in gitlab:
# see https://github.com/jongracecox/anybadge for available colors
- pip3 install anybadge
- anybadge -l "documentation as" -v html -f pages.svg -c fuchsia -o
- anybadge -l "documentation as" -v pdf -f document_pdf.svg -c orange -o
- anybadge -l "source" -v code -f source_code.svg -c lightgrey -o
# store data as artifacts (e. g. used by pages):
artifacts:
expire_in: 1 hrs
paths:
- document_pdf.svg
- pages.svg
- public
- source_code.svg
check_source_distribution-ubuntu-2004:
stage: build_test
image:
# https://hub.docker.com/_/ubuntu
name: ubuntu:20.04
script:
- tests/docker_test_scripts/do_test_check_source_distribution
check_source_distribution-ubuntu-2204:
stage: build_test
image:
# https://hub.docker.com/_/ubuntu
name: ubuntu:22.04
script:
- tests/docker_test_scripts/do_test_check_source_distribution
ubuntu-2004_test_doc:
stage: build_test
image:
# https://hub.docker.com/_/ubuntu
name: ubuntu:20.04
script:
- date
- cat /etc/os-release
- apt-get update
# get and install necessary packages:
- $APT_GET_INSTALL libudunits2-0 python3-jsonschema python3-netcdf4 python3-pip python3-setuptools python3-wheel
# install dependencies (cfchecker via pip)
- pip3 install cfchecker
# check all modules available
- env python3 setup.py check_modules
# install pydabu
- pip3 install .
# run pydabu
- which pydabu
- pydabu
# run json_schema_from_schema_org
- which json_schema_from_schema_org
- json_schema_from_schema_org -h
# unittest
- env python3 setup.py run_unittest
# install dependencies for pytest (ubuntu packages)
- $APT_GET_INSTALL python3-pytest python3-pytest-cov python3-pytest-xdist
# pytest
- env python3 setup.py run_pytest --parallel --coverage
# install dependencies for documentation (ubuntu packages)
- $APT_GET_INSTALL latexmk make python3-recommonmark python3-sphinx python3-sphinx-argparse rsync texlive-fonts-recommended texlive-latex-extra texlive-latex-recommended
# install dependencies for documentation (sphinx-jsonschema via pip)
- pip3 install sphinx-jsonschema
# build doc
- ./create_doc
ubuntu-2204_test_doc:
stage: build_test
image:
# https://hub.docker.com/_/ubuntu
name: ubuntu:22.04
script:
- date
- cat /etc/os-release
- apt-get update
# get and install necessary packages:
- $APT_GET_INSTALL git libudunits2-0 python3-jsonschema python3-netcdf4 python3-pip python3-setuptools python3-wheel
# install dependencies (cfchecker via pip)
- pip3 install cfchecker
# check all modules available
- env python3 setup.py check_modules
# install pydabu and check .gitattributes
- mkdir archive
- git archive --format=tar HEAD | (cd archive && tar xf -)
- (cd archive && pip3 install .)
- which pydabu
- rm -r archive
- pip3 uninstall -y pydabu
- mkdir archive
- git archive --format=zip --prefix=pydabu/ HEAD > archive/pydabu.zip
- (cd archive && pip3 install pydabu.zip)
# run pydabu
- which pydabu
- pydabu
# run json_schema_from_schema_org
- which json_schema_from_schema_org
- json_schema_from_schema_org -h
# unittest
- env python3 setup.py run_unittest
# install dependencies for pytest (ubuntu packages)
- $APT_GET_INSTALL python3-pytest python3-pytest-cov python3-pytest-xdist
# pytest
- env python3 setup.py run_pytest --parallel --coverage
# install dependencies for documentation (ubuntu packages)
- $APT_GET_INSTALL latexmk make python3-recommonmark python3-sphinx python3-sphinx-argparse rsync texlive-fonts-recommended texlive-latex-extra texlive-latex-recommended
# install dependencies for documentation (sphinx-jsonschema via pip)
- pip3 install sphinx-jsonschema
# build doc
- ./create_doc
i386_debian_latest_test:
stage: build_test
image:
# https://hub.docker.com/_/debian
name: i386/debian:latest
script:
- tests/docker_test_scripts/do_test_i386-debian-latest
opensuse_leap_154_test:
stage: build_test
image:
# https://hub.docker.com/r/opensuse/leap
name: opensuse/leap:15.4
script:
- tests/docker_test_scripts/do_test_opensuse_leap
opensuse_leap_155_test:
stage: build_test
image:
# https://hub.docker.com/r/opensuse/leap
name: opensuse/leap:15.5
script:
- tests/docker_test_scripts/do_test_opensuse_leap
debian-latest_install_from_internet:
stage: build_test
# since we do not test the actual commit, this could fail:
allow_failure: true
image:
# https://hub.docker.com/_/debian
name: debian:latest
script:
- date
- cat /etc/os-release
- apt-get update
# get and install necessary packages for installation:
- $APT_GET_INSTALL python3-pip
# install pydabu from the internet
- pip3 install --system https://gitlab.com/dlr-pa/pydabu/-/archive/master/pydabu-master.zip
# get and install necessary packages:
- $APT_GET_INSTALL libudunits2-0 python3-jsonschema python3-netcdf4
- pip3 install cfchecker
# run pydabu
- which pydabu
- pydabu -h
# unittest
- env python3 setup.py run_unittest
pages:
stage: deploy
image:
# https://hub.docker.com/_/alpine
name: alpine:latest
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
dependencies:
- build_pages
script:
- date
# store data as artifacts (e. g. used by pages):
artifacts:
paths:
- document_pdf.svg
- pages.svg
- public
- source_code.svg
deploy_to_github:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image:
# https://hub.docker.com/_/alpine
name: alpine:latest
script:
- date
- cat /etc/os-release
- apk add --no-cache git openssh
- mkdir ~/.ssh && chmod 700 ~/.ssh
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- mv $github_deploy_key ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
- repopath=$(mktemp -d)
- git clone --mirror ${CI_REPOSITORY_URL} $repopath
- (cd $repopath && git push --prune --mirror [email protected]:dlr-pa/pydabu.git)