Skip to content

Commit

Permalink
ci: update cibuildwheel
Browse files Browse the repository at this point in the history
This is an attempt to fix the macos has the wrong *.so part of the
issue zxing-cpp#695, as well as macos builds don't use c++20.
  • Loading branch information
axxel committed Feb 21, 2024
1 parent f7c9de4 commit 9864cbb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,37 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install cibuildwheel
run: python3 -m pip install cibuildwheel==2.16.2
run: python3 -m pip install cibuildwheel==2.16.5

- name: Build wheels
run: python3 -m cibuildwheel --output-dir wheelhouse wrappers/python
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
# CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_BUILD: cp39-*
CIBW_SKIP: "*musllinux*"
# the default maylinux2014 image does not contain a c++20 compiler, see https://github.com/pypa/manylinux
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64
# CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_MACOS: universal2
CIBW_ENVIRONMENT_MACOS: CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
# the default macOS target version is 10.9 which does not support c++20 coroutines
MACOSX_DEPLOYMENT_TARGET: "10.13"
CMAKE_FIND_FRAMEWORK: "LAST"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v3 # v4 breaks the build, see https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build-sdist:
Expand All @@ -55,7 +65,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -70,8 +80,10 @@ jobs:
working-directory: wrappers/python
run: python3 setup.py sdist

- uses: actions/upload-artifact@v3
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: wrappers/python/dist/*.tar.gz

upload-pypi:
Expand All @@ -89,8 +101,12 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- name: List wheels
run: ls dist

- uses: pypa/gh-action-pypi-publish@release/v1
# with:
Expand Down
3 changes: 3 additions & 0 deletions wrappers/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ if (NOT hasParent)
endif()
endif()

#if(DEFINED ENV{CIBW_ARCHS_MACOS})
# set(Python3_FIND_STRATEGY LOCATION)
#endif()
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED) # see https://github.com/pybind/pybind11/issues/4785
zxing_add_package(pybind11 pybind11 ${pybind11_git_repo} ${pybind11_git_rev})

Expand Down

0 comments on commit 9864cbb

Please sign in to comment.