-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
117 lines (106 loc) · 3.06 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
# 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
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
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:
MPLBACKEND: "module://psyplot_gui.backend"
# 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 [email protected]
- 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