From 063616e99bc513f647a134e46857523912927d66 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 3 Jun 2025 23:35:51 -0400 Subject: [PATCH 01/13] ci: add android test Signed-off-by: Henry Schreiner --- .github/workflows/tests-cibw.yml | 31 +++++++++++++++++++++++++++---- tests/pyproject.toml | 3 +++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index cd05bf11c9..e706e3213b 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: pypa/cibuildwheel@v3.0 + - uses: mhsmith/cibuildwheel@android env: PYODIDE_BUILD_EXPORTS: whole_archive with: @@ -30,8 +30,12 @@ jobs: only: cp312-pyodide_wasm32 build-ios: - name: iOS wheel - runs-on: macos-latest + name: iOS wheel ${{ matrix.runs-on }} + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + runs-on: [macos-latest, macos-13] steps: - uses: actions/checkout@v4 with: @@ -40,8 +44,27 @@ jobs: - run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.0 + - uses: mhsmith/cibuildwheel@android env: CIBW_PLATFORM: ios with: package-dir: tests + + build-android: + name: Android wheel ${{ matrix.runs-on }} + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + runs-on: [macos-latest, macos-13, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - uses: mhsmith/cibuildwheel@android + env: + CIBW_PLATFORM: android + with: + package-dir: tests diff --git a/tests/pyproject.toml b/tests/pyproject.toml index e58eb581ca..dbb693d753 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -33,3 +33,6 @@ pyodide.test-groups = ["numpy", "scipy"] ios.test-groups = ["numpy"] ios.xbuild-tools = ["cmake", "ninja"] ios.environment.PIP_EXTRA_INDEX_URL = "https://pypi.anaconda.org/beeware/simple" +android.test-groups = ["numpy"] +android.xbuild-tools = ["cmake", "ninja"] +android.environment.PIP_EXTRA_INDEX_URL = "https://chaquo.com/pypi-13.1" From 86b9571c7105e8d2e7d2496607857af2c75e7f0f Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 12 Jun 2025 04:57:17 +0100 Subject: [PATCH 02/13] Fix Android tests (#23) * Android tests working * Clarifications --- tests/env.py | 1 + tests/pyproject.toml | 4 +--- tests/test_exceptions.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/env.py b/tests/env.py index d234c425d4..95cc1ac611 100644 --- a/tests/env.py +++ b/tests/env.py @@ -6,6 +6,7 @@ import pytest +ANDROID = sys.platform.startswith("android") LINUX = sys.platform.startswith("linux") MACOS = sys.platform.startswith("darwin") WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin") diff --git a/tests/pyproject.toml b/tests/pyproject.toml index dbb693d753..c91388ca0d 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -33,6 +33,4 @@ pyodide.test-groups = ["numpy", "scipy"] ios.test-groups = ["numpy"] ios.xbuild-tools = ["cmake", "ninja"] ios.environment.PIP_EXTRA_INDEX_URL = "https://pypi.anaconda.org/beeware/simple" -android.test-groups = ["numpy"] -android.xbuild-tools = ["cmake", "ninja"] -android.environment.PIP_EXTRA_INDEX_URL = "https://chaquo.com/pypi-13.1" +android.environment.ANDROID_API_LEVEL = "24" # Needed to include libc++ in the wheel. diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 921540194a..79b3879034 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -76,7 +76,7 @@ def test_cross_module_exceptions(msg): # TODO: FIXME @pytest.mark.xfail( - "env.MACOS and env.PYPY", + "(env.MACOS and env.PYPY) or env.ANDROID", raises=RuntimeError, reason="See Issue #2847, PR #2999, PR #4324", strict=not env.PYPY, # PR 5569 From 1a3f4db472a7faade885cae1b18652d8ea502a6b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 12 Jun 2025 00:29:17 -0400 Subject: [PATCH 03/13] ci: only use fork on Android Signed-off-by: Henry Schreiner --- .github/workflows/tests-cibw.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index e706e3213b..8a28658d50 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: mhsmith/cibuildwheel@android + - uses: pypa/cibuildwheel@3.0 env: PYODIDE_BUILD_EXPORTS: whole_archive with: @@ -44,7 +44,7 @@ jobs: - run: brew upgrade cmake - - uses: mhsmith/cibuildwheel@android + - uses: pypa/cibuildwheel@3.0 env: CIBW_PLATFORM: ios with: @@ -66,5 +66,6 @@ jobs: - uses: mhsmith/cibuildwheel@android env: CIBW_PLATFORM: android + CIBW_ENVIRONMENT_ANDROID: ANDROID_API_LEVEL="24" with: package-dir: tests From e7c9f79c12d98e8a1f33fc9f14e7c1672e1026be Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 12 Jun 2025 00:29:36 -0400 Subject: [PATCH 04/13] ci: add wheel (missing) Signed-off-by: Henry Schreiner --- .github/workflows/tests-cibw.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 8a28658d50..fa72995881 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -63,6 +63,8 @@ jobs: submodules: true fetch-depth: 0 + - run: pipx install wheel + - uses: mhsmith/cibuildwheel@android env: CIBW_PLATFORM: android From 91c37708ff74de2f047b76a0697a3f20277ebb9c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 12 Jun 2025 00:36:05 -0400 Subject: [PATCH 05/13] ci: no patchelf? Signed-off-by: Henry Schreiner --- .github/workflows/tests-cibw.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index fa72995881..25f5a47b77 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: pypa/cibuildwheel@3.0 + - uses: pypa/cibuildwheel@v3.0 env: PYODIDE_BUILD_EXPORTS: whole_archive with: @@ -44,7 +44,7 @@ jobs: - run: brew upgrade cmake - - uses: pypa/cibuildwheel@3.0 + - uses: pypa/cibuildwheel@v3.0 env: CIBW_PLATFORM: ios with: @@ -63,7 +63,7 @@ jobs: submodules: true fetch-depth: 0 - - run: pipx install wheel + - run: pipx install wheel patchelf - uses: mhsmith/cibuildwheel@android env: From 76af8d20956206fae75b32ce2460aa294e6ea8c3 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 12 Jun 2025 00:38:34 -0400 Subject: [PATCH 06/13] ci: forgot pyproject android mention Signed-off-by: Henry Schreiner --- .github/workflows/tests-cibw.yml | 1 + tests/pyproject.toml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 25f5a47b77..46729d840f 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -68,6 +68,7 @@ jobs: - uses: mhsmith/cibuildwheel@android env: CIBW_PLATFORM: android + # Needed to include C++ in the wheel CIBW_ENVIRONMENT_ANDROID: ANDROID_API_LEVEL="24" with: package-dir: tests diff --git a/tests/pyproject.toml b/tests/pyproject.toml index c91388ca0d..e58eb581ca 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -33,4 +33,3 @@ pyodide.test-groups = ["numpy", "scipy"] ios.test-groups = ["numpy"] ios.xbuild-tools = ["cmake", "ninja"] ios.environment.PIP_EXTRA_INDEX_URL = "https://pypi.anaconda.org/beeware/simple" -android.environment.ANDROID_API_LEVEL = "24" # Needed to include libc++ in the wheel. From f08eae3013baf8baaccff4f0e5ddade0b38c036d Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Wed, 16 Jul 2025 12:59:01 +0100 Subject: [PATCH 07/13] Fix GHA configuration --- .github/workflows/tests-cibw.yml | 17 ++++++++++++++--- tests/pyproject.toml | 7 +++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 46729d840f..dd939439f4 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -63,12 +63,23 @@ jobs: submodules: true fetch-depth: 0 + # GitHub Actions can't currently run the Android emulator on macOS. + - name: Skip Android tests on macOS + if: contains(matrix.runs-on, 'macos') + run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV" + + # https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/ + - name: Enable KVM for Android emulator + if: contains(matrix.runs-on, 'ubuntu') + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - run: pipx install wheel patchelf - - uses: mhsmith/cibuildwheel@android + - uses: mhsmith/cibuildwheel@android # TODO: update to a released version env: CIBW_PLATFORM: android - # Needed to include C++ in the wheel - CIBW_ENVIRONMENT_ANDROID: ANDROID_API_LEVEL="24" with: package-dir: tests diff --git a/tests/pyproject.toml b/tests/pyproject.toml index e58eb581ca..fa478122d3 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -1,5 +1,6 @@ -# Warning: this is currently used for pyodide, and is not a general out-of-tree -# builder for the tests (yet). Specifically, wheels can't be built from SDists. +# Warning: this is currently used to test cross-compilation, and is not a general +# out-of-tree builder for the tests (yet). Specifically, wheels can't be built from +# SDists. [build-system] requires = ["scikit-build-core"] @@ -29,6 +30,8 @@ test-sources = ["tests", "pyproject.toml"] test-command = "python -m pytest -o timeout=0 -p no:cacheprovider tests" environment.PIP_ONLY_BINARY = "numpy" environment.PIP_PREFER_BINARY = "1" + +android.environment.ANDROID_API_LEVEL = "24" # Needed to include libc++ in the wheel. pyodide.test-groups = ["numpy", "scipy"] ios.test-groups = ["numpy"] ios.xbuild-tools = ["cmake", "ninja"] From 1e3e1f38ea1a9398d83cd74e36fcc7966dec328f Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 24 Jul 2025 15:45:11 +0100 Subject: [PATCH 08/13] Update to cibuildwheel 3.1 --- .github/workflows/tests-cibw.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index dd939439f4..2ac311c81a 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: pypa/cibuildwheel@v3.0 + - uses: pypa/cibuildwheel@v3.1 env: PYODIDE_BUILD_EXPORTS: whole_archive with: @@ -44,7 +44,7 @@ jobs: - run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.0 + - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: ios with: @@ -76,9 +76,9 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - run: pipx install wheel patchelf + - run: pipx install patchelf - - uses: mhsmith/cibuildwheel@android # TODO: update to a released version + - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: android with: From 68b2542962bd4d7672b7b0697bd227bd21872c71 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 24 Jul 2025 18:52:47 +0100 Subject: [PATCH 09/13] Restore installation of "wheel" --- .github/workflows/tests-cibw.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 2ac311c81a..787e45699f 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -76,7 +76,9 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - run: pipx install patchelf + # TODO: remove "wheel" once we're using a cibuildwheel version that includes + # https://github.com/pypa/cibuildwheel/pull/2515. + - run: pipx install wheel patchelf - uses: pypa/cibuildwheel@v3.1 env: From 452e59058df51718050eb8cc11afe63f0e79f3ac Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 24 Jul 2025 19:14:20 +0100 Subject: [PATCH 10/13] Revert iOS to cibuildwheel 3.0 --- .github/workflows/tests-cibw.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 787e45699f..d003c65cd5 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: pypa/cibuildwheel@v3.1 + - uses: pypa/cibuildwheel@v3.0 env: PYODIDE_BUILD_EXPORTS: whole_archive with: From ea5c2fb8537cf1ed2ea7a82d4a7578ea7356a35b Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 24 Jul 2025 19:17:48 +0100 Subject: [PATCH 11/13] Actually revert iOS back to cibuildwheel 3.0 --- .github/workflows/tests-cibw.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index d003c65cd5..fbd3c64de6 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -22,7 +22,7 @@ jobs: submodules: true fetch-depth: 0 - - uses: pypa/cibuildwheel@v3.0 + - uses: pypa/cibuildwheel@v3.1 env: PYODIDE_BUILD_EXPORTS: whole_archive with: @@ -44,7 +44,7 @@ jobs: - run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.1 + - uses: pypa/cibuildwheel@v3.0 env: CIBW_PLATFORM: ios with: From 1e94d97a2c17b589d99e9d42c1ab98892d6d28a5 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Thu, 24 Jul 2025 19:24:44 +0100 Subject: [PATCH 12/13] Restore iOS to cibuildwheel 3.1, and skip Python 3.14 instead --- .github/workflows/tests-cibw.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index fbd3c64de6..7ac22b4bda 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -44,9 +44,10 @@ jobs: - run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.0 + - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: ios + CIBW_SKIP: cp314-* # https://github.com/pypa/cibuildwheel/issues/2494 with: package-dir: tests From 8fd25d6fd97b93b873fad9f1b8ce5cc36a4e8bd8 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 09:18:23 -0600 Subject: [PATCH 13/13] Update .github/workflows/tests-cibw.yml --- .github/workflows/tests-cibw.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 7ac22b4bda..5e77473393 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -77,9 +77,7 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - # TODO: remove "wheel" once we're using a cibuildwheel version that includes - # https://github.com/pypa/cibuildwheel/pull/2515. - - run: pipx install wheel patchelf + - run: pipx install patchelf - uses: pypa/cibuildwheel@v3.1 env: