Refact/reorganize modules #39
Workflow file for this run
This file contains hidden or 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: Publish PauliEngine Python sdist and wheels to PyPI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| force-upload: | |
| description: 'Upload artifacts without a corresponding release' | |
| required: false | |
| default: false | |
| type: boolean | |
| release: | |
| types: | |
| - published | |
| pull_request: | |
| # PRs trigger for the "opened", "reopened", "synchronize" events (default) and | |
| # "ready_for_review" | |
| paths: | |
| - .github/workflows/deploy.yml | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize # when new commits are pushed to the PR | |
| - ready_for_review # when the PR is un-drafted | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| COLUMNS: 120 | |
| FORCE_COLOR: 3 | |
| jobs: | |
| build-sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # such that setuptools_scm can do its job correctly | |
| - name: Build SDist | |
| run: | | |
| pipx install uv | |
| pipx run build --verbose --sdist --installer=uv | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: cibw-sdist | |
| path: dist/*.tar.gz | |
| build-wheels: | |
| # in combination with the PR types selection, this top-level if statement | |
| # skips running the workflow for Draft PRs | |
| if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | |
| name: Build Python wheels for ${{ matrix.os }} | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| matrix: | |
| os: [ linux-intel, linux-arm, macos-arm, windows-intel, windows-arm] | |
| include: | |
| - archs: native | |
| platform: auto | |
| - os: linux-intel | |
| runs-on: ubuntu-latest | |
| - os: linux-arm | |
| runs-on: ubuntu-24.04-arm | |
| - os: macos-arm | |
| runs-on: macos-latest | |
| - os: windows-intel | |
| runs-on: windows-latest | |
| - os: windows-arm | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pypa/cibuildwheel@v3.3.1 | |
| with: | |
| extras: "uv" | |
| env: | |
| # target platform | |
| CIBW_PLATFORM: ${{ matrix.platform }} | |
| # architectures to build | |
| CIBW_ARCHS: ${{ matrix.archs }} | |
| # use uv and build | |
| CIBW_BUILD_FRONTEND: "build[uv]" | |
| # increase pip debugging output | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_DEBUG_TRACEBACK: TRUE | |
| CIBW_BEFORE_ALL_LINUX: | | |
| dnf install -y gmp gmp-devel ninja-build | |
| # install symengine | |
| ./tools/install-deps.sh | |
| CIBW_BEFORE_ALL_MACOS: | | |
| brew install gmp | |
| # install symengine | |
| PREFIX="${SYMEMENGINE_PREFIX:-$HOME/.local}" | |
| ./tools/install-deps.sh "$PREFIX" | |
| CIBW_BEFORE_ALL_WINDOWS: | | |
| pip install delvewheel | |
| # do not activate architecture-dependent compiler flags | |
| # 4 jobs in parallel, but do not start new ones if load average exceeds 5 | |
| CIBW_ENVIRONMENT_LINUX: > | |
| CIBW="true" | |
| SKBUILD_BUILD_TOOL_ARGS="-j4;-l5" | |
| # CMAKE_PREFIX_PATH="$HOME/.local" | |
| # set deployment target for C++20 compatibility | |
| # make brew-installed OpenMP discoverable by CMake | |
| # do not activate architecture-dependent compiler flags | |
| # 4 jobs in parallel, but do not start new ones if load average exceeds 5 | |
| CIBW_ENVIRONMENT_MACOS: > | |
| CIBW="true" | |
| MACOSX_DEPLOYMENT_TARGET=15.0 | |
| GMP_PREFIX="$(brew --prefix gmp)" | |
| CPPFLAGS="-I${GMP_PREFIX}/include ${CPPFLAGS}" | |
| CFLAGS="-I${GMP_PREFIX}/include ${CFLAGS}" | |
| CXXFLAGS="-I${GMP_PREFIX}/include ${CXXFLAGS}" | |
| LDFLAGS="-L${GMP_PREFIX}/lib ${LDFLAGS}" | |
| PKG_CONFIG_PATH="${GMP_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}" | |
| CMAKE_PREFIX_PATH="${GMP_PREFIX}:$HOME/.local:${CMAKE_PREFIX_PATH}" | |
| CIBW_ENVIRONMENT_WINDOWS: > | |
| CIBW="true" | |
| # build 3.10, 3.11, 3.12, 3.13 (with GIL), and 3.14 (with GIL) | |
| CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" | |
| # skip musl builds, and PyPy builds | |
| CIBW_SKIP: "*-musllinux_*" | |
| # use abi3audit to catch issues with Limited API wheels | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: | | |
| auditwheel repair -w {dest_dir} {wheel} | |
| if [[ "{wheel}" == *abi3* ]]; then | |
| pipx run abi3audit --strict --report {wheel} | |
| else | |
| echo "{wheel} is not abi3, skipping abi3audit" | |
| fi | |
| # use abi3audit to catch issues with Limited API wheels | |
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: | | |
| delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} | |
| if [[ "{wheel}" == *abi3* ]]; then | |
| pipx run abi3audit --strict --report {wheel} | |
| else | |
| echo "{wheel} is not abi3, skipping abi3audit" | |
| fi | |
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: | | |
| delvewheel repair -w {dest_dir} {wheel} | |
| if [[ "{wheel}" == *abi3* ]]; then | |
| pipx run abi3audit --strict --report {wheel} | |
| else | |
| echo "{wheel} is not abi3, skipping abi3audit" | |
| fi | |
| CIBW_TEST_COMMAND: python -m pytest {package}/tests | |
| CIBW_TEST_GROUPS: "test" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: wheelhouse/*.whl | |
| # upload_all: | |
| # name: Upload if release | |
| # needs: | |
| # - build_wheels | |
| # - build_sdist | |
| # environment: pypi | |
| # permissions: | |
| # id-token: write | |
| # runs-on: ubuntu-latest | |
| # #if: github.event_name == 'release' && github.event.action == 'published' | |
| # steps: | |
| # - uses: actions/download-artifact@v4 | |
| # with: | |
| # pattern: cibw-* | |
| # path: dist | |
| # merge-multiple: true | |
| # - uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # repository-url: https://test.pypi.org/legacy/ |