Skip to content

release: prepare PocketStation for Python 0.1.2 #48

release: prepare PocketStation for Python 0.1.2

release: prepare PocketStation for Python 0.1.2 #48

Workflow file for this run

name: python-sdk-ci
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
env:
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
jobs:
test:
name: ${{ matrix.os }} / Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.11", "3.13"]
steps:
- name: Check out Python SDK
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: sdk-python
- name: Install Rust 1.95
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
with:
toolchain: 1.95.0
components: clippy, rustfmt
- name: Install Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
with:
python-version: ${{ matrix.python }}
- name: Install Linux native dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --yes libasound2-dev libpipewire-0.3-dev
- name: Install SDK and development gates
working-directory: sdk-python
run: |
python -m pip install --upgrade pip
python -m pip install "maturin>=1.9.4,<2.0" "pytest>=8.0" "pytest-asyncio>=0.23" "mypy>=1.15" "ruff>=0.11" "websockets>=17.0,<18"
maturin build --release --locked --features conformance-fixtures --out dist-conformance
python -c "from pathlib import Path; import subprocess, sys; wheel = next(Path('dist-conformance').glob('*.whl')); subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--force-reinstall', str(wheel)])"
- name: Rust formatting
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.11'
working-directory: sdk-python
run: cargo fmt --manifest-path native/Cargo.toml -- --check
- name: Native conformance
working-directory: sdk-python
run: cargo test --manifest-path native/Cargo.toml --all-features --locked
- name: Native lint
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.11'
working-directory: sdk-python
run: cargo clippy --manifest-path native/Cargo.toml --all-targets --all-features --locked -- -D warnings
- name: Python lint and formatting
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.11'
working-directory: sdk-python
run: |
ruff check python tests examples
ruff format --check python tests examples
- name: Python type contract
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.11'
working-directory: sdk-python
run: mypy python examples tests/qualification
- name: Python tests
working-directory: sdk-python
run: python -m pytest
- name: Build wheel
working-directory: sdk-python
run: maturin build --release --locked --out dist
- name: Test isolated release wheel
working-directory: sdk-python
run: >-
python tests/run_artifact_consumer.py
--artifact-kind wheel
--artifact-dir dist
- name: Upload wheel for inspection
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pocketstation-${{ matrix.os }}-py${{ matrix.python }}
path: sdk-python/dist/*.whl
if-no-files-found: error
sdist:
name: source distribution / Python 3.11
runs-on: ubuntu-latest
steps:
- name: Check out Python SDK
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: sdk-python
- name: Install Rust 1.95
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
with:
toolchain: 1.95.0
- name: Install Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1
with:
python-version: "3.11"
- name: Install Linux native dependencies
run: |
sudo apt-get update
sudo apt-get install --yes libasound2-dev libpipewire-0.3-dev
- name: Build source distribution
working-directory: sdk-python
run: |
python -m pip install --upgrade pip
python -m pip install "maturin>=1.9.4,<2.0"
maturin sdist --manifest-path native/Cargo.toml --out dist
- name: Rebuild and test isolated source distribution
working-directory: sdk-python
run: >-
python tests/run_artifact_consumer.py
--artifact-kind sdist
--artifact-dir dist
- name: Upload source distribution for inspection
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pocketstation-sdist
path: sdk-python/dist/*.tar.gz
if-no-files-found: error