Bump Python version in complex kernel to 3.12 (#3199) #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DOLFINx CI | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
ffcx_ref: | |
description: "FFCx branch or tag" | |
default: "main" | |
type: string | |
basix_ref: | |
description: "Basix branch or tag" | |
default: "main" | |
type: string | |
ufl_ref: | |
description: "UFL branch or tag" | |
default: "main" | |
type: string | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- 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 (non-blocking) | |
continue-on-error: true | |
run: | | |
cd cpp | |
clang-format --version | |
find . -type f \( -name "*.cpp" -o -name "*.h" \) ! -name "loguru.cpp" | xargs clang-format --dry-run --Werror | |
- name: clang-format Python binding checks (non-blocking) | |
continue-on-error: true | |
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 | |
build: | |
runs-on: ubuntu-latest | |
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 | |
name: Build and test | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get install catch2 cmake g++ libboost-dev libboost-filesystem-dev libboost-timer-dev libhdf5-mpi-dev libparmetis-dev libpugixml-dev mpi-default-dev ninja-build pkg-config | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install FEniCS Python components (default branches/tags) | |
if: github.event_name != 'workflow_dispatch' | |
run: | | |
pip install git+https://github.com/FEniCS/ufl.git | |
pip install git+https://github.com/FEniCS/basix.git | |
pip install git+https://github.com/FEniCS/ffcx.git | |
- name: Install FEniCS Python components | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
pip install git+https://github.com/FEniCS/ufl.git@${{ github.event.inputs.ufl_ref }} | |
pip install git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }} | |
pip install git+https://github.com/FEniCS/ffcx.git@${{ github.event.inputs.ffcx_ref }} | |
- uses: actions/checkout@v4 | |
- name: Configure and install C++ | |
run: | | |
cmake -G Ninja -DDOLFINX_ENABLE_PETSC=false -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/ | |
cmake --build build | |
sudo cmake --install build | |
- name: Build C++ unit tests | |
run: | | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/ | |
cmake --build build/test --parallel 3 | |
- name: Run C++ unit tests (serial) | |
run: | | |
cd build/test | |
ctest -V --output-on-failure -R unittests | |
- name: Run C++ unit tests (MPI) | |
run: | | |
cd build/test | |
mpirun -n 3 ctest -V --output-on-failure -R unittests | |
- name: Install Python build dependencies | |
run: pip install mpi4py nanobind scikit-build-core[pyproject] | |
- name: Build Python interface | |
run: pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/ | |
- name: Install Python test dependencies | |
run: pip install matplotlib pytest pytest-xdist scipy | |
- name: Run demos | |
run: | | |
python python/demo/demo_interpolation-io.py | |
python python/demo/demo_lagrange_variants.py | |
- name: Run unit tests | |
run: python -m pytest -n auto -m "not petsc4py and not adios2" python/test/unit | |
- name: Run unit tests (MPI, np=3) | |
run: mpirun -np 3 python -m pytest -m "not petsc4py and not adios2" python/test/unit | |
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 | |
name: Build and test (${{ matrix.petsc_arch }}, ${{ matrix.docker_image }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install FEniCS Python components (default branches/tags) | |
if: github.event_name != 'workflow_dispatch' | |
run: | | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ufl.git | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/basix.git | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ffcx.git | |
- name: Install FEniCS Python components | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ufl.git@${{ github.event.inputs.ufl_ref }} | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }} | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ffcx.git@${{ github.event.inputs.ffcx_ref }} | |
- name: Configure C++ | |
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/ | |
- name: Build and install C++ library | |
run: | | |
cmake --build build | |
cmake --install build | |
- 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: Build C++ unit tests | |
run: | | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/ | |
cmake --build build/test --parallel 3 | |
- name: Run C++ unit tests (serial) | |
run: | | |
cd build/test | |
ctest -V --output-on-failure -R unittests | |
- name: Run C++ unit tests (MPI) | |
run: | | |
cd build/test | |
mpirun -n 3 ctest -V --output-on-failure -R unittests | |
- name: Build and run C++ regression tests (serial and MPI (np=2)) | |
run: | | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/demo/ -S cpp/demo/ | |
cmake --build build/demo --parallel 3 | |
cd build/demo | |
ctest -V -R demo -R serial | |
ctest -V -R demo -R mpi_2 | |
- name: Build Python interface | |
run: | | |
python3 -m pip install --break-system-packages --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/ | |
- name: Build Python interface documentation | |
run: | | |
cd python/doc | |
python3 -m sphinx -W -b html source/ build/html/ | |
- 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: Run demos (Python, serial) | |
run: python3 -m pytest -n auto -m serial --durations=10 python/demo/test.py | |
- name: Run demos (Python, MPI (np=3)) | |
run: python3 -m pytest -m mpi --num-proc=3 python/demo/test.py | |
- name: Run Python unit tests (serial) | |
run: python3 -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 python3 -m pytest -m "petsc4py or adios2" python/test/unit/ | |
publish-docs: | |
if: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} | |
needs: build-with-petsc | |
runs-on: ubuntu-latest | |
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: Publish docs | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install FEniCS Python components (default branches/tags) | |
if: github.event_name != 'workflow_dispatch' | |
run: | | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ufl.git | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/basix.git | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ffcx.git | |
- name: Install FEniCS Python components | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ufl.git@${{ github.event.inputs.ufl_ref }} | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }} | |
python3 -m pip install --break-system-packages git+https://github.com/FEniCS/ffcx.git@${{ github.event.inputs.ffcx_ref }} | |
- name: Configure C++ | |
run: | | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S cpp/ | |
cmake --build build | |
cmake --install build | |
- 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: Build Python interface | |
run: | | |
python3 -m pip install --break-system-packages --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" python/ | |
- name: Build Python interface documentation | |
run: | | |
cd python/doc | |
python3 -m sphinx -W -b html source/ build/html/ | |
- name: Checkout FEniCS/docs | |
uses: actions/checkout@v4 | |
with: | |
repository: "FEniCS/docs" | |
path: "docs" | |
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}" | |
- name: Set version name | |
run: | | |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Copy documentation into repository | |
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 | |
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 | |