Skip to content

Commit 4df245f

Browse files
committed
Add CIBW_ARCH control to support aarch64 and macos arm64 in separate runners
1 parent 7a6720d commit 4df245f

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ jobs:
9090

9191
- name: Install NumPy
9292
continue-on-error: true
93-
# --only-binary disables compiling the package from source if a binary wheel is not available
93+
# --only-binary disables compiling the package from source if a binary wheel is not available, such as some versions of PyPy
9494
run: pip install --only-binary ":all:" numpy
9595

9696
- name: Install SciPy
9797
continue-on-error: true
98-
# --only-binary disables compiling the package from source if a binary wheel is not available, such as scipy on PyPy
98+
# --only-binary disables compiling the package from source if a binary wheel is not available, such as PyPy
9999
run: pip install --only-binary ":all:" scipy
100100

101101
- name: Python Test

.github/workflows/wheels.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,39 @@ jobs:
3939

4040

4141
build_wheels:
42-
name: Wheels on ${{ matrix.platform_id }} - ${{ matrix.os }}
42+
name: Wheels on ${{ matrix.os }} - ${{ matrix.cibw_archs }}
4343
runs-on: ${{ matrix.os }}
4444
strategy:
4545
fail-fast: false
4646
matrix:
47-
# Originally based on scikit-learn's config:
47+
# Originally based on scikit-learn's config, but has diverged since:
4848
# https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml
4949
include:
5050
- os: windows-latest
51-
platform_id: win_amd64
51+
cibw_archs: "AMD64"
5252

5353
- os: ubuntu-latest
54-
platform_id: manylinux_x86_64
54+
cibw_archs: "x86_64"
5555
- os: ubuntu-latest
56-
platform_id: manylinux_aarch64
56+
cibw_archs: "aarch64"
57+
# numpy wheels not available for aarch64 PyPy or musllinux
58+
cibw_skip: "pp* *musl*"
5759

5860
- os: macos-latest
59-
platform_id: macosx_x86_64
61+
cibw_archs: "x86_64"
6062
- os: macos-latest
61-
platform_id: macosx_arm64
63+
cibw_archs: "arm64"
6264

6365
steps:
6466
- uses: actions/checkout@v4
6567

68+
- name: Setup QEMU
69+
# for building non-x86 Linux wheels on x86 runner
70+
if: runner.os == 'Linux'
71+
uses: docker/setup-qemu-action@v2
72+
with:
73+
platforms: all
74+
6675
- uses: pypa/[email protected]
6776
with:
6877
package-dir: python
@@ -71,21 +80,24 @@ jobs:
7180

7281
CIBW_BUILD_VERBOSITY: 3
7382

74-
# No 32-bit builds. See https://cibuildwheel.readthedocs.io/en/stable/options/#archs
75-
# Note: if trying 32-bit builds, add CIBW_BEFORE_TEST: "pip install --only-binary :all: numpy scipy"
76-
CIBW_SKIP: "*-win32 *_i686"
83+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
84+
85+
CIBW_SKIP: ${{ matrix.cibw_skip }}
7786

78-
# Allow pre-release numpy to test on newest Python
79-
CIBW_BEFORE_TEST: pip install --pre numpy
87+
# Allow pre-release to test on newest Python that may only have beta or RC numpy packages available.
88+
# --only-binary and ' || true' to best-effort numpy and scipy installation.
89+
# Some platforms do not have binary wheels for either package, some only for numpy.
90+
# Notably PyPy: no scipy wheels, and numpy wheels for only some versions.
91+
CIBW_BEFORE_TEST: pip install --pre --only-binary ":all:" numpy && pip install --pre --only-binary ":all:" scipy || true
8092

8193
# make cibuildwheel install test dependencies from pyproject.toml
82-
CIBW_TEST_EXTRAS: "test"
94+
CIBW_TEST_EXTRAS: "testmin"
8395

8496
# run tests in the {package}/tests dir which is python/tests
8597
CIBW_TEST_COMMAND: "pytest {package}/tests"
8698

87-
# Skip testing on PyPy and musllinux versions that SciPy does not ship wheels for.
88-
CIBW_TEST_SKIP: "pp* cp37*musllinux* cp38*musllinux*"
99+
# Skip macOS ARM tests on Intel runner.
100+
CIBW_TEST_SKIP: "*-macosx_arm64"
89101

90102
- uses: actions/upload-artifact@v3
91103
with:
@@ -111,10 +123,10 @@ jobs:
111123
- uses: pypa/gh-action-pypi-publish@release/v1
112124
with:
113125
# PyPI does not allow replacing a file. Without this flag the entire action fails if even a single duplicate exists.
114-
skip_existing: true
126+
skip-existing: true
115127
verbose: true
116128
# Real PyPI:
117129
password: ${{ secrets.PYPI_API_TOKEN }}
118130
# Test PyPI:
119131
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
120-
# repository_url: https://test.pypi.org/legacy/
132+
# repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)