Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
jhale committed Oct 9, 2024
2 parents 38260c0 + b0f9734 commit 1d2e439
Show file tree
Hide file tree
Showing 47 changed files with 765 additions and 1,655 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://upload.pypi.org/legacy/
repository-url: https://upload.pypi.org/legacy/
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ github.event.inputs.test_pypi_publish == 'true' }}
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
17 changes: 11 additions & 6 deletions .github/workflows/dolfinx-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ jobs:
- name: Install UFL and Basix (default branches/tags)
if: github.event_name != 'workflow_dispatch'
run: |
python3 -m pip install git+https://github.com/FEniCS/ufl.git
python3 -m pip install git+https://github.com/FEniCS/basix.git
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
- name: Install UFL and Basix (specified branches/tags)
if: github.event_name == 'workflow_dispatch'
run: |
python3 -m pip install git+https://github.com/FEniCS/ufl.git@${{ github.event.inputs.ufl_ref }}
python3 -m pip install git+https://github.com/FEniCS/basix.git@${{ github.event.inputs.basix_ref }}
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 }}
- name: Install FFCx
run: |
pip3 install .
pip3 install --break-system-packages .
- name: Get DOLFINx source (default branch/tag)
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
Expand All @@ -65,7 +65,9 @@ jobs:
cmake --build build
cmake --install build
- name: Install DOLFINx (Python)
run: python3 -m pip -v install --check-build-dependencies --no-build-isolation dolfinx/python/
run: |
python3 -m pip -v install --break-system-packages nanobind scikit-build-core[pyproject]
python3 -m pip -v install --break-system-packages --check-build-dependencies --no-build-isolation dolfinx/python/
- name: Build DOLFINx C++ unit tests
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S dolfinx/cpp/test/
Expand All @@ -74,6 +76,9 @@ jobs:
run: |
cd build/test
ctest -V --output-on-failure -R unittests
- name: Install Python demo/test dependencies
run: python3 -m pip install --break-system-packages matplotlib numba pyamg pytest pytest-xdist scipy
- name: Run DOLFINx Python unit tests
run: python3 -m pytest -n auto dolfinx/python/test/unit
- name: Run DOLFINx Python demos
Expand Down
48 changes: 43 additions & 5 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,73 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
include:
- os: macos-latest
python-version: '3.12'

steps:
- name: Checkout FFCx
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Export GitHub Actions cache environment variables (Windows)
if: runner.os == 'Windows'
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install dependencies (non-Python, Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y graphviz libgraphviz-dev ninja-build pkg-config
- name: Install dependencies (non-Python, macOS)
if: runner.os == 'macOS'
run: brew install graphviz ninja pkg-config
- name: Install FEniCS dependencies (Python)
run: brew install ninja pkg-config

- name: Install FEniCS dependencies (Python, Unix)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
pip install git+https://github.com/FEniCS/ufl.git
pip install git+https://github.com/FEniCS/basix.git
- name: Install FFCx
- name: Install FEniCS dependencies (Python, Windows)
if: runner.os == 'Windows'
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: |
pip install git+https://github.com/FEniCS/ufl.git
pip install -v git+https://github.com/FEniCS/basix.git --config-settings=cmake.args=-DINSTALL_RUNTIME_DEPENDENCIES=ON --config-settings=cmake.args=-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Install FFCx (Linux, with optional dependencies)
if: runner.os == 'Linux'
run: pip install .[ci,optional]
- name: Install FFCx (macOS, Windows)
if: runner.os != 'Linux'
run: pip install .[ci]

- name: Static check with mypy
run: mypy ffcx/
if: matrix.python-version != '3.12'
- name: ruff checks
run: |
ruff check .
ruff format --check .
- name: Run units tests
run: python -m pytest -n auto --cov=ffcx/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/

- name: Upload to Coveralls
if: ${{ github.repository == 'FEniCS/ffcx' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: coveralls
continue-on-error: true

- name: Upload pytest results
uses: actions/upload-artifact@v4
with:
Expand All @@ -65,10 +97,15 @@ jobs:
# Use always() to always run this step to publish test results
# when there are test failures
if: always()

- name: Setup cl.exe (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Run FFCx demos
run: |
pytest demo/test_demos.py
rm -Rf ufl/
- name: Build documentation
run: |
cd doc
Expand All @@ -80,6 +117,7 @@ jobs:
path: doc/build/html/
retention-days: 2
if-no-files-found: error

- name: Checkout FEniCS/docs
if: ${{ github.repository == 'FEniCS/ffcx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.8 }}
uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
spack env create ffcx-main
spack env activate ffcx-main
spack add py-fenics-ffcx@main
spack install --test=root
spack install
# spack install --test=root
- name: Install FFCx and run tests
if: github.event_name == 'workflow_dispatch'
Expand All @@ -64,4 +65,5 @@ jobs:
spack env create ffcx-testing
spack env activate ffcx-testing
spack add py-fenics-ffcx@${{ github.event.inputs.ffcx_version }}
spack install --test=root
spack install
# spack install --test=root
4 changes: 2 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.19)

project(ufcx VERSION 0.8.0 DESCRIPTION "UFCx interface header for finite element kernels"
project(ufcx VERSION 0.9.0 DESCRIPTION "UFCx interface header for finite element kernels"
LANGUAGES C
HOMEPAGE_URL https://github.com/fenics/ffcx)
include(GNUInstallDirs)
Expand All @@ -9,6 +9,7 @@ file(SHA1 ${PROJECT_SOURCE_DIR}/../ffcx/codegeneration/ufcx.h UFCX_HASH)
message("Test hash: ${UFCX_HASH}")

add_library(${PROJECT_NAME} INTERFACE)
target_compile_features(${PROJECT_NAME} INTERFACE c_std_17)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include>
Expand Down Expand Up @@ -39,4 +40,3 @@ install(FILES ${PROJECT_SOURCE_DIR}/../ffcx/codegeneration/ufcx.h TYPE INCLUDE)
# Configure and install pkgconfig file
configure_file(ufcx.pc.in ufcx.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/ufcx.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)

2 changes: 1 addition & 1 deletion demo/ExpressionInterpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
powq = 3 * q**2

# Extract basix cell type
b_cell = basix.cell.string_to_type(cell)
b_cell = basix.CellType[cell]

# Find quadrature points for quadrature element
b_rule = basix.quadrature.string_to_type(q_rule)
Expand Down
54 changes: 38 additions & 16 deletions demo/test_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
@pytest.mark.parametrize("scalar_type", ["float64", "float32", "complex128", "complex64"])
def test_demo(file, scalar_type):
"""Test a demo."""
if sys.platform.startswith("win32") and "complex" in scalar_type:
# Skip complex demos on win32
pytest.skip(reason="_Complex not supported on Windows")

if file in [
"MixedGradient",
"TraceElement", # HDiv Trace
Expand All @@ -25,29 +29,47 @@ def test_demo(file, scalar_type):
"_TensorProductElement",
]:
# Skip demos that use elements not yet implemented in Basix
pytest.skip()
pytest.skip(reason="Element not yet implemented in Basix")

if "complex" in scalar_type and file in [
"BiharmonicHHJ",
"BiharmonicRegge",
"StabilisedStokes",
]:
# Skip demos that are not implemented for complex scalars
pytest.skip()
pytest.skip(reason="Not implemented for complex types")
elif "Complex" in file and scalar_type in ["float64", "float32"]:
# Skip demos that are only implemented for complex scalars
pytest.skip()

opts = f"--scalar_type {scalar_type}"
extra_flags = "-Wunused-variable -Werror -fPIC "
assert os.system(f"cd {demo_dir} && ffcx {opts} {file}.py") == 0
assert (
os.system(
f"cd {demo_dir} && "
"CPATH=../ffcx/codegeneration/ "
f"gcc -I/usr/include/python{sys.version_info.major}.{sys.version_info.minor} "
f"{extra_flags} "
f"-shared {file}.c -o {file}.so"
pytest.skip(reason="Not implemented for real types")

if sys.platform.startswith("win32"):
opts = f"--scalar_type {scalar_type}"
extra_flags = "/std:c17"
assert os.system(f"cd {demo_dir} && ffcx {opts} {file}.py") == 0
assert (
os.system(
f"cd {demo_dir} && " f'cl.exe /I "../ffcx/codegeneration" {extra_flags} /c {file}.c'
)
) == 0
assert (
os.system(
f"cd {demo_dir} && "
f'clang-cl.exe /I "../ffcx/codegeneration" {extra_flags} /c {file}.c'
)
) == 0
else:
cc = os.environ.get("CC", "cc")
opts = f"--scalar_type {scalar_type}"
extra_flags = (
"-std=c17 -Wunused-variable -Werror -fPIC -Wno-error=implicit-function-declaration"
)
assert os.system(f"cd {demo_dir} && ffcx {opts} {file}.py") == 0
assert (
os.system(
f"cd {demo_dir} && "
f"{cc} -I../ffcx/codegeneration "
f"{extra_flags} "
f"-c {file}.c"
)
== 0
)
== 0
)
39 changes: 0 additions & 39 deletions ffcx/codegeneration/C/basix_custom_element_template.py

This file was deleted.

Loading

0 comments on commit 1d2e439

Please sign in to comment.