Skip to content

Commit

Permalink
cibuildwheel: Add macOS arm64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier2k6 committed Aug 28, 2024
1 parent 2ab8fed commit 62a6cbe
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 35 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: cibuildwheel
# sample.

# The full list of cibuildwheel's build targets can be found here:
# https://github.com/pypa/cibuildwheel/blob/v2.16.5/cibuildwheel/resources/build-platforms.toml
# https://github.com/pypa/cibuildwheel/blob/v2.20.0/cibuildwheel/resources/build-platforms.toml

# Notes on build targets we (don't) support:
# - pypy: libtorrent doesn't build with pypy as of writing
Expand Down Expand Up @@ -45,22 +45,24 @@ jobs:
MATRIX_PULL_REQUEST: |
{
"include": [
{"os": "ubuntu-latest", "CIBW_BUILD": "cp39-manylinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp39-musllinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "macos-12", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "x86_64"},
{"os": "windows-2022", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "AMD64"}
{"os": "ubuntu-latest", "CIBW_BUILD": "cp13-manylinux_x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp13-manylinux_aarch64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp13-musllinux_x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp13-musllinux_aarch64"}
]
}
MATRIX_WORKFLOW_DISPATCH: |
{
"include": [
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-manylinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-manylinux_*", "CIBW_ARCHS": "aarch64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-musllinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-musllinux_*", "CIBW_ARCHS": "aarch64"},
{"os": "macos-12", "CIBW_BUILD": "cp*", "CIBW_ARCHS": "x86_64"},
{"os": "windows-2022", "CIBW_BUILD": "cp*", "CIBW_ARCHS": "x86"},
{"os": "windows-2022", "CIBW_BUILD": "cp*", "CIBW_ARCHS": "AMD64"}
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-manylinux_x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-manylinux_aarch64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-musllinux_x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp*-musllinux_aarch64"},
{"os": "macos-12", "CIBW_BUILD": "cp*-macosx_x86_64", "MACOSX_DEPLOYMENT_TARGET": "12"},
{"os": "macos-13", "CIBW_BUILD": "cp*-macosx_x86_64", "MACOSX_DEPLOYMENT_TARGET": "13"},
{"os": "macos-14", "CIBW_BUILD": "cp*-macosx_arm64", "MACOSX_DEPLOYMENT_TARGET": "14"},
{"os": "windows-latest", "CIBW_BUILD": "cp*-win32"},
{"os": "windows-latest", "CIBW_BUILD": "cp*-win_amd64"}
]
}
Expand All @@ -87,7 +89,9 @@ jobs:
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.CIBW_BUILD }}
CIBW_ARCHS: ${{ matrix.CIBW_ARCHS }}
CIBW_ARCHS_LINUX: "x86_x64, aarch64"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MACOSX_DEPLOYMENT_TARGET }}
CIBW_SKIP: pp*
CIBW_TEST_SKIP: "*-win32"

steps:
Expand All @@ -101,12 +105,12 @@ jobs:
id: cache-wheel
with:
path: wheelhouse
key: wheel-${{ matrix.CIBW_BUILD }}-${{ matrix.CIBW_ARCHS }}-${{ github.sha }}
key: wheel-${{ matrix.os }}-${{ matrix.CIBW_BUILD }}-${{ github.sha }}

- uses: docker/setup-qemu-action@v3
if: steps.cache-wheel.outputs.cache-hit != 'true' && runner.os == 'Linux'

- uses: pypa/cibuildwheel@v2.19.2
- uses: pypa/cibuildwheel@v2.20.0
if: steps.cache-wheel.outputs.cache-hit != 'true'

- uses: actions/upload-artifact@v3
Expand All @@ -128,8 +132,8 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse
skip_existing: true
packages-dir: wheelhouse
skip-existing: true

upload_pypi_test:
needs: build_wheels
Expand All @@ -145,6 +149,6 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
packages_dir: wheelhouse
skip_existing: true
packages-dir: wheelhouse
skip-existing: true
repository_url: https://test.pypi.org/legacy/
6 changes: 3 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam
- name: build and run tests
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam
- name: build and run simulations
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam
- name: build library
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: dependencies (MacOS)
if: runner.os == 'macOS'
run: |
brew install boost-build boost boost-python3 python@3.12 openssl@1.1 python-setuptools
brew install boost-build boost boost-python3 python@3.12 openssl@3 python-setuptools
export PATH=$(brew --prefix)/opt/python@3.12/bin:$PATH
- name: update package lists (linux)
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
#- id: trailing-whitespace
#- id: end-of-file-fixer
Expand Down Expand Up @@ -72,7 +72,7 @@ repos:
tools/update_copyright.py
)$
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place, --remove-unused-variables, --remove-all-unused-imports, --remove-duplicate-keys]
Expand All @@ -86,7 +86,7 @@ repos:
tools/libtorrent_lldb.py
)
- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.8.0
hooks:
- id: black
# Avoiding PR bloat
Expand Down Expand Up @@ -132,7 +132,7 @@ repos:
name: black (pyi)
types: [pyi]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.11.2
hooks:
- id: mypy
# Avoiding PR bloat
Expand Down Expand Up @@ -171,7 +171,7 @@ repos:
tools/update_copyright.py
)$
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
exclude: |
Expand Down
2 changes: 1 addition & 1 deletion docs/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Linux::

Mac OS::

brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam
b2 crypto=openssl cxxstd=14 release

Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
requires-python = ">=3.7"
requires-python = ">=3.9"

[tool.cibuildwheel]
skip = "{pp*,}"
Expand All @@ -17,8 +17,7 @@ test-command = [
[tool.cibuildwheel.macos.environment]
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
MACOSX_DEPLOYMENT_TARGET = "12"
BOOST_VERSION = "1.83.0"
PATH = "/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -38,7 +37,7 @@ test-command = [
[tool.cibuildwheel.overrides.environment] # sub-table of previous block!
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.83.0"
PATH = "/usr/local/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -57,7 +56,7 @@ test-command = [
[tool.cibuildwheel.overrides.environment] # sub-table of previous block!
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.83.0"
PATH = "/usr/lib/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -78,7 +77,7 @@ test-command = '''bash -c "cd '{project}/bindings/python' && python test.py"'''
[tool.cibuildwheel.windows.environment]
BOOST_BUILD_PATH = 'c:/boost/tools/build'
BOOST_ROOT = 'c:/boost'
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.83.0"
PATH = 'c:/boost;$PATH'

[tool.isort]
Expand Down

0 comments on commit 62a6cbe

Please sign in to comment.