GitHub Viewer
name: CI
on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.13', '3.14']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up uv (Python ${{ matrix.python-version }})
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --locked --group dev
- name: Lint (Ruff)
run: uv run ruff check .
- name: Format check (Black)
run: uv run black --check src examples tests
- name: Type check (MyPy)
run: uv run mypy
# Produces the sdist and wheel through the setuptools backend. Note
# this builds but does not install them, so the previous non-editable
# install smoke test is not replaced.
- name: Build package
run: uv build
- name: Run tests
run: uv run pytest -q
# The Swift half of the rendering core: decoders, component managers,
# gestures, and module promises run under XCTest on a simulator.
native-ios:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
# Runner images ship different simulator sets, and xcodebuild
# silently falls back to "My Mac" (where UIKit doesn't exist) when
# a named destination is missing, so resolve an available iPhone
# simulator by UDID instead of hardcoding a model name.
- name: Run PythonNativeKit tests
working-directory: src/pythonnative/native/ios
run: |
set -o pipefail
UDID="$(xcrun simctl list devices available -j | python3 -c '
import json, sys
data = json.load(sys.stdin)["devices"]
phones = [
d for runtime, devices in sorted(data.items()) if "iOS" in runtime
for d in devices if d.get("isAvailable") and d["name"].startswith("iPhone")
]
if not phones:
sys.exit("no available iPhone simulator on this runner")
print(phones[-1]["udid"])
')"
echo "Using simulator $UDID"
xcodebuild test \
-scheme PythonNativeKit \
-destination "platform=iOS Simulator,id=$UDID" \
-derivedDataPath "$RUNNER_TEMP/pnkit" \
-quiet
# The Kotlin half has no Chaquopy dependency, so plain JUnit covers it.
native-android:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run pythonnative module tests
working-directory: src/pythonnative/native/android
run: ../../templates/android_template/gradlew testDebugUnitTest --no-daemon