Skip to content

Commit

Permalink
fix: improve cross-platform compatibility in wheel building
Browse files Browse the repository at this point in the history
- Add explicit shell: bash for all steps
- Separate macOS wheel repair into a dedicated step
- Fix Windows compatibility issues
  • Loading branch information
polischuks committed Jan 31, 2025
1 parent f89f0fc commit f28114f
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- name: Install build tools
run: |
python -m pip install build poetry
shell: bash

- name: Build wheel with dependencies
run: |
Expand All @@ -41,24 +42,26 @@ jobs:
# Build wheel including all dependencies
python -m pip wheel . -w dist/
# On macOS, repair wheels and build for arm64 if needed
if [ "${{ runner.os }}" = "macOS" ]; then
pip install delocate
if [ "${{ matrix.arch }}" = "arm64" ]; then
# Set environment for arm64 build
export ARCHFLAGS="-arch arm64"
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
fi
delocate-wheel -w dist/fixed -v dist/*.whl
mv dist/fixed/* dist/
rm -rf dist/fixed
shell: bash

- name: Repair macOS wheels
if: runner.os == 'macOS'
run: |
pip install delocate
if [ "${{ matrix.arch }}" = "arm64" ]; then
# Set environment for arm64 build
export ARCHFLAGS="-arch arm64"
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
fi
delocate-wheel -w dist/fixed -v dist/*.whl
mv dist/fixed/* dist/
rm -rf dist/fixed
shell: bash

- name: Build source distribution
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
run: python -m build --sdist --outdir dist/
shell: bash

- name: Upload to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
Expand Down

0 comments on commit f28114f

Please sign in to comment.