Build wheels #93
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: Build wheels | |
# By default this action does not push to test or production PyPI. The wheels | |
# are available as an artifact that can be downloaded and tested locally. | |
on: | |
workflow_dispatch: | |
inputs: | |
dolfinx_ref: | |
description: "dolfinx git ref to checkout" | |
default: "main" | |
type: string | |
build_fenicsx_stack: | |
description: "Build wheels for whole FEniCSx stack" | |
default: false | |
type: boolean | |
basix_ref: | |
description: "basix git ref to checkout" | |
default: "main" | |
type: string | |
ufl_ref: | |
description: "ufl git ref to checkout" | |
default: "main" | |
type: string | |
ffcx_ref: | |
description: "ffcx git ref to checkout" | |
default: "main" | |
type: string | |
workflow_call: | |
inputs: | |
dolfinx_ref: | |
description: "dolfinx git ref to checkout" | |
default: "main" | |
type: string | |
build_fenicsx_stack: | |
description: "Build wheels for entire FEniCSx stack" | |
default: false | |
type: boolean | |
basix_ref: | |
description: "basix git ref to checkout" | |
default: "main" | |
type: string | |
ufl_ref: | |
description: "ufl git ref to checkout" | |
default: "main" | |
type: string | |
ffcx_ref: | |
description: "ffcx git ref to checkout" | |
default: "main" | |
type: string | |
jobs: | |
build_wheels: | |
name: Build wheels | |
runs-on: ubuntu-latest | |
env: | |
CIBW_BUILD: cp39-manylinux_x86_64 | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=file:///project/simple MAKEFLAGS=-j3 | |
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64:2024-09-16-ab73a4b | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install Python dependencies | |
run: python -m pip install cibuildwheel simple503 build | |
- name: Checkout Basix | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: FEniCS/basix | |
path: basix | |
ref: ${{ github.event.inputs.basix_ref }} | |
- name: Build Basix wheel | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
working-directory: basix | |
run: | | |
python -m cibuildwheel --output-dir ../wheelhouse . | |
- name: Checkout UFL | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: FEniCS/ufl | |
path: ufl | |
ref: ${{ github.event.inputs.ufl_ref }} | |
- name: Build UFL wheel | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
working-directory: ufl | |
run: python -m build --outdir wheelhouse/ . | |
- name: Checkout FFCx | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: FEniCS/ffcx | |
path: ffcx | |
ref: ${{ github.event.inputs.ffcx_ref }} | |
- name: Build FFCx wheel | |
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }} | |
working-directory: ffcx | |
run: python -m build --outdir wheelhouse/ . | |
- name: Make temporary simple503 repository | |
run: | | |
mkdir -p simple | |
cp wheelhouse/* simple/ | |
python -m simple503 --base-url file:///project/simple simple | |
- name: Update temporary simple503 repository | |
run: | | |
cp wheelhouse/* simple/ | |
python -m simple503 --base-url file:///project/simple simple | |
- name: Checkout DOLFINx | |
uses: actions/checkout@v4 | |
with: | |
path: dolfinx | |
ref: ${{ github.event.inputs.dolfinx_ref }} | |
# fenics-ffcx and fenics-basix are required by DOLFINx C++ build | |
# mpi4py and petsc4py are build_requirements of DOLFINx Python | |
- name: Build DOLFINx wheel | |
run: python -m cibuildwheel --output-dir wheelhouse dolfinx/python | |
env: | |
CIBW_BEFORE_BUILD: dnf -y update && dnf install -y dnf-plugins-core && dnf install -y epel-release && /usr/bin/crb enable && dnf -y update && dnf -y install boost-devel boost-program-options hdf5-mpich-devel mpich-devel openblas-devel pugixml-devel spdlog-devel && module load mpi/mpich-$(arch) && python -m pip -v install --prefer-binary fenics-ffcx fenics-basix fenics-ufl && python -m pip -v install --prefer-binary mpi4py -i https://pypi.anaconda.org/mpi4py/simple && cmake -S dolfinx/cpp -B build-dir -DPython3_EXECUTABLE=$(which python) && cmake --build build-dir && cmake --install build-dir | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: export LD_LIBRARY_PATH=$(python -c "import site; print(site.getsitepackages()[0] + '/fenics_basix.libs')"):${LD_LIBRARY_PATH} && auditwheel repair -w {dest_dir} {wheel} | |
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=file:///project/simple MAKEFLAGS=-j3 LD_LIBRARY_PATH=/usr/lib64/mpich/lib | |
- name: Update temporary simple503 repository | |
run: | | |
cp wheelhouse/* simple | |
python -m simple503 --base-url file:///shared simple | |
# Artifact can be unzipped into $(pwd) and tested with e.g.: | |
# docker run -ti -v $(pwd):/shared --env PIP_EXTRA_INDEX_URL=file:///shared python:3.9 /bin/bash -l | |
- name: Upload simple503-test artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "simple503-test" | |
path: simple/* | |
- name: Upload wheelhouse artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheelhouse | |
path: wheelhouse/* | |
- name: Update FEniCS Project simple503 repository | |
run: | | |
python -m simple503 --base-url http://packages.fenicsproject.org/simple simple | |
# For manual upload. | |
- name: Upload simple503 artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "simple503" | |
path: simple/* |