Skip to content

Commit

Permalink
Add macOS arm64 support and use latest runners for cibuildwheel
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier2k6 committed Feb 24, 2024
1 parent 4ef2211 commit 60b6939
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 44 deletions.
80 changes: 46 additions & 34 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,37 @@ jobs:
# github actions syntax doesn't allow us to have yaml structures as
# an input to a job. These environment variables are literal json strings
MATRIX_PULL_REQUEST: |
{
"include": [
{"os": "ubuntu-latest", "CIBW_BUILD": "cp37-manylinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp37-musllinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "macos-12", "CIBW_BUILD": "cp37-*", "CIBW_ARCHS": "x86_64"},
{"os": "windows-2022", "CIBW_BUILD": "cp37-*", "CIBW_ARCHS": "AMD64"}
]
}
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: ["windows-latest", "ubuntu-latest", "macos-14"]
python: "312"
platform_id:
- win_amd64
- win32
- manylinux_x86_64
- manylinux_aarch64
- musllinux_x86_64
- musllinux_aarch64
- macosx_x86_64
exclude:
# Skip certain Python, Linux and Mac builds on Windows
- os: windows-latest
platform_id: manylinux_aarch64
platform_id: manylinux_x86_64
platform_id: macosx_x86_64
platform_id: musllinux_x86_64
platform_id: musllinux_aarch64
# Skip certain Python, Mac and Windows builds on Linux
- os: ubuntu-latest
platform_id: macosx_x86_64
platform_id: win_amd64
platform_id: win32
# Skip certain Python, Linux and Windows builds on Mac
- os: macos-14
platform_id: win_amd64
platform_id: win32
platform_id: manylinux_x86_64
platform_id: manylinux_aarch64
platform_id: musllinux_x86_64
platform_id: musllinux_aarch64
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -82,12 +93,13 @@ jobs:

strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.configure_matrix.outputs.matrix) }}

env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.CIBW_BUILD }}
CIBW_ARCHS: ${{ matrix.CIBW_ARCHS }}
CIBW_ARCHS_LINUX: "x86_64, aarch64"
CIBW_ARCHS_MACOS: "x86_64, arm64"
CIBW_ARCHS_WINDOWS: "AMD64, x86"
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_TEST_SKIP: "*-win32"

steps:
Expand All @@ -99,50 +111,50 @@ jobs:
id: cache-wheel
with:
path: wheelhouse
key: wheel-${{ matrix.CIBW_BUILD }}-${{ matrix.CIBW_ARCHS }}-${{ github.sha }}
key: wheel-${{ matrix.os }}-${{ matrix.platform_id }}-${{ github.sha }}

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

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

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: wheels
name: wheels-${{ matrix.os }}-${{ matrix.platform_id }}

upload_pypi:
needs: build_wheels
runs-on: ubuntu-latest
if: needs.build_wheels.result == 'success' && github.event.inputs.publish == 'PUBLISH'

steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: wheels
pattern: wheels-*
path: wheelhouse

- 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
runs-on: ubuntu-latest
if: needs.build_wheels.result == 'success' && github.event.inputs.publish_test == 'PUBLISH_TEST'

steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: wheels
pattern: wheels-*
path: wheelhouse

- 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/
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
- name: After Prepare (cpp)
if: ${{ matrix.language == 'cpp' }}
run: 'wget -q "https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-linux-x86_64.tar.gz"
run: 'wget -q "https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.tar.gz"
tar xzf cmake-3.21.2-linux-x86_64.tar.gz
tar xzf cmake-3.28.3-linux-x86_64.tar.gz
'

Expand All @@ -50,9 +50,9 @@ jobs:

- name: Build cpp
if: ${{ matrix.language == 'cpp' }}
run: './cmake-3.21.2-linux-x86_64/bin/cmake -Dbuild_examples=ON -Dbuild_tests=ON -Dbuild_tools=ON -GNinja .
run: './cmake-3.28.3-linux-x86_64/bin/cmake -Dbuild_examples=ON -Dbuild_tests=ON -Dbuild_tools=ON -GNinja .
./cmake-3.21.2-linux-x86_64/bin/cmake --build .
./cmake-3.28.3-linux-x86_64/bin/cmake --build .
'

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ repos:
tools/update_copyright.py
)$
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
args: [--in-place, --remove-unused-variables, --remove-all-unused-imports, --remove-duplicate-keys]
Expand All @@ -85,7 +85,7 @@ repos:
tools/gen_convenience_header.py|
tools/libtorrent_lldb.py
)
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
hooks:
- id: black
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test-command = [
[tool.cibuildwheel.macos.environment]
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.82.0"
MACOSX_DEPLOYMENT_TARGET = "10.9" # required for full C++11 support
PATH = "/tmp/boost:$PATH"

Expand All @@ -38,7 +38,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.82.0"
PATH = "/usr/local/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -57,7 +57,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.82.0"
PATH = "/usr/lib/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -80,7 +80,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.82.0"
PATH = 'c:/boost;$PATH'

[tool.isort]
Expand Down

0 comments on commit 60b6939

Please sign in to comment.