Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 67 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [master]
pull_request:
branches: [main]
branches: [master]

permissions:
contents: read
Expand All @@ -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
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys

collect_ignore_glob = []
if sys.platform == "win32":
collect_ignore_glob = ["test_shared_*.py"]
2 changes: 2 additions & 0 deletions tests/test_async.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import sys

import pytest

Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/test_complex_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -244,6 +249,7 @@ def f(a, b, c, d, e):
# ===========================================================================


@_skip_on_windows
class TestSharedComplexValues:
def setup_method(self):
_cleanup_shm()
Expand Down Expand Up @@ -315,6 +321,7 @@ def mixed():
assert mixed() == result


@_skip_on_windows
class TestSharedComplexKeys:
def setup_method(self):
_cleanup_shm()
Expand Down