Skip to content

ngsPETSc tests

ngsPETSc tests #1207

Workflow file for this run

# .github/workflows/app.yaml
name: ngsPETSc tests
on:
pull_request:
types: [synchronize]
push:
branches-ignore:
- 'no-ci/*'
schedule:
- cron: '30 10 7,14,21,28 * *'
workflow_dispatch:
# The package version is derived from git tags at build time by
# poetry-dynamic-versioning. CI checkouts are shallow, tag-less and run inside
# containers where git refuses the working tree ("dubious ownership"), so a
# plain `pip install .` would fail version detection. Bypass it here: the
# version is irrelevant for linting and testing.
env:
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
jobs:
lint:
runs-on: ubuntu-latest
container: urzerbinati/ngspetsc:latest
timeout-minutes: 3
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install ngsPETSc
run: |
python -m pip install .
pip install pylint
- name: Lint
run: |
make lint GITHUB_ACTIONS_FORMATTING=1
make lint_test GITHUB_ACTIONS_FORMATTING=1
ngsolve:
runs-on: ubuntu-latest
container: urzerbinati/ngspetsc:latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
# Download ngsPETSc into a subdirectory not called 'ngsPETSc' to make sure
# that the package installs correctly. Otherwise 'import ngsPETSc' may
# work even if the installation failed because it is a subdirectory.
path: ngspetsc-repo
- name: Create virtual environment
# pass '--system-site-packages' so ngsolve can be found
run: python3 -m venv --system-site-packages venv-ngspetsc
- name: Install ngsPETSc
run: |
. venv-ngspetsc/bin/activate
pip install --no-deps './ngspetsc-repo'
pip list
- name: Run test suite in serial
run: |
. venv-ngspetsc/bin/activate
cd ngspetsc-repo
python -m pytest -v tests/test_env.py
python -m pytest -v tests/test_vec.py
python -m pytest -v tests/test_mat.py
python -m pytest -v tests/test_plex.py
python -m pytest -v tests/test_ksp.py
python -m pytest -v tests/test_pc.py
python -m pytest -v tests/test_eps.py
python -m pytest -v tests/test_snes.py
- name: Run test suite in parallel
run: |
. venv-ngspetsc/bin/activate
cd ngspetsc-repo
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_env.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_vec.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_mat.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_plex.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_ksp.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_pc.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_eps.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_snes.py
firedrake:
runs-on: ubuntu-latest
container:
image: firedrakeproject/firedrake-vanilla-default:dev-main
options: --user root
timeout-minutes: 50
steps:
- name: Fix HOME
# For unknown reasons GitHub actions overwrite HOME to /github/home
# which will break everything unless fixed
# (https://github.com/actions/runner/issues/863)
run: echo "HOME=/home/firedrake" >> "$GITHUB_ENV"
- name: Pre-cleanup
run: |
: # Wipe everything away in the current directory
find . -delete
firedrake-clean
- uses: actions/checkout@v4
with:
# Download ngsPETSc into a subdirectory not called 'ngsPETSc' to make sure
# that the package installs correctly. Otherwise 'import ngsPETSc' may
# work even if the installation failed because it is a subdirectory.
path: ngspetsc-repo
- name: Create virtual environment
# pass '--system-site-packages' so Firedrake can be found
run: python3 -m venv --system-site-packages venv-ngspetsc
- name: Install dependencies
run: |
. venv-ngspetsc/bin/activate
pip install --no-build-isolation xdist pytest-timeout ipympl poetry
pip install --no-build-isolation mpi4py randomgen numpy slepc4py
pip install --no-build-isolation netgen-mesher netgen-occt
- name: Install ngsPETSc
run: |
. venv-ngspetsc/bin/activate
pip install --no-deps './ngspetsc-repo'
pip list
- name: Run part of the Firedrake test suite
run: |
. venv-ngspetsc/bin/activate
cd /opt/firedrake
python -m pytest -vs -m parallel[1] tests/firedrake/regression/test_poisson_strong_bcs.py
python -m pytest -vs -m parallel[1] tests/firedrake/regression/test_netgen.py
python -m pytest -vs -m parallel[1] tests/firedrake/multigrid/test_netgen_gmg.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/regression/test_poisson_strong_bcs.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/regression/test_netgen.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/multigrid/test_netgen_gmg.py
firedrake-complex:
runs-on: ubuntu-latest
container:
image: firedrakeproject/firedrake-vanilla-complex:dev-main
options: --user root
timeout-minutes: 50
steps:
- name: Fix HOME
# For unknown reasons GitHub actions overwrite HOME to /github/home
# which will break everything unless fixed
# (https://github.com/actions/runner/issues/863)
run: echo "HOME=/home/firedrake" >> "$GITHUB_ENV"
- name: Pre-cleanup
run: |
: # Wipe everything away in the current directory
find . -delete
firedrake-clean
- uses: actions/checkout@v4
with:
# Download ngsPETSc into a subdirectory not called 'ngsPETSc' to make sure
# that the package installs correctly. Otherwise 'import ngsPETSc' may
# work even if the installation failed because it is a subdirectory.
path: ngspetsc-repo
- name: Create virtual environment
# pass '--system-site-packages' so Firedrake can be found
run: python3 -m venv --system-site-packages venv-ngspetsc
- name: Install dependencies
run: |
. venv-ngspetsc/bin/activate
pip install --no-build-isolation xdist pytest-timeout ipympl poetry
pip install --no-build-isolation mpi4py randomgen numpy slepc4py
pip install --no-build-isolation netgen-mesher netgen-occt
- name: Install ngsPETSc
run: |
. venv-ngspetsc/bin/activate
pip install --no-deps './ngspetsc-repo'
pip list
- name: Run part of the Firedrake test suite
run: |
. venv-ngspetsc/bin/activate
cd /opt/firedrake
python -m pytest -vs -m parallel[1] tests/firedrake/regression/test_poisson_strong_bcs.py
python -m pytest -vs -m parallel[1] tests/firedrake/regression/test_netgen.py
python -m pytest -vs -m parallel[1] tests/firedrake/multigrid/test_netgen_gmg.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/regression/test_poisson_strong_bcs.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/regression/test_netgen.py
mpirun --allow-run-as-root -n 2 python -m pytest -vs -m parallel[2] tests/firedrake/multigrid/test_netgen_gmg.py
fenicsx-stable:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["v0.10.0-r1", "stable"]
container:
image: ghcr.io/fenics/dolfinx/dolfinx:${{ matrix.version }}
timeout-minutes: 10 # FIXME: Reduce this once we don't need to install petsc4py
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Install Netgen and ngsPETSc
run: |
python3 -m pip install --no-build-isolation pytest poetry
python3 -m pip install . --check-build-dependencies --no-build-isolation
- name: Run tests (serial)
run: |
python3 -m pytest -vs ./tests/test_fenicsx.py
- name: Run tests (mpi)
run: |
mpirun -n 2 python3 -m pytest -vs ./tests/test_fenicsx.py
fenicsx-nightly:
runs-on: ubuntu-latest
container:
image: ghcr.io/fenics/dolfinx/dolfinx:nightly
timeout-minutes: 5
steps:
- name: Check out repository code
uses: actions/checkout@v5
- name: Install Netgen and ngsPETSc
run: |
python3 -m pip install --no-build-isolation pytest poetry
python3 -m pip install . --check-build-dependencies --no-build-isolation
- name: Run tests (serial)
run: |
mpirun -n 2 python3 -m pytest -vs ./tests/test_fenicsx.py