-
-
Notifications
You must be signed in to change notification settings - Fork 234
383 lines (336 loc) · 14.5 KB
/
ccpp.yml
File metadata and controls
383 lines (336 loc) · 14.5 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
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
name: CI
on:
push:
branches:
- release
tags:
- "v*"
pull_request:
branches:
- main
merge_group:
branches:
- main
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Checkout DOLFINx
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Install linting tools
run: pip install clang-format cmake-format[YAML] mypy ruff
- name: ruff .py files in C++ code
run: |
cd cpp/
ruff check .
ruff format --check .
- name: ruff Python interface checks
run: |
cd python/
ruff check .
ruff format --check .
- name: mypy checks
run: |
cd python/
mypy dolfinx
mypy demo
mypy test
- name: clang-format C++ checks
run: |
cd cpp
clang-format --version
find . -type f \( -name "*.cpp" -o -name "*.h" \) | xargs clang-format --dry-run --Werror
- name: clang-format Python binding checks
run: |
cd python/dolfinx/wrappers
clang-format --version
find . -type f \( -name "*.cpp" -o -name "*.h" \) | xargs clang-format --dry-run --Werror
- name: cmake-format (non-blocking)
continue-on-error: true
run: |
find . -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name "CMakeLists.txt" \) | xargs cmake-format --check
ccpp-build:
runs-on: ubuntu-24.04
needs: [lint]
env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Newer OpenMPI
OMPI_MCA_rmaps_base_oversubscribe: true # Older OpenMPI
PYTEST_ADDOPTS: "-W error"
name: Build and test
steps:
- uses: actions/checkout@v6
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install catch2 cmake g++ libblas-dev libboost-dev \
libhdf5-mpi-dev liblapack-dev libparmetis-dev libpugixml-dev \
libspdlog-dev libsuperlu-dist-dev mpi-default-dev ninja-build pkg-config
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install Python build dependencies
working-directory: python
run: |
pip install scikit-build-core setuptools
python -m scikit_build_core.build requires | python -c "import sys, json; print(' '.join(json.load(sys.stdin)))" | xargs pip install
- name: Install FEniCS Python components
run: |
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install -Ccmake.build-type="Developer" --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}
- name: Configure (C++)
working-directory: cpp
run: >
cmake -B build -S .
-Werror=dev
--warn-uninitialized
-G Ninja
-DCMAKE_BUILD_TYPE=Developer
-DBUILD_TESTING=true
-DDOLFINX_ENABLE_PETSC=false
-DDOLFINX_ENABLE_SUPERLU_DIST=true
-DDOLFINX_ENABLE_PARMETIS=true
- name: Build and install (C++)
working-directory: cpp/build
run: |
cmake --build .
sudo cmake --install .
- name: Run tests via target (C++, serial and parallel)
working-directory: cpp/build
run: cmake --build . --target test
- name: Build Python interface
run: |
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Developer" 'python/[test]'
python -c "from mpi4py import MPI; import dolfinx; assert not dolfinx.has_petsc; assert not dolfinx.has_petsc4py; assert dolfinx.has_superlu_dist"
- name: Run mypy # Use a venv to avoid NumPy upgrades that are incompatible with numba
working-directory: python
run: |
python -m venv mypy-env
. ./mypy-env/bin/activate
pip install mypy types-cffi scipy-stubs
mypy -p dolfinx
# mypy test
# mypy demo
- name: Install gmsh and pyvista (and dependencies)
run: |
sudo apt-get install libglu1-mesa libgl1 libxrender1 libxcursor1 libxft2 libxinerama1
sudo apt-get install libegl1
pip install gmsh pyvista
- name: Run demos (Python, serial)
run: |
pip install pytest-xdist
python -m pytest -n auto -m serial --durations=10 python/demo/test.py
- name: Run demos (Python, MPI, np=3)
run: python -m pytest -m mpi --num-proc=3 python/demo/test.py
- name: Run tests (Python, serial)
run: python -m pytest -n auto -m "not petsc4py and not adios2" python/test/unit
- name: Run tests (Python, MPI, np=3)
run: mpirun -np 3 python -m pytest -m "not petsc4py and not adios2" python/test/unit
ccpp-build-with-petsc:
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
petsc_arch: [linux-gnu-real32-32, linux-gnu-real64-32, linux-gnu-complex64-32, linux-gnu-complex128-32, linux-gnu-real64-64, linux-gnu-complex128-64]
docker_image: ["ghcr.io/fenics/test-env:current-openmpi"]
include:
- docker_image: "ghcr.io/fenics/test-env:current-mpich"
petsc_arch: linux-gnu-real64-32
- docker_image: "ghcr.io/fenics/test-env:current-mpich"
petsc_arch: linux-gnu-complex128-32
container: ${{ matrix.docker_image }}
env:
PETSC_ARCH: ${{ matrix.petsc_arch }}
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe
PYTEST_ADDOPTS: "-W error"
name: Build and test (${{ matrix.petsc_arch }}, ${{ matrix.docker_image }})
steps:
- uses: actions/checkout@v6
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Install Python build dependencies
working-directory: python
run: |
pip install scikit-build-core
python -m scikit_build_core.build requires | python -c "import sys, json; print(' '.join(json.load(sys.stdin)))" | xargs pip install
- name: Install FEniCS Python components
run: |
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install -Ccmake.build-type="Developer" --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}
- name: Configure (C++)
working-directory: cpp
run: >
cmake -B build -S .
-Werror=dev
--warn-uninitialized
-G Ninja
-DCMAKE_BUILD_TYPE=Developer
-DDOLFINX_ENABLE_ADIOS2=true
-DDOLFINX_ENABLE_KAHIP=true
-DDOLFINX_ENABLE_PETSC=true
-DDOLFINX_ENABLE_SCOTCH=true
-DDOLFINX_ENABLE_SLEPC=true
-DDOLFINX_ENABLE_PARMETIS=false
- name: Build and install (C++)
working-directory: cpp/build
run: cmake --build . --target install
- name: Build tests (C++, standalone)
working-directory: cpp/test
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Developer -GNinja
cmake --build build
- name: Run tests (C++, serial)
working-directory: cpp/test/build
run: ctest -V --output-on-failure -R unittests_np_1
- name: Run tests (C++, MPI, np=3)
working-directory: cpp/test/build
run: ctest -V --output-on-failure -R unittests_np_3
- name: Build and run C++ regression tests (serial and MPI (np=2))
run: |
cmake -Werror=dev --warn-uninitialized -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/demo/ -S cpp/demo/
cmake --build build/demo
cd build/demo
ctest -V -R demo -R serial
ctest --output-on-failure -V -R demo -R mpi_2
- name: Build Python interface
run: |
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Developer" 'python/[test]'
python -c "from mpi4py import MPI; import dolfinx; assert dolfinx.has_adios2; assert dolfinx.has_kahip; assert not dolfinx.has_parmetis; assert dolfinx.has_petsc; assert dolfinx.has_petsc4py; assert dolfinx.has_ptscotch; assert dolfinx.has_slepc; assert dolfinx.has_complex_ufcx_kernels"
- name: Run mypy # Use a venv to avoid NumPy upgrades that are incompatible with numba
working-directory: python
run: |
python -m venv mypy-env
. ./mypy-env/bin/activate
pip install mypy types-cffi scipy-stubs
mypy -p dolfinx
# mypy test
# mypy demo
- name: Numpy version
run: python -c "import numpy; print(numpy.__version__)"
- name: Set default DOLFINx JIT options
run: |
mkdir -p ~/.config/dolfinx
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
- name: Install pyvista (and dependencies)
run: |
apt-get install libegl1 libxrender1
pip install pyvista
- name: Run demos (Python, serial)
run: |
pip install pytest-xdist
python -m pytest -n auto -m serial --durations=10 python/demo/test.py
- name: Run demos (Python, MPI (np=3))
run: python -m pytest -m mpi --num-proc=3 python/demo/test.py
- name: Run Python unit tests (serial)
run: python -m pytest -m "petsc4py or adios2" -n=auto --durations=50 python/test/unit/
- name: Run Python unit tests (MPI, np=3)
run: mpirun -np 3 python -m pytest -m "petsc4py or adios2" python/test/unit/
build-and-publish-docs:
runs-on: ubuntu-latest
needs: [lint]
container: "ghcr.io/fenics/test-env:current-openmpi"
env:
PETSC_ARCH: linux-gnu-real64-32
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe
name: Build and publish docs
steps:
- uses: actions/checkout@v6
- name: Load environment variables
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Install Python build dependencies
working-directory: python
run: |
pip install scikit-build-core setuptools
python -m scikit_build_core.build requires | python -c "import sys, json; print(' '.join(json.load(sys.stdin)))" | xargs pip install
- name: Install FEniCS Python components
run: |
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
pip install --no-build-isolation git+https://github.com/${{ env.ffcx_repository }}.git@${{ env.ffcx_ref }}
- name: Configure C++
run: |
cmake -Werror=dev --warn-uninitialized -G Ninja -B build -S cpp/
cmake --build build
cmake --install build
- name: Build Python interface
run: |
pip install --check-build-dependencies --no-build-isolation 'python/[docs]'
- name: Build C++ interface documentation
run: |
export DOLFINX_VERSION=`cmake -L build | grep DOXYGEN_DOLFINX_VERSION | cut -f2 -d "="`
echo $DOLFINX_VERSION
cd cpp/doc
doxygen Doxyfile
make html
- name: Upload C++ Doxygen documentation artifact
uses: actions/upload-artifact@v7
with:
name: docs-cpp-doxygen
path: cpp/doc/html
retention-days: 2
- name: Upload C++ Sphinx documentation artifact
uses: actions/upload-artifact@v7
with:
name: docs-cpp-sphinx
path: cpp/doc/build/html
retention-days: 2
- name: Build Python interface documentation
run: |
cd python/doc
python -m sphinx -W -b html source/ build/html/
- name: Upload Python documentation artifact
uses: actions/upload-artifact@v7
with:
name: docs-python
path: python/doc/build/html
retention-days: 2
- name: Checkout FEniCS/docs
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
uses: actions/checkout@v6
with:
repository: "FEniCS/docs"
path: "docs"
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}"
- name: Set version name
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
run: |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Copy documentation into repository
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
run: |
cd docs
git rm -r --ignore-unmatch dolfinx/${{ env.VERSION_NAME }}/cpp
git rm -r --ignore-unmatch dolfinx/${{ env.VERSION_NAME }}/python
mkdir -p dolfinx/${{ env.VERSION_NAME }}/cpp
mkdir -p dolfinx/${{ env.VERSION_NAME }}/cpp/doxygen
mkdir -p dolfinx/${{ env.VERSION_NAME }}/python
cp -r ../cpp/doc/build/html/* dolfinx/${{ env.VERSION_NAME }}/cpp/
cp -r ../cpp/doc/html/* dolfinx/${{ env.VERSION_NAME }}/cpp/doxygen
cp -r ../python/doc/build/html/* dolfinx/${{ env.VERSION_NAME }}/python
- name: Commit and push documentation to FEniCS/docs
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
run: |
cd docs
git config --global user.email "fenics@github.com"
git config --global user.name "FEniCS GitHub Actions"
git add --all
git commit --allow-empty -m "C++/Python FEniCS/dolfinx@${{ github.sha }}"
git push