-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
281 lines (265 loc) · 8.49 KB
/
.gitlab-ci.yml
File metadata and controls
281 lines (265 loc) · 8.49 KB
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
default:
interruptible: true
stages:
- lint
- build
- deploy
# https://docs.gitlab.com/ee/ci/yaml/workflow.html
workflow:
rules:
# run a pipeline in the merge request context
# https://docs.gitlab.com/ci/pipelines/merge_request_pipelines/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# don't run a branch pipeline on push when there is an open merge request
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
# otherwise run a branch pipeline, but only if the project is in the tnl-project group
- if: $CI_COMMIT_BRANCH && $CI_PROJECT_ROOT_NAMESPACE == "tnl-project"
.env_setup: &env_setup
#
# make sure that $PATH and other essential variables are set correctly (needed for cuda)
- source /etc/profile
# do not use all cores for OpenMP
- export OMP_NUM_THREADS=4
# running as root does not matter inside Docker containers
- export OMPI_ALLOW_RUN_AS_ROOT=1
- export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
check format:
stage: lint
image: "quay.io/archlinux/archlinux:base"
before_script:
- pacman -Syu --needed --noconfirm just ruff clang
script:
- just check-format
variables:
FORCE_COLOR: 1
ruff check:
stage: lint
image: "quay.io/archlinux/archlinux:base"
before_script:
- pacman -Syu --needed --noconfirm ruff
script:
- ruff check --exit-zero
- ruff check --output-format=gitlab > code-quality-report.json
variables:
FORCE_COLOR: 1
artifacts:
reports:
codequality: $CI_PROJECT_DIR/code-quality-report.json
typos:
stage: lint
image: "quay.io/archlinux/archlinux:base"
before_script:
- pacman -Syu --needed --noconfirm typos
script:
- typos --color always --sort
Arch_cmake:
stage: build
image: "quay.io/archlinux/archlinux:base-devel"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- pacman -Suy --needed --noconfirm git cmake ninja python openmpi
- pacman -Suy --needed --noconfirm python-numpy python-mpi4py
- pacman -Suy --needed --noconfirm python-pytest python-pytest-xdist python-psutil python-hypothesis
script:
- *env_setup
- cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX="$HOME/.local"
- cmake --build build
- cmake --install build
- pytest
- mpirun -np 2 pytest -m mpi -n 0
parallel:
matrix:
- BUILD_TYPE:
- Debug
- Release
Arch_cmake_cuda:
stage: build
image: "jlk.fjfi.cvut.cz:5000/fjfi-mmg/archlinux-cuda:latest"
tags:
- nvidia
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- pacman -Suy --needed --noconfirm git cmake ninja python openmpi
- pacman -Suy --needed --noconfirm python-numpy python-mpi4py python-cupy
- pacman -Suy --needed --noconfirm python-pytest python-pytest-xdist python-psutil python-hypothesis
script:
- *env_setup
- cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX="$HOME/.local"
- cmake --build build
- cmake --install build
- pytest -m cuda -n 0
- mpirun -np 2 pytest -m "mpi and cuda" -n 0
parallel:
matrix:
- BUILD_TYPE:
- Debug
- Release
Arch_python_build:
stage: build
image: "quay.io/archlinux/archlinux:base-devel"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- pacman -Suy --needed --noconfirm git cmake ninja python openmpi
- pacman -Suy --needed --noconfirm python-numpy python-mpi4py
- pacman -Suy --needed --noconfirm python-build python-installer python-scikit-build-core
- pacman -Suy --needed --noconfirm python-pytest python-pytest-xdist python-psutil python-hypothesis
script:
- *env_setup
- python -m build --no-isolation
- python -m venv --system-site-packages .venv
- source .venv/bin/activate
- python -m installer dist/*.whl
- python -m pytest
- mpirun -np 2 python -m pytest -m mpi -n 0
Arch_pip:
stage: build
image: "quay.io/archlinux/archlinux:base-devel"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- pacman -Suy --needed --noconfirm git cmake ninja python openmpi
script:
- *env_setup
- python -m venv .venv
- source .venv/bin/activate
- python -m pip install .[dev]
- pytest
- mpirun -np 2 pytest -m mpi -n 0
- mypy
- basedpyright
Arch_pip_cuda:
stage: build
image: "jlk.fjfi.cvut.cz:5000/fjfi-mmg/archlinux-cuda:latest"
tags:
- nvidia
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- pacman -Suy --needed --noconfirm git cmake ninja python openmpi
script:
- *env_setup
- python -m venv .venv
- source .venv/bin/activate
- python -m pip install .[dev,dev-cuda] -v
- pytest -m cuda -n 0
- mpirun -np 2 pytest -m "mpi and cuda" -n 0
- mypy
- basedpyright
Python_build:
stage: build
image: "docker.io/library/python:${IMAGE_TAG}"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- if [[ ${DISTRO} == "Alpine" ]]; then
apk add build-base git cmake ninja openmpi-dev zlib-dev;
export OMPI_MCA_plm_rsh_agent=sh;
fi
- if [[ ${DISTRO} == "Debian" ]]; then
apt update;
apt -y install git cmake ninja-build libopenmpi-dev;
fi
script:
- *env_setup
- python -m pip install build installer pytest pytest-xdist hypothesis numpy mpi4py basedmypy basedpyright
- python -m build --config-setting=cmake.define.PyTNL_ENABLE_INTERPROCEDURAL_OPTIMIZATION=${PyTNL_ENABLE_INTERPROCEDURAL_OPTIMIZATION}
- python -m installer dist/*.whl
- python -m pytest
- mpirun -np 2 python -m pytest -m mpi -n 0
- mypy
- basedpyright
parallel:
matrix:
- DISTRO: "Alpine"
IMAGE_TAG:
- "3.12-alpine"
- "3.13-alpine"
- "3.14-alpine"
# IPO/LTO does not work on Alpine:
# error: inlining failed in call to 'always_inline' 'vsnprintf': function body can be overwritten at link time
PyTNL_ENABLE_INTERPROCEDURAL_OPTIMIZATION: "OFF"
- DISTRO: "Debian"
IMAGE_TAG:
- "3.12"
- "3.13"
- "3.14"
PyTNL_ENABLE_INTERPROCEDURAL_OPTIMIZATION: "ON"
Ubuntu_cmake:
stage: build
image: "docker.io/library/ubuntu:rolling"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- apt update
- apt -y install build-essential git cmake ninja-build
- apt -y install python3-dev libopenmpi-dev
#- apt -y install python3-numpy python3-mpi4py
- apt -y install python3-pytest python3-pytest-xdist python3-psutil python3-hypothesis
- apt -y install python3-venv
script:
- *env_setup
- cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX="$HOME/.local"
- cmake --build build
- cmake --install build
# FIXME: hack because docker.io/library/ubuntu:rolling has old numpy version (2.2.4)
- python3 -m venv --system-site-packages .venv
- source .venv/bin/activate
- python3 -m pip install numpy>=2.2.5 mpi4py
- python3 -m pytest
- mpirun -np 2 python3 -m pytest -m mpi -n 0
parallel:
matrix:
- BUILD_TYPE:
- Debug
- Release
Ubuntu_pip:
stage: build
image: "docker.io/library/ubuntu:latest"
# don't wait for jobs in previous stages to complete before starting this job
needs: []
before_script:
- apt update
- apt -y install build-essential git
- apt -y install python3-dev libopenmpi-dev
- apt -y install python3-venv
script:
- *env_setup
- python3 -m venv .venv
- source .venv/bin/activate
- python3 -m pip install .[dev]
- pytest
- mpirun -np 2 pytest -m mpi -n 0
- mypy
- basedpyright
documentation:
stage: build
image: "quay.io/archlinux/archlinux:base"
rules:
- changes:
- docs/**/*
- .gitlab-ci.yml
- examples/**/*
before_script:
- pacman -Syu --needed --noconfirm mkdocs mkdocs-material python-pymdown-extensions
script: mkdocs build
artifacts:
paths:
- "public"
expire_in: "7 days"
needs: []
deploy documentation:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- docs/**/*
- .gitlab-ci.yml
- examples/**/*
dependencies:
- documentation
pages: true
script: "true"