Skip to content

Commit 23c59b6

Browse files
henryiiimhsmith
andauthored
ci: add android test (#5714)
* ci: add android test Signed-off-by: Henry Schreiner <[email protected]> * Fix Android tests (#23) * Android tests working * Clarifications * ci: only use fork on Android Signed-off-by: Henry Schreiner <[email protected]> * ci: add wheel (missing) Signed-off-by: Henry Schreiner <[email protected]> * ci: no patchelf? Signed-off-by: Henry Schreiner <[email protected]> * ci: forgot pyproject android mention Signed-off-by: Henry Schreiner <[email protected]> * Fix GHA configuration * Update to cibuildwheel 3.1 * Restore installation of "wheel" * Revert iOS to cibuildwheel 3.0 * Actually revert iOS back to cibuildwheel 3.0 * Restore iOS to cibuildwheel 3.1, and skip Python 3.14 instead * Update .github/workflows/tests-cibw.yml --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: Malcolm Smith <[email protected]>
1 parent a5665e3 commit 23c59b6

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

.github/workflows/tests-cibw.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ jobs:
2222
submodules: true
2323
fetch-depth: 0
2424

25-
- uses: pypa/cibuildwheel@v3.0
25+
- uses: pypa/cibuildwheel@v3.1
2626
env:
2727
PYODIDE_BUILD_EXPORTS: whole_archive
2828
with:
2929
package-dir: tests
3030
only: cp312-pyodide_wasm32
3131

3232
build-ios:
33-
name: iOS wheel
34-
runs-on: macos-latest
33+
name: iOS wheel ${{ matrix.runs-on }}
34+
runs-on: ${{ matrix.runs-on }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
runs-on: [macos-latest, macos-13]
3539
steps:
3640
- uses: actions/checkout@v4
3741
with:
@@ -40,8 +44,43 @@ jobs:
4044

4145
- run: brew upgrade cmake
4246

43-
- uses: pypa/cibuildwheel@v3.0
47+
- uses: pypa/cibuildwheel@v3.1
4448
env:
4549
CIBW_PLATFORM: ios
50+
CIBW_SKIP: cp314-* # https://github.com/pypa/cibuildwheel/issues/2494
51+
with:
52+
package-dir: tests
53+
54+
build-android:
55+
name: Android wheel ${{ matrix.runs-on }}
56+
runs-on: ${{ matrix.runs-on }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
runs-on: [macos-latest, macos-13, ubuntu-latest]
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
submodules: true
65+
fetch-depth: 0
66+
67+
# GitHub Actions can't currently run the Android emulator on macOS.
68+
- name: Skip Android tests on macOS
69+
if: contains(matrix.runs-on, 'macos')
70+
run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV"
71+
72+
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
73+
- name: Enable KVM for Android emulator
74+
if: contains(matrix.runs-on, 'ubuntu')
75+
run: |
76+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
77+
sudo udevadm control --reload-rules
78+
sudo udevadm trigger --name-match=kvm
79+
80+
- run: pipx install patchelf
81+
82+
- uses: pypa/[email protected]
83+
env:
84+
CIBW_PLATFORM: android
4685
with:
4786
package-dir: tests

tests/env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import pytest
88

9+
ANDROID = sys.platform.startswith("android")
910
LINUX = sys.platform.startswith("linux")
1011
MACOS = sys.platform.startswith("darwin")
1112
WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin")

tests/pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Warning: this is currently used for pyodide, and is not a general out-of-tree
2-
# builder for the tests (yet). Specifically, wheels can't be built from SDists.
1+
# Warning: this is currently used to test cross-compilation, and is not a general
2+
# out-of-tree builder for the tests (yet). Specifically, wheels can't be built from
3+
# SDists.
34

45
[build-system]
56
requires = ["scikit-build-core"]
@@ -29,6 +30,8 @@ test-sources = ["tests", "pyproject.toml"]
2930
test-command = "python -m pytest -o timeout=0 -p no:cacheprovider tests"
3031
environment.PIP_ONLY_BINARY = "numpy"
3132
environment.PIP_PREFER_BINARY = "1"
33+
34+
android.environment.ANDROID_API_LEVEL = "24" # Needed to include libc++ in the wheel.
3235
pyodide.test-groups = ["numpy", "scipy"]
3336
ios.test-groups = ["numpy"]
3437
ios.xbuild-tools = ["cmake", "ninja"]

tests/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_cross_module_exceptions(msg):
7676

7777
# TODO: FIXME
7878
@pytest.mark.xfail(
79-
"env.MACOS and env.PYPY",
79+
"(env.MACOS and env.PYPY) or env.ANDROID",
8080
raises=RuntimeError,
8181
reason="See Issue #2847, PR #2999, PR #4324",
8282
strict=not env.PYPY, # PR 5569

0 commit comments

Comments
 (0)