Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions .github/workflows/build-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,38 @@ jobs:
- uses: pre-commit/[email protected]

build_wheels:
name: Build ${{ matrix.archs }} ${{ matrix.build }} wheels on ${{ matrix.os }}
name: Build ${{ matrix.archs }} ${{ matrix.build }} wheels on ${{ matrix.platform }}
needs: [lint]
runs-on: "${{ matrix.os }}${{ startsWith(matrix.archs, 'aarch64') && '-arm' || '' }}"
runs-on: "${{ matrix.runs-on }}${{ startsWith(matrix.archs, 'aarch64') && '-arm' || '' }}"
strategy:
matrix:
os: [ubuntu-24.04]
platform: [linux]
archs: ["x86_64, i686", "aarch64, armv7l", "ppc64le", "s390x"]
build: ["manylinux", "musllinux"]
include:
- os: windows-2019
- runs-on: ubuntu-24.04

- platform: "windows"
runs-on: windows-2019
archs: "AMD64"
- os: windows-2019
- platform: "windows"
runs-on: windows-2019
archs: "x86"
- os: windows-2019
- platform: "windows"
runs-on: windows-2019
archs: "ARM64"
- os: macos-13
- platform: "macos"
runs-on: macos-13
archs: "x86_64"
- os: macos-14
- platform: "macos"
runs-on: macos-14
archs: "arm64"
- platform: "ios"
runs-on: macos-13
archs: "x86_64_iphonesimulator"
- platform: "ios"
runs-on: macos-latest
archs: "arm64_iphonesimulator,arm64_iphoneos"

steps:
- name: Set git to use LF
Expand All @@ -69,15 +82,16 @@ jobs:
python-version: 3.8

- name: Build wheels
uses: pypa/cibuildwheel@v2.23.0
uses: pypa/cibuildwheel@v3.0.0
env:
CIBW_PLATFORM: "${{ matrix.platform }}"
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "${{ matrix.build && '*-' || ''}}${{ matrix.build }}*"
CIBW_ENABLE: "${{ startsWith(github.ref, 'refs/tags/v') && '' || 'cpython-prerelease'}}"

- uses: actions/upload-artifact@v4
with:
name: "cibw-wheels ${{ matrix.build || matrix.os }} ${{ matrix.archs }}"
name: "cibw-wheels ${{ matrix.build || matrix.platform }} ${{ matrix.archs }}"
path: ./wheelhouse/*.whl

build_sdist:
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel]
enable = ["cpython-freethreading", "pypy"]
test-requires = "-r requirements-test.txt"
test-command = "pytest {project}/tests"
test-command = "pytest tests -vv"
test-skip = "*-win_arm64" # silence warnings for windows ARM64
test-sources = [
"tests",
]
safe-tools = ["cmake"]
build-verbosity = 1
manylinux-i686-image = "manylinux2014"
manylinux-pypy_i686-image = "manylinux2014"
Expand Down
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,25 @@ def get_cmake_extra_config(plat_name: str | None, build_type: str) -> tuple[bool
extra_config.append(f"-DCMAKE_OSX_ARCHITECTURES={arch}")
else:
log.warning("`%s` is not a known value for CMAKE_OSX_ARCHITECTURES", arch)
elif sys.platform == "ios":
sdk = "iphonesimulator" if platform_module.ios_ver().is_simulator else "iphoneos"
sysroot = (
subprocess.check_output(["xcrun", "--show-sdk-path", "--sdk", sdk])
.strip()
.decode("latin1")
)
arch = "x86_64" if platform_module.machine() == "x86_64" else "aarch64"
ios_min_ver = os.getenv("IPHONEOS_DEPLOYMENT_TARGET", "13.0")

extra_config.extend(
[
"-DCMAKE_SYSTEM_NAME=iOS",
f"-DCMAKE_SYSTEM_PROCESSOR={arch}",
f"-DCMAKE_OSX_DEPLOYMENT_TARGET={ios_min_ver}",
f"-DCMAKE_OSX_SYSROOT={sysroot}",
"-DBUILD_SHARED_LIBS=NO",
]
)
return is_msvc, extra_config


Expand Down
4 changes: 4 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def test_decode(
assert captured.out == b"hello world !/?\n"


@pytest.mark.skipif(
sys.platform == "ios",
reason="Subprocess tests don't work on iOS",
)
def test_subprocess() -> None:
import subprocess

Expand Down