Skip to content

Commit 06e90b8

Browse files
authored
General tidy and restrict cffi < 1.17 due to static condensation demo issue (#3343)
* CFFI 1.17 seems to have issues with numba. * Clean up RedHat build. * Can people stop adding optional dependencies in CI runs? * Tidy. * Tidy. * General tidying. * Fix. * Remove logguru exception * Tidy up Dockerfile. * Fix. * Install cython for petsc4py build * Setuptools * Tweaks. * Fix. * Always build docs once and only push if on DOLFINx with main or v* tag. * Add back documentation artifacts. * Fix. * Fix. * Fix. * Need these, not installed (!). * petsc4py needs numpy. * Split apart numba/cffi and petsc/cffi definitions * Missing cffi! * Revert. * Try unpinning CFFI. * Does seem to be necessary. * Improve docstring.
1 parent 1dd0396 commit 06e90b8

File tree

9 files changed

+107
-90
lines changed

9 files changed

+107
-90
lines changed

.github/workflows/ccpp.yml

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
name: Lint
3434
steps:
3535
- uses: actions/checkout@v4
36+
3637
- name: Set up Python
3738
uses: actions/setup-python@v5
3839
with:
@@ -60,7 +61,7 @@ jobs:
6061
run: |
6162
cd cpp
6263
clang-format --version
63-
find . -type f \( -name "*.cpp" -o -name "*.h" \) ! -name "loguru.cpp" | xargs clang-format --dry-run --Werror
64+
find . -type f \( -name "*.cpp" -o -name "*.h" \) | xargs clang-format --dry-run --Werror
6465
- name: clang-format Python binding checks (non-blocking)
6566
continue-on-error: true
6667
run: |
@@ -83,6 +84,8 @@ jobs:
8384

8485
name: Build and test
8586
steps:
87+
- uses: actions/checkout@v4
88+
8689
- name: Install dependencies
8790
run: |
8891
sudo apt-get update
@@ -93,7 +96,8 @@ jobs:
9396
python-version: "3.12"
9497

9598
- name: Install Python build dependencies
96-
run: pip install mpi4py nanobind scikit-build-core[pyproject] --upgrade
99+
run: |
100+
pip install --upgrade -r python/build-requirements.txt
97101
98102
- name: Install FEniCS Python components (default branches/tags)
99103
if: github.event_name != 'workflow_dispatch'
@@ -108,8 +112,6 @@ jobs:
108112
pip install git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }}
109113
pip install git+https://github.com/FEniCS/ffcx.git@${{ github.event.inputs.ffcx_ref }}
110114
111-
- uses: actions/checkout@v4
112-
113115
- name: Configure and install C++
114116
run: |
115117
cmake -G Ninja -DDOLFINX_ENABLE_PETSC=false -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/
@@ -129,12 +131,12 @@ jobs:
129131
mpirun -n 3 ctest -V --output-on-failure -R unittests
130132
131133
- name: Build Python interface
132-
run: pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/
134+
run: pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" 'python/[test]'
133135

134-
- name: Install Python demo/test dependencies
135-
run: pip install matplotlib pyamg pytest pytest-xdist scipy
136136
- name: Run demos (Python, serial)
137-
run: python -m pytest -n auto -m serial --durations=10 python/demo/test.py
137+
run: |
138+
pip install pytest-xdist
139+
python -m pytest -n auto -m serial --durations=10 python/demo/test.py
138140
- name: Run demos (Python, MPI (np=3))
139141
run: python -m pytest -m mpi --num-proc=3 python/demo/test.py
140142
- name: Run unit tests
@@ -165,9 +167,6 @@ jobs:
165167
steps:
166168
- uses: actions/checkout@v4
167169

168-
- name: Install required Python packages (docs)
169-
run: pip install breathe jupytext matplotlib myst_parser sphinx sphinx_rtd_theme
170-
171170
- name: Install FEniCS Python components (default branches/tags)
172171
if: github.event_name != 'workflow_dispatch'
173172
run: |
@@ -188,14 +187,6 @@ jobs:
188187
cmake --build build
189188
cmake --install build
190189
191-
- name: Build C++ interface documentation
192-
run: |
193-
export DOLFINX_VERSION=`cmake -L build | grep DOXYGEN_DOLFINX_VERSION | cut -f2 -d "="`
194-
echo $DOLFINX_VERSION
195-
cd cpp/doc
196-
doxygen Doxyfile
197-
make html
198-
199190
- name: Build C++ unit tests
200191
run: |
201192
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/
@@ -216,26 +207,22 @@ jobs:
216207
ctest -V -R demo -R serial
217208
ctest -V -R demo -R mpi_2
218209
219-
- name: Install required Python (build Python interface)
220-
run: pip install nanobind scikit-build-core[pyproject]
210+
- name: Install Python build dependencies
211+
run: pip install -r python/build-requirements.txt
221212

222213
- name: Build Python interface
223214
run: |
224-
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/
225-
- name: Build Python interface documentation
226-
run: |
227-
cd python/doc
228-
python -m sphinx -W -b html source/ build/html/
215+
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" 'python/[test]'
229216
230217
- name: Set default DOLFINx JIT options
231218
run: |
232219
mkdir -p ~/.config/dolfinx
233220
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
234221
235-
- name: Install Python demo/test dependencies
236-
run: pip install numba pyamg pytest pytest-xdist scipy
237222
- name: Run demos (Python, serial)
238-
run: python -m pytest -n auto -m serial --durations=10 python/demo/test.py
223+
run: |
224+
pip install pytest-xdist
225+
python -m pytest -n auto -m serial --durations=10 python/demo/test.py
239226
- name: Run demos (Python, MPI (np=3))
240227
run: python -m pytest -m mpi --num-proc=3 python/demo/test.py
241228

@@ -244,9 +231,7 @@ jobs:
244231
- name: Run Python unit tests (MPI, np=3)
245232
run: mpirun -np 3 python -m pytest -m "petsc4py or adios2" python/test/unit/
246233

247-
publish-docs:
248-
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
249-
needs: build-with-petsc
234+
build-and-publish-docs:
250235
runs-on: ubuntu-latest
251236
container: "ghcr.io/fenics/test-env:current-openmpi"
252237
env:
@@ -255,13 +240,10 @@ jobs:
255240
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
256241
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe
257242

258-
name: Publish docs
243+
name: Build and publish docs
259244
steps:
260245
- uses: actions/checkout@v4
261246

262-
- name: Install required Python packages (docs)
263-
run: pip install breathe jupytext matplotlib myst_parser sphinx sphinx_rtd_theme
264-
265247
- name: Install FEniCS Python components (default branches/tags)
266248
if: github.event_name != 'workflow_dispatch'
267249
run: |
@@ -281,34 +263,55 @@ jobs:
281263
cmake --build build
282264
cmake --install build
283265
266+
- name: Build Python interface
267+
run: |
268+
pip install -r python/build-requirements.txt
269+
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" 'python/[docs]'
270+
284271
- name: Build C++ interface documentation
285272
run: |
286273
export DOLFINX_VERSION=`cmake -L build | grep DOXYGEN_DOLFINX_VERSION | cut -f2 -d "="`
287274
echo $DOLFINX_VERSION
288275
cd cpp/doc
289276
doxygen Doxyfile
290277
make html
291-
292-
- name: Install required Python (build Python interface)
293-
run: pip install nanobind scikit-build-core[pyproject]
294-
295-
- name: Build Python interface
296-
run: pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/
278+
- name: Upload C++ Doxygen documentation artifact
279+
uses: actions/upload-artifact@v4
280+
with:
281+
name: docs-cpp-doxygen
282+
path: cpp/doc/html
283+
retention-days: 2
284+
- name: Upload C++ Sphinx documentation artifact
285+
uses: actions/upload-artifact@v4
286+
with:
287+
name: docs-cpp-sphinx
288+
path: cpp/doc/build/html
289+
retention-days: 2
290+
297291
- name: Build Python interface documentation
298292
run: |
299293
cd python/doc
300294
python -m sphinx -W -b html source/ build/html/
295+
- name: Upload Python documentation artifact
296+
uses: actions/upload-artifact@v4
297+
with:
298+
name: docs-python
299+
path: python/doc/build/html
300+
retention-days: 2
301301

302302
- name: Checkout FEniCS/docs
303+
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
303304
uses: actions/checkout@v4
304305
with:
305306
repository: "FEniCS/docs"
306307
path: "docs"
307308
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}"
308309
- name: Set version name
310+
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
309311
run: |
310312
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
311313
- name: Copy documentation into repository
314+
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
312315
run: |
313316
cd docs
314317
git rm -r --ignore-unmatch dolfinx/${{ env.VERSION_NAME }}/cpp
@@ -320,6 +323,7 @@ jobs:
320323
cp -r ../cpp/doc/html/* dolfinx/${{ env.VERSION_NAME }}/cpp/doxygen
321324
cp -r ../python/doc/build/html/* dolfinx/${{ env.VERSION_NAME }}/python
322325
- name: Commit and push documentation to FEniCS/docs
326+
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
323327
run: |
324328
cd docs
325329
git config --global user.email "[email protected]"

.github/workflows/macos.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ jobs:
2525
brew install adios2 boost cmake hdf5-mpi make ninja open-mpi pkg-config pugixml spdlog # FEniCS
2626
brew install bison flex gfortran # PETSc
2727
28-
- name: Install Python dependencies
28+
- name: Install Python dependencies (petsc4py)
2929
run: |
30-
python -m pip install --upgrade pip setuptools wheel
31-
python -m pip install cffi cppimport cython numba numpy pytest pytest-xdist scipy
32-
python -m pip install --no-build-isolation mpi4py
30+
python -m pip install mpi4py numpy
31+
python -m pip install cython setuptools wheel
3332
3433
- name: Install minimal PETSc and petsc4py
3534
run: |
@@ -91,7 +90,7 @@ jobs:
9190
working-directory: dolfinx
9291
run: |
9392
python -m pip install -r python/build-requirements.txt
94-
python -m pip install --check-build-dependencies --no-build-isolation python/
93+
python -m pip install --check-build-dependencies --no-build-isolation 'python/[test]'
9594
9695
- name: Basic test
9796
run: |
@@ -100,7 +99,10 @@ jobs:
10099
101100
- name: Run Python unit tests (serial)
102101
working-directory: dolfinx
103-
run: python3 -m pytest -n=auto --durations=50 python/test/unit/
102+
run: |
103+
python -m pip install pytest-xdist
104+
python3 -m pytest -n=auto --durations=50 python/test/unit/
104105
- name: Run Python unit tests (MPI, np=3)
105106
working-directory: dolfinx
106-
run: mpirun -np 3 python3 -m pytest python/test/unit/
107+
run: |
108+
mpirun -np 3 python3 -m pytest python/test/unit/

.github/workflows/pyvista.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ jobs:
3838

3939
- name: Install FEniCS Python components
4040
run: |
41-
python3 -m pip install git+https://github.com/FEniCS/ufl.git
42-
python3 -m pip install git+https://github.com/FEniCS/basix.git
43-
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
41+
pip install git+https://github.com/FEniCS/ufl.git
42+
pip install git+https://github.com/FEniCS/basix.git
43+
pip install git+https://github.com/FEniCS/ffcx.git
4444
apt-get update
4545
apt-get install -y --no-install-recommends libgl1-mesa-dev xvfb # pyvista
4646
apt-get install -y --no-install-recommends libqt5gui5t64 libgl1 # pyvistaqt
47-
python3 -m pip install pyvista==${PYVISTA_VERSION}
48-
python3 -m pip install pyqt5 pyvistaqt==${PYVISTA_QT_VERSION}
49-
python3 -m pip install matplotlib ipython nanobind scikit-build-core[pyproject] pytest pytest-xdist scipy numba
47+
pip install pyvista==${PYVISTA_VERSION}
48+
pip install pyqt5 pyvistaqt==${PYVISTA_QT_VERSION}
49+
pip install --no-build-isolation -r python/build-requirements.txt
5050
5151
- name: Configure C++
5252
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/
@@ -56,10 +56,12 @@ jobs:
5656
cmake --install build
5757
5858
- name: Build Python interface
59-
run: pip -v install --check-build-dependencies --config-settings=build-dir="build" --config-settings=cmake.build-type="Debug" --no-build-isolation python/
59+
run: pip -v install --check-build-dependencies --config-settings=build-dir="build" --config-settings=cmake.build-type="Debug" --no-build-isolation 'python/[test]'
6060

6161
- name: Run pyvista demos (Python, serial)
62-
run: python3 -m pytest -v -n 2 -m serial --durations=10 python/demo/test.py
62+
run: |
63+
pip install pytest-xdist
64+
python3 -m pytest -v -n 2 -m serial --durations=10 python/demo/test.py
6365
6466
- name: Run pyvista demos (Python, MPI (np=2))
6567
run: python3 -m pytest -v -m mpi --num-proc=2 python/demo/test.py

.github/workflows/redhat.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v4
2626

27-
- name: Install Python dependencies
27+
- name: Install Python build dependencies
2828
run: |
29-
python3 -m pip install mpi4py nanobind scikit-build-core[pyproject] --upgrade
29+
python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
3030
3131
- name: Install FEniCS Python components
3232
run: |
33-
python3 -m pip install --no-cache-dir --upgrade pip setuptools
3433
python3 -m pip install git+https://github.com/FEniCS/ufl.git
3534
python3 -m pip install git+https://github.com/FEniCS/basix.git
3635
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
@@ -64,21 +63,20 @@ jobs:
6463
6564
- name: Install Python dependencies
6665
run: |
67-
python3 -m pip install cffi==1.16.0 numba scikit-build-core[pyproject] pytest pytest-xdist scipy matplotlib
6866
- name: Build Python interface (editable install)
6967
run: |
70-
python3 -m pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type=Debug --config-settings=build-dir="build" -e python/
68+
python3 -m pip install --upgrade -r python/build-requirements.txt
69+
python3 -m pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type=Debug --config-settings=build-dir="build" -e 'python/[test]'
7170
7271
- name: Set default DOLFINx JIT options
7372
run: |
7473
mkdir -p ~/.config/dolfinx
7574
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
7675
77-
- name: Install test Python dependencies
78-
run: python3 -m pip install matplotlib numba pytest pytest-xdist scipy
79-
8076
- name: Run demos (Python, serial)
81-
run: python3 -m pytest -n auto -m serial --durations=10 python/demo/test.py
77+
run: |
78+
python3 -m pip install pytest-xdist
79+
python3 -m pytest -n auto -m serial --durations=10 python/demo/test.py
8280
- name: Run demos (Python, MPI (np=2))
8381
run: python3 -m pytest -m mpi --num-proc=2 python/demo/test.py
8482

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ jobs:
5858
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
5959
- name: Install FEniCS Python components
6060
run: |
61-
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ufl.git
62-
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/basix.git
63-
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ffcx.git
61+
python3 -m pip install git+https://github.com/FEniCS/ufl.git
62+
python3 -m pip install git+https://github.com/FEniCS/basix.git
63+
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
6464
- name: Run build-wrapper
6565
run: |
6666
mkdir build

.github/workflows/windows.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ jobs:
6060
6161
- name: Install build dependencies (workaround)
6262
run: |
63-
python -m pip install scikit-build-core[pyproject] git+https://github.com/jhale/nanobind.git@jhale/msvc2022-workaround setuptools wheel
63+
python -m pip install git+https://github.com/jhale/nanobind.git@jhale/msvc2022-workaround
64+
python -m pip install scikit-build-core[pyproject] setuptools wheel
6465
- name: Install Basix (Python)
6566
working-directory: basix
6667
run: |
6768
cd python
68-
python -m pip -v install --no-build-isolation --no-cache-dir .[ci] --config-settings=cmake.args=-DBasix_DIR=D:/a/basix/install/lib/cmake/basix
69+
python -m pip -v install --check-build-dependencies --no-build-isolation --no-cache-dir .[ci] --config-settings=cmake.args=-DBasix_DIR=D:/a/basix/install/lib/cmake/basix
6970
cd ../
7071
7172
- name: Checkout FFCx
@@ -140,6 +141,7 @@ jobs:
140141
- name: Run units tests (Python, serial)
141142
working-directory: dolfinx
142143
run: |
144+
pip install pytest-xdist
143145
python -m pytest -n auto -m "not petsc4py and not adios2" python/test/unit
144146
- name: Run units tests (Python, MPI, np=3)
145147
working-directory: dolfinx
@@ -149,7 +151,6 @@ jobs:
149151
- name: Run Python demos (serial)
150152
working-directory: dolfinx
151153
run: |
152-
pip install pyamg matplotlib numba scipy # TO REMOVE
153154
cd python/demo
154155
python3 -m pytest -n auto -m serial --durations=10 test.py
155156
- name: Run Python demos (MPI, np=3)

0 commit comments

Comments
 (0)