CI #2569
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: CI | |
on: | |
# Trigger tests on push | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# '*' is a special character in YAML, so string must be quoted | |
- cron: "0 1 * * *" | |
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 mypy ruff | |
- name: ruff checks | |
run: | | |
ruff format --check | |
ruff check | |
# - name: mypy checks | |
# run: | | |
# cd python/ | |
# mypy . --exclude=build | |
# - 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 | |
build: | |
name: Build and test | |
needs: lint | |
runs-on: ubuntu-latest | |
container: ghcr.io/fenics/test-env:current-mpich | |
# strategy: | |
# matrix: | |
# # Complex mode not working | |
# # run_mode: ["Release", "Debug"] | |
# petsc_mode: ["real"] | |
# petsc_precision: ["64"] | |
# petsc_int: ["32"] | |
env: | |
# PETSC_ARCH: linux-gnu-${{ matrix.petsc_mode }}${{ matrix.petsc_precision}}-${{ matrix.petsc_int }} | |
PETSC_ARCH: linux-gnu-real64-32 | |
# OMPI_ALLOW_RUN_AS_ROOT: 1 | |
# OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | |
# OMPI_MCA_rmaps_base_oversubscribe: 1 | |
# OMPI_MCA_plm: isolated | |
# OMPI_MCA_btl_vader_single_copy_mechanism: none | |
# OMPI_MCA_mpi_yield_when_idle: 1 | |
# OMPI_MCA_hwloc_base_binding_policy: none | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get DOLFINx | |
if: github.event_name != 'workflow_dispatch' | |
uses: actions/checkout@v4 | |
with: | |
path: ./dolfinx | |
repository: FEniCS/dolfinx | |
ref: main | |
- name: Build C++ docs | |
run: | | |
cd cpp/doc | |
doxygen | |
- name: Install DOLFINx | |
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 | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/ | |
cmake --build build | |
cmake --install build | |
pip install -r dolfinx/python/build-requirements.txt # TO REMOVE | |
pip -v install --check-build-dependencies --no-build-isolation dolfinx/python/ | |
- name: Install contact library (C++) | |
id: cpp-contact | |
run: | | |
export VERBOSE=1 | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build-contact -S cpp/ | |
ninja -C build-contact install | |
- name: Run demos (C++) | |
run: | | |
cd cpp/demos/ | |
cmake -G Ninja . | |
ninja | |
# | |
cp meshes/* . | |
# | |
./meshtie/demo_meshtie | |
mpirun -np 2 ./meshtie/demo_meshtie | |
# | |
./meshtieHeatEquation/demo_meshtie_heat | |
mpirun -np 2 ./meshtieHeatEquation/demo_meshtie_heat | |
# | |
./meshtieHeatTransfer/demo_meshtie_heattransfer | |
mpirun -np 2 ./meshtieHeatTransfer/demo_meshtie_heattransfer | |
# | |
./meshtieNewton/demo_meshtie_newton | |
mpirun -np 2 ./meshtieNewton/demo_meshtie_newton | |
- name: Install contact library (Python) | |
id: python-contact | |
run: | | |
pip -v install -r ./python/build-requirements.txt | |
pip -v install --no-build-isolation python/ | |
pip install scipy matplotlib pytest pytest-xdist | |
- name: Run demos (Python) | |
run: | | |
cd python/demos | |
pytest -v -n auto . | |
- name: Create output folders | |
id: output-creation | |
working-directory: ./python/demos | |
run: | | |
mkdir -p results | |
mkdir -p meshes | |
- name: Run unbiased demos | |
working-directory: ./python/demos | |
run: | | |
python demo_nitsche_unbiased.py --problem=1 | |
python demo_nitsche_unbiased.py --problem=2 --friction=0.1 | |
python demo_nitsche_unbiased.py --problem=3 | |
python demo_nitsche_unbiased.py --problem=3 --3D --friction=0.1 --coulomb | |
- name: Run meshties demos | |
working-directory: ./python/demos | |
run: | | |
python demo_nitsche_meshties.py | |
python meshtie_convergence.py --3D | |
python meshtie_convergence.py --simplex --3D | |
python meshtie_convergence.py | |
python meshtie_convergence.py --simplex --runs=4 | |
- name: Run Oxford demo | |
working-directory: ./python/demos/oxford | |
run: | |
python blocks_nitsche.py | |
cd ../meshtie_demos | |
python blocks_nitsche_meshtie.py | |
python poisson_convergence.py --simplex --runs=4 | |
python poisson_convergence.py --3D | |
python demo_poisson.py | |
- name: Run tests | |
run: | | |
pip install pytest pytest-xdist | |
cd python/tests | |
mkdir -p meshes | |
# python -m pytest . | |
python -m pytest -v -n auto --durations=50 --dist loadgroup . | |
- name: Run unbiased demos in parallel | |
working-directory: ./python/demos | |
run: | | |
mpirun -np 2 python demo_nitsche_unbiased.py --problem=1 | |
mpirun -np 2 python demo_nitsche_unbiased.py --problem=2 --friction=0.1 | |
mpirun -np 2 python demo_nitsche_unbiased.py --problem=3 | |
mpirun -np 2 python demo_nitsche_unbiased.py --problem=3 --3D --friction=0.1 --coulomb | |
- name: Run meshties demos in parallel | |
working-directory: ./python/demos | |
run: | | |
mpirun -np 2 python demo_nitsche_meshties.py | |
mpirun -np 2 python meshtie_convergence.py --3D | |
mpirun -np 2 python meshtie_convergence.py --simplex --3D | |
mpirun -np 2 python meshtie_convergence.py | |
mpirun -np 2 python meshtie_convergence.py --simplex --runs=4 |