forked from NGSolve/netgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
319 lines (295 loc) · 8.32 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
stages:
- build
- test
- test_ngsolve
- deploy
- cleanup
push_github:
stage: build
tags:
- linux
- docker
- bash
script:
- git remote add github [email protected]:NGSolve/netgen.git || true
- git remote update
- git checkout --track origin/master
- git pull origin master
- git push github master --tags
only:
- master
############################################
# Windows
############################################
.template_windows: &win
tags:
- windows
- x64
before_script:
- "echo off"
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64"
- set CI_DIR=C:\ci\%CI_PIPELINE_ID%
- set CCACHE_BASEDIR=C:\ci\%CI_PIPELINE_ID%
- set NETGEN_BUILD_DIR=%CI_DIR%\build
- set INSTALL_DIR=%CI_DIR%\install
- set SRC_DIR=%CI_DIR%\src
- set NETGENDIR=%INSTALL_DIR%\bin
- set PYTHONPATH=%INSTALL_DIR%\lib\site-packages
- echo %PATH%
- set PATH=%INSTALL_DIR%\bin;C:\python312;C:\python312\bin;C:\python312\Scripts;C:\tools\;%PATH%
- echo %PATH%
- set CCACHE_HARDLINK=1
- set CCACHE_NOHASHDIR=1
- C:\tools\ccache -s
- C:\tools\ccache -M 20G
- dir C:\python312
- python.exe --version
- python.exe -m pip install -U netgen-occt netgen-occt-devel
- cmake --version
build_win:
<<: *win
stage: build
script:
- mkdir %SRC_DIR%
- xcopy . %SRC_DIR%\ /O /X /E /H /K /Q
- cd %SRC_DIR%
- git submodule update --init --recursive
- rd /s /q %NETGEN_BUILD_DIR%
- mkdir %NETGEN_BUILD_DIR%
- cd %NETGEN_BUILD_DIR%
- >-
cmake %SRC_DIR%
-G Ninja
-DCMAKE_PREFIX=C:/python312
-DPython3_ROOT_DIR=C:/python312
-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%
-DCHECK_RANGE=ON
-DUSE_CGNS=ON
-DUSE_OCC=ON
-DUSE_CCACHE=ON
-DENABLE_UNIT_TESTS=OFF
-DCMAKE_BUILD_TYPE=Release
- cmake --build . --target install --config Release
test_win:
<<: *win
stage: test
script:
- pip install pytest-check
- cd tests\pytest
- cd %NETGEN_BUILD_DIR%\netgen
- ctest -C Release -V --output-on-failure
- cd ..
needs: ["build_win"]
generate_results:
<<: *win
stage: test
script:
- pip install pytest-check
- cd tests\pytest
- python test_tutorials.py new_results.json
needs: ["build_win"]
when: manual
artifacts:
paths:
- tests/pytest/new_results.json
when: always
expire_in: 1 week
cleanup_win:
<<: *win
stage: cleanup
tags:
- windows
- x64
script:
- cd %CI_PROJECT_DIR%
- rd /s /q %CI_DIR%
when: always
allow_failure: true
needs: ["test_win"]
############################################
# Ubuntu/Linux
############################################
.template_ubuntu: &ubuntu
tags:
- linux
- bash
before_script:
- pwd
- ls
- docker info
- export PYTHONPATH=/opt/netgen/`python3 -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))"`
variables:
UBUNTU_VERSION: "22.04"
build_ubuntu_debug:
<<: *ubuntu
stage: build
script:
- docker build -t netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION} -f tests/dockerfile .
- rm -f netgen_${CI_PIPELINE_ID}_$UBUNTU_VERSION.id
- >-
docker run
--cidfile netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
-e CCACHE_DIR=/ccache
-e PYTHONPATH=$PYTHONPATH
-v /mnt/ccache:/ccache
netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION}
bash /root/src/netgen/tests/build_debug.sh
- docker commit `cat netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id` netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
- rm netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
build_ubuntu_mpi:
<<: *ubuntu
stage: build
script:
- docker build -t netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION} -f tests/dockerfile_mpi .
- rm -f netgen_mpi_${CI_PIPELINE_ID}_$UBUNTU_VERSION.id_mpi
- >-
docker run>-
--cidfile netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id>-
-e CCACHE_DIR=/ccache
-e PYTHONPATH=$PYTHONPATH
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
-v /mnt/ccache:/ccache
netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION}
bash /root/src/netgen/tests/build_mpi.sh
- docker commit `cat netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id` netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
- rm netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
test_ubuntu_debug:
<<: *ubuntu
stage: test
script:
- >-
docker run
-e PYTHONPATH=$PYTHONPATH
netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V --output-on-failure"'
needs: ["build_ubuntu_debug"]
test_ubuntu_mpi:
<<: *ubuntu
stage: test
script:
- >-
docker run
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
-e PYTHONPATH=$PYTHONPATH
netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V --output-on-failure"'
needs: ["build_ubuntu_mpi"]
test_build_ngsolve:
<<: *ubuntu
allow_failure: true
stage: test_ngsolve
script:
- >-
docker run
-e NETGENDIR=/opt/netgen/bin
-e PYTHONPATH=$PYTHONPATH
-e MKLROOT=/opt/intel/mkl
-v /opt/intel:/opt/intel
-e CCACHE_DIR=/ccache
-v /mnt/ccache:/ccache
netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
bash -c 'cd /root/src/netgen/tests/ && ./build_ngsolve.sh'
cleanup_ubuntu:
stage: cleanup
tags:
- linux
- bash
script:
# remove intermediate and old docker images and containers
- docker rm -f `docker ps --no-trunc -aq`
- docker images --no-trunc -aqf "dangling=true" | xargs docker rmi -f || true
- docker rmi -f netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION} || true
- docker rmi -f netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION} || true
- docker rmi -f netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION} || true
- docker rmi -f netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION} || true
when: always
allow_failure: true
############################################
# MacOSX
############################################
.template_mac: &mac
tags:
- mac
- x64
before_script:
- export ROOT_DIR=/tmp/$CI_PIPELINE_ID
- export SRC_DIR=$ROOT_DIR/src
- export BUILD_DIR=$ROOT_DIR/build
- export CMAKE_INSTALL_PREFIX=/tmp/$CI_PIPELINE_ID/install/Netgen.app
- export PYTHONPATH=$CMAKE_INSTALL_PREFIX/Contents/Resources/`python3 -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))"`:.
- export PATH=$CMAKE_INSTALL_PREFIX/Contents/MacOS:$PATH
build_mac:
<<: *mac
stage: build
script:
- git submodule update --init --recursive
- rm -rf $BUILD_DIR
- mkdir -p $BUILD_DIR
- rm -rf $SRC_DIR
- mkdir -p $SRC_DIR
- cp -a . $SRC_DIR/
- cd $BUILD_DIR
- >-
cmake $SRC_DIR
-DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX
-DCMAKE_BUILD_TYPE=Release
-DCHECK_RANGE=ON
-DUSE_NATIVE_ARCH=OFF
-DUSE_CCACHE=ON
-DENABLE_UNIT_TESTS=ON
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
-DUSE_CGNS=ON
-DUSE_OCC=ON
-DPython3_ROOT_DIR=/Library/Frameworks/Python.framework/Versions/3.8/
- make -j5 install
test_mac:
<<: *mac
stage: test
script:
- cd $BUILD_DIR/netgen
- ctest . -V --output-on-failure
needs: ["build_mac"]
cleanup_mac:
<<: *mac
stage: cleanup
script:
- rm -rf $ROOT_DIR
when: always
allow_failure: true
needs: ["test_mac"]
pip_linux:
image: quay.io/pypa/manylinux_2_28_x86_64
stage: build
tags:
- pip
- linux
- docker
script:
- ./tests/build_pip.sh
when: manual
pip_windows:
stage: build
tags:
- pip
- windows
script:
- .\tests\build_pip.ps1 C:\Python313
- .\tests\build_pip.ps1 C:\Python312
- .\tests\build_pip.ps1 C:\Python311
- .\tests\build_pip.ps1 C:\Python310
- .\tests\build_pip.ps1 C:\Python39
when: manual
pip_macos:
stage: build
tags:
- pip
- macosx
- m1
script:
- ./tests/build_pip_mac.sh 3.13
- ./tests/build_pip_mac.sh 3.12
- ./tests/build_pip_mac.sh 3.11
- ./tests/build_pip_mac.sh 3.10
- ./tests/build_pip_mac.sh 3.9
when: manual