diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e66697..174cb55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [main] + branches: [master] pull_request: - branches: [main] + branches: [master] permissions: contents: read @@ -19,32 +19,79 @@ jobs: - run: uv run ruff check warp_cache/ tests/ benchmarks/ - run: uv run ty check - test: + clippy: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Build extension - uses: PyO3/maturin-action@v1 + - uses: dtolnay/rust-toolchain@stable with: - args: --release --out dist -i python${{ matrix.python-version }} - - name: Install wheel and dev deps - run: | - uv venv --python ${{ matrix.python-version }} - uv pip install dist/*.whl - uv pip install pytest pytest-asyncio - - run: uv run pytest tests/ -v + components: clippy + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy -- -D warnings - clippy: - runs-on: ubuntu-latest + clippy-windows: + runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: clippy + - uses: Swatinem/rust-cache@v2 - run: cargo clippy -- -D warnings + + test: + needs: [lint, clippy] + strategy: + fail-fast: false + matrix: + include: + # Linux x86_64 — full Python coverage + - os: ubuntu-latest + python-version: "3.10" + - os: ubuntu-latest + python-version: "3.11" + - os: ubuntu-latest + python-version: "3.12" + - os: ubuntu-latest + python-version: "3.13" + # Linux arm64 — boundary versions + - os: ubuntu-24.04-arm + python-version: "3.10" + - os: ubuntu-24.04-arm + python-version: "3.13" + # macOS arm64 — boundary versions + - os: macos-latest + python-version: "3.10" + - os: macos-latest + python-version: "3.13" + # Windows x86_64 — boundary versions + - os: windows-latest + python-version: "3.10" + - os: windows-latest + python-version: "3.13" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }}-py${{ matrix.python-version }} + - uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install build and test deps + run: uv pip install maturin pytest pytest-asyncio + - name: Build extension + run: uv run maturin develop --release + - name: Run tests + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]]; then + uv run pytest tests/ -v \ + --ignore=tests/test_shared_basic.py \ + --ignore=tests/test_shared_multiprocess.py \ + --ignore=tests/test_shared_realistic.py \ + -k "not (TestSharedComplex or async_shared_backend)" + else + uv run pytest tests/ -v + fi diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..f7208b2 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,5 @@ +import sys + +collect_ignore_glob = [] +if sys.platform == "win32": + collect_ignore_glob = ["test_shared_*.py"] diff --git a/tests/test_async.py b/tests/test_async.py index bf62e1c..52cf780 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -1,4 +1,5 @@ import asyncio +import sys import pytest @@ -143,6 +144,7 @@ async def fn(x): # ── Shared backend ─────────────────────────────────────────────────────── +@pytest.mark.skipif(sys.platform == "win32", reason="shared memory is Unix-only") @pytest.mark.asyncio async def test_async_shared_backend(): call_count = 0 diff --git a/tests/test_complex_objects.py b/tests/test_complex_objects.py index 088010b..7f70c86 100644 --- a/tests/test_complex_objects.py +++ b/tests/test_complex_objects.py @@ -3,11 +3,16 @@ import contextlib import glob import os +import sys import tempfile from dataclasses import dataclass +import pytest + from warp_cache import cache +_skip_on_windows = pytest.mark.skipif(sys.platform == "win32", reason="shared memory is Unix-only") + # --------------------------------------------------------------------------- # Helpers # --------------------------------------------------------------------------- @@ -244,6 +249,7 @@ def f(a, b, c, d, e): # =========================================================================== +@_skip_on_windows class TestSharedComplexValues: def setup_method(self): _cleanup_shm() @@ -315,6 +321,7 @@ def mixed(): assert mixed() == result +@_skip_on_windows class TestSharedComplexKeys: def setup_method(self): _cleanup_shm()