-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
134 lines (122 loc) · 3.49 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
# SPDX-FileCopyrightText: 2021-2024 Helmholtz-Zentrum hereon GmbH
#
# SPDX-License-Identifier: CC0-1.0
image: python:3.9
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
before_script:
# replace git internal paths in order to use the CI_JOB_TOKEN
- apt-get update -y && apt-get install -y pandoc graphviz
- python -m pip install -U pip
test-package:
stage: test
script:
- pip install build twine
- make dist
- twine check dist/*
artifacts:
name: python-artifacts
paths:
- "dist/*"
expire_in: 7 days
test:
stage: test
image: "${IMAGE}"
variables:
PIPENV_PIPFILE: "ci/matrix/${SCENARIO}/Pipfile"
# disable sandboxing, otherwise chrome reports errors when the
# container runs as root
# https://doc.qt.io/qt-5/qtwebengine-platform-notes.html#sandboxing-support
QTWEBENGINE_DISABLE_SANDBOX: "true"
script:
# install necessary libraries for pyqt
- apt-get install -y xvfb python3-pyqt5.qtwebengine
- pip install pipenv
- pipenv install
- xvfb-run make pipenv-test
parallel:
matrix:
- SCENARIO: default
IMAGE: python:3.9
# python scenarios
- SCENARIO: mpl_38_py39
IMAGE: python:3.9
- SCENARIO: mpl_38_py310
IMAGE: python:3.10
- SCENARIO: mpl_38_py311
IMAGE: python:3.11
- SCENARIO: mpl_38_py312
IMAGE: python:3.12
# matplotlib scenarios
- SCENARIO: mpl_35_py39
IMAGE: python:3.9
- SCENARIO: mpl_36_py310
IMAGE: python:3.10
- SCENARIO: mpl_37_py311
IMAGE: python:3.11
artifacts:
name: pipfile
paths:
- "ci/matrix/${SCENARIO}/*"
expire_in: 30 days
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
test-docs:
stage: test
variables:
# disable sandboxing, otherwise chrome reports errors when the
# container runs as root
# https://doc.qt.io/qt-5/qtwebengine-platform-notes.html#sandboxing-support
QTWEBENGINE_DISABLE_SANDBOX: "true"
script:
# install necessary libraries for pyqt
- apt-get install -y xvfb python3-pyqt5.qtwebengine
- make dev-install
# install PyQt5 (not part of requirements.txt because this is complicated
# to install on different platforms)
- pip install PyQt5 PyQtWebEngine
- xvfb-run make -C docs html
- xvfb-run make -C docs linkcheck
artifacts:
paths:
- docs/_build
deploy-package:
stage: deploy
needs:
- test-package
- test-docs
- test
only:
- master
script:
- pip install twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
deploy-docs:
stage: deploy
only:
- master
needs:
- test-docs
image: node:21
before_script:
- npm install -g gh-pages@6.1.1
- mkdir .gh-pages-cache
script:
# make sure, the DEPLOY_TOKEN is defined
- >-
[ ${CI_DEPLOY_TOKEN} ] ||
echo "The CI_DEPLOY_TOKEN variable is not set. Please create an access
token with scope 'read_repository' and 'write_repository'" &&
[ ${CI_DEPLOY_TOKEN} ]
- >-
CACHE_DIR=$(realpath .gh-pages-cache)
gh-pages
--dotfiles
--nojekyll
--branch gh-pages
--repo https://ci-user:${CI_DEPLOY_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
--user "${CI_COMMIT_AUTHOR}"
--message "CI Pipeline ${CI_PIPELINE_ID}, commit ${CI_COMMIT_SHORT_SHA}"
--dist docs/_build/html