wheels #38
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: Wheels | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: Wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, windows-2022] # add macos-13 for macOS wheels | |
max-parallel: 2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgDirectory: ${{ github.workspace }}/vcpkg | |
vcpkgGitCommitId: 055721089e8037d4d617250814d11f881e557549 | |
- uses: pypa/[email protected] | |
if: startsWith(matrix.os, 'ubuntu') | |
env: | |
CIBW_ARCHS_LINUX: x86_64 | |
CIBW_BUILD: cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 | |
CIBW_BUILD_VERBOSITY_LINUX: 3 | |
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 | |
# By default, cibuildwheel will perform a volume mount from the current root / to /host/ in the linux container, | |
# see see https://cibuildwheel.pypa.io/en/stable/options/#container-engine . | |
CIBW_ENVIRONMENT_LINUX: SKBUILD_BUILD_TOOL_ARGS="-j 4" SKBUILD_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=/host/${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake;-DVCPKG_MANIFEST_FEATURES=python;-DPBAT_BUILD_SHARED_LIBS:BOOL=OFF;-DPBAT_ENABLE_PROFILER:BOOL=ON;-DPBAT_BUILD_PYTHON_BINDINGS:BOOL=ON;-DPBAT_BUILD_TESTS:BOOL=OFF;-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON;-DCMAKE_BUILD_TYPE=Release" | |
- name: Set macOS environment variables | |
if: startsWith(matrix.os, 'mac') | |
shell: bash | |
# To use compiler other than AppleClang, use -DCMAKE_CXX_COMPILER. See available compilers at https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md . | |
# For example, | |
# run: | |
# echo "SKBUILD_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=gcc-13;-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake;-DVCPKG_MANIFEST_FEATURES=python;-DPBAT_BUILD_SHARED_LIBS:BOOL=OFF;-DPBAT_ENABLE_PROFILER:BOOL=ON;-DPBAT_BUILD_PYTHON_BINDINGS:BOOL=ON;-DPBAT_BUILD_TESTS:BOOL=OFF" >> $GITHUB_ENV | |
# For now, it seems that TracyClient does not compile successfully on MacOS using GCC 13, and Clang 15 is not modern enough to support std::ranges::sort, | |
# although it seems that we could make it work with -fexperimental-library. | |
# Environment variables can be read directly on Windows and MacOS, but not Linux. | |
# See https://cibuildwheel.pypa.io/en/stable/options/#environment-pass | |
run: | | |
echo "SKBUILD_CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake;-DVCPKG_MANIFEST_FEATURES=python;-DPBAT_BUILD_SHARED_LIBS:BOOL=OFF;-DPBAT_ENABLE_PROFILER:BOOL=ON;-DPBAT_BUILD_PYTHON_BINDINGS:BOOL=ON;-DPBAT_BUILD_TESTS:BOOL=OFF;-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON;-DCMAKE_BUILD_TYPE=Release" >> $GITHUB_ENV | |
- uses: pypa/[email protected] | |
if: startsWith(matrix.os, 'mac') | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "13.0" | |
CIBW_ARCHS_MACOS: x86_64 universal2 | |
CIBW_BUILD: cp310-macosx_x86_64 cp311-macosx_x86_64 cp312-macosx_x86_64 cp310_macosx_universal2 cp311_macosx_universal2 cp312_macosx_universal2 | |
CIBW_BUILD_VERBOSITY_MACOS: 3 | |
SKBUILD_BUILD_TOOL_ARGS: -j 4 | |
- uses: pypa/[email protected] | |
if: startsWith(matrix.os, 'windows') | |
env: | |
CIBW_ARCHS_WINDOWS: AMD64 | |
CIBW_BUILD: cp310-win_amd64 cp311-win_amd64 cp312-win_amd64 | |
CIBW_BUILD_VERBOSITY_WINDOWS: 3 | |
# Environment variables can be read directly on Windows and MacOS, but not Linux. | |
# See https://cibuildwheel.pypa.io/en/stable/options/#environment-pass | |
SKBUILD_BUILD_TOOL_ARGS: /p:CL_MPCount=4 | |
SKBUILD_CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake;-DVCPKG_MANIFEST_FEATURES=python;-DPBAT_BUILD_SHARED_LIBS:BOOL=OFF;-DPBAT_ENABLE_PROFILER:BOOL=ON;-DPBAT_BUILD_PYTHON_BINDINGS:BOOL=ON;-DPBAT_BUILD_TESTS:BOOL=OFF;-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON;-DCMAKE_CXX_FLAGS="/EHsc /MP /bigobj" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }} | |
path: wheelhouse/*.whl | |
upload_all: | |
name: Upload release | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch') | |
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | |
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 |