diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0fd9554..87cb287b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,8 +100,9 @@ jobs: build-wheels: name: >- - Build wheels for Python ${{ matrix.python-version }} - on ${{ matrix.target.runner }} (${{ matrix.target.archs }}) + Build wheels for + ${{ startsWith(matrix.python-version, 'pypy') && 'PyPy' || 'CPython' }} ${{ matrix.python-version }} + on ${{ matrix.target.runner }} (${{ matrix.target.platform }} / ${{ matrix.target.archs }}) if: | github.repository_owner == 'metaopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')) && @@ -112,16 +113,17 @@ jobs: matrix: # Reference: https://cibuildwheel.pypa.io target: - - { runner: ubuntu-latest, archs: "auto64" } - - { runner: ubuntu-latest, archs: "auto32" } - - { runner: ubuntu-24.04-arm, archs: "aarch64" } - - { runner: ubuntu-latest, archs: "ppc64le" } - - { runner: ubuntu-latest, archs: "s390x" } - - { runner: ubuntu-latest, archs: "riscv64" } - - { runner: macos-latest, archs: "auto64" } - - { runner: windows-latest, archs: "auto64" } - - { runner: windows-latest, archs: "auto32" } - - { runner: windows-11-arm, archs: "ARM64" } + - { runner: ubuntu-latest, platform: linux, archs: "auto64" } + - { runner: ubuntu-latest, platform: linux, archs: "auto32" } + - { runner: ubuntu-24.04-arm, platform: linux, archs: "aarch64" } + - { runner: ubuntu-latest, platform: linux, archs: "ppc64le" } + - { runner: ubuntu-latest, platform: linux, archs: "s390x" } + - { runner: ubuntu-latest, platform: linux, archs: "riscv64" } + - { runner: macos-latest, platform: macos, archs: "auto64" } + - { runner: macos-latest, platform: macos, archs: "x86_64" } + - { runner: windows-latest, platform: windows, archs: "auto64" } + - { runner: windows-latest, platform: windows, archs: "auto32" } + - { runner: windows-11-arm, platform: windows, archs: "ARM64" } python-version: - "3.9" - "3.10" @@ -151,24 +153,58 @@ jobs: include: # iOS - python-version: "3.13" - target: { runner: macos-latest, archs: "arm64_iphoneos" } + target: + runner: macos-latest + platform: ios + archs: "arm64_iphoneos" - python-version: "3.14" - target: { runner: macos-latest, archs: "arm64_iphoneos" } + target: + runner: macos-latest + platform: ios + archs: "arm64_iphoneos" # iOS Simulator - python-version: "3.13" - target: { runner: macos-latest, archs: "arm64_iphonesimulator" } + target: + runner: macos-latest + platform: ios + archs: "arm64_iphonesimulator" - python-version: "3.14" - target: { runner: macos-latest, archs: "arm64_iphonesimulator" } + target: + runner: macos-latest + platform: ios + archs: "arm64_iphonesimulator" # Android - python-version: "3.13" - target: { runner: macos-latest, archs: "arm64_v8a" } + target: + runner: ubuntu-latest + platform: android + archs: "arm64_v8a" - python-version: "3.14" - target: { runner: macos-latest, archs: "arm64_v8a" } + target: + runner: ubuntu-latest + platform: android + archs: "arm64_v8a" + - python-version: "3.13" + target: + runner: ubuntu-latest + platform: android + archs: "x86_64" + - python-version: "3.14" + target: + runner: ubuntu-latest + platform: android + archs: "x86_64" # Pyodide - python-version: "3.12" - target: { runner: ubuntu-latest, archs: "wasm32" } + target: + runner: ubuntu-latest + platform: pyodide + archs: "wasm32" - python-version: "3.13" - target: { runner: ubuntu-latest, archs: "wasm32" } + target: + runner: ubuntu-latest + platform: pyodide + archs: "wasm32" fail-fast: false timeout-minutes: 180 steps: @@ -237,23 +273,13 @@ jobs: fi echo "PYTHON_TAG=${PYTHON_TAG}" | tee -a "${GITHUB_ENV}" echo "CIBW_BUILD=${PYTHON_TAG}-*" | tee -a "${GITHUB_ENV}" - if [[ "${{ matrix.target.archs }}" == *arm*v8a* ]]; then - echo "CIBW_PLATFORM=android" | tee -a "${GITHUB_ENV}" - # Skip testing on Android - echo "CIBW_TEST_SKIP=*" | tee -a "${GITHUB_ENV}" - elif [[ "${{ matrix.target.archs }}" == *iphone* ]]; then - echo "CIBW_PLATFORM=ios" | tee -a "${GITHUB_ENV}" - if [[ "${{ matrix.target.archs }}" == *simulator* ]]; then - xcrun simctl shutdown all || true - xcrun simctl delete unavailable || true - xcrun simctl list devices >/dev/null || true - xcodebuild -downloadPlatform iOS || true - xcrun simctl list devices available || true - # Skip testing in iOS simulators - echo "CIBW_TEST_SKIP=*" | tee -a "${GITHUB_ENV}" - fi - elif [[ "${{ matrix.target.archs }}" == wasm* ]]; then - echo "CIBW_PLATFORM=pyodide" | tee -a "${GITHUB_ENV}" + if [[ "${{ matrix.target.platform }}" == 'ios' && + "${{ matrix.target.archs }}" == *simulator* ]]; then + xcrun simctl shutdown all || true + xcrun simctl delete unavailable || true + xcrun simctl list devices >/dev/null || true + xcodebuild -downloadPlatform iOS || true + xcrun simctl list devices available || true fi - name: Set up QEMU @@ -263,13 +289,13 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v3.2 + uses: pypa/cibuildwheel@v3.3 env: CIBW_BUILD: ${{ env.CIBW_BUILD }} + CIBW_PLATFORM: ${{ matrix.target.platform }} CIBW_ARCHS: ${{ matrix.target.archs }} - CIBW_ARCHS_MACOS: ${{ matrix.target.archs }} universal2 CIBW_ENABLE: pypy cpython-freethreading${{ env.ALLOW_PRERELEASES == 'true' && ' cpython-prerelease' || '' }} - CIBW_ALLOW_EMPTY: ${{ env.ALLOW_PRERELEASES }} + CIBW_ALLOW_EMPTY: ${{ env.ALLOW_PRERELEASES == 'true' }} with: package-dir: . output-dir: wheelhouse @@ -278,7 +304,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v5 with: - name: wheels-${{ env.PYTHON_TAG }}-${{ runner.os }}-${{ matrix.target.archs }} + name: wheels-${{ env.PYTHON_TAG }}-${{ matrix.target.platform }}-${{ matrix.target.archs }} path: wheelhouse/*.whl if-no-files-found: ${{ env.ALLOW_PRERELEASES == 'true' && 'warn' || 'error' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 03c7e7b9..5650b88a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,10 @@ env: jobs: test: - name: Test for Python ${{ matrix.python-version }} on ${{ matrix.runner }} + name: >- + Test for + ${{ startsWith(matrix.python-version, 'pypy') && 'PyPy' || 'CPython' }} ${{ matrix.python-version }} + on ${{ matrix.runner }} if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} runs-on: ${{ matrix.runner }} strategy: diff --git a/tests/helpers.py b/tests/helpers.py index f5045973..e81a103f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -68,6 +68,12 @@ reason='iOS does not support subprocesses', ) +ANDROID = sys.platform.startswith('android') +skipif_android = pytest.mark.skipif( + ANDROID, + reason='Android testbed returns wrong `sys.executable` which breaks subprocesses', +) + WASM = sys.platform.startswith(('emscripten', 'wasi')) skipif_wasm = pytest.mark.skipif( WASM, diff --git a/tests/test_ops.py b/tests/test_ops.py index bc29548d..6ceebe4d 100644 --- a/tests/test_ops.py +++ b/tests/test_ops.py @@ -50,12 +50,14 @@ is_tuple, never, parametrize, + skipif_android, skipif_ios, skipif_wasm, ) @skipif_wasm +@skipif_android @skipif_ios def test_import_no_warnings(): env = { diff --git a/tests/test_treespec.py b/tests/test_treespec.py index a966555f..4c7aa909 100644 --- a/tests/test_treespec.py +++ b/tests/test_treespec.py @@ -47,6 +47,7 @@ gc_collect, parametrize, recursionlimit, + skipif_android, skipif_ios, skipif_pypy, skipif_wasm, @@ -58,6 +59,7 @@ reason='Only run on x86_64 and AMD64 architectures', ) @skipif_wasm +@skipif_android @skipif_ios @skipif_pypy @disable_systrace @@ -526,6 +528,7 @@ def __init__(self, x, y): @skipif_wasm +@skipif_android @skipif_ios def test_treespec_pickle_missing_registration(): if sys.version_info[:2] == (3, 11) and platform.system() == 'Windows' and Py_DEBUG: