Spaces:
Running
Running
Commit
Β·
e70a3b7
1
Parent(s):
c66250f
ci: upgrade to ironclad CI/CD configuration
Browse files- Upgrade setup-uv@v4 β v7 with built-in caching (removes cache warning)
- Pin uv version to 0.5.6 for reproducible builds
- Add ruff format --check (enforces consistent formatting)
- Add --locked to uv sync (ensures lockfile integrity)
- Auto-format 4 files to pass new format check
.github/workflows/ci.yml
CHANGED
|
@@ -13,28 +13,25 @@ jobs:
|
|
| 13 |
steps:
|
| 14 |
- uses: actions/checkout@v4
|
| 15 |
|
| 16 |
-
- name: Cache uv packages
|
| 17 |
-
uses: actions/cache@v4
|
| 18 |
-
with:
|
| 19 |
-
path: ~/.cache/uv
|
| 20 |
-
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
|
| 21 |
-
restore-keys: |
|
| 22 |
-
${{ runner.os }}-uv-
|
| 23 |
-
|
| 24 |
- name: Install uv
|
| 25 |
-
uses: astral-sh/setup-uv@
|
| 26 |
with:
|
| 27 |
-
version: "
|
|
|
|
|
|
|
| 28 |
|
| 29 |
- name: Set up Python 3.11
|
| 30 |
run: uv python install 3.11
|
| 31 |
|
| 32 |
- name: Install dependencies
|
| 33 |
-
run: uv sync --all-extras
|
| 34 |
|
| 35 |
- name: Lint with ruff
|
| 36 |
run: uv run ruff check src tests
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
- name: Type check with mypy
|
| 39 |
run: uv run mypy src
|
| 40 |
|
|
|
|
| 13 |
steps:
|
| 14 |
- uses: actions/checkout@v4
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
- name: Install uv
|
| 17 |
+
uses: astral-sh/setup-uv@v7
|
| 18 |
with:
|
| 19 |
+
version: "0.5.6"
|
| 20 |
+
enable-cache: true
|
| 21 |
+
cache-dependency-glob: "uv.lock"
|
| 22 |
|
| 23 |
- name: Set up Python 3.11
|
| 24 |
run: uv python install 3.11
|
| 25 |
|
| 26 |
- name: Install dependencies
|
| 27 |
+
run: uv sync --all-extras --locked
|
| 28 |
|
| 29 |
- name: Lint with ruff
|
| 30 |
run: uv run ruff check src tests
|
| 31 |
|
| 32 |
+
- name: Format check with ruff
|
| 33 |
+
run: uv run ruff format --check src tests
|
| 34 |
+
|
| 35 |
- name: Type check with mypy
|
| 36 |
run: uv run mypy src
|
| 37 |
|
src/services/embedding_protocol.py
CHANGED
|
@@ -74,9 +74,7 @@ class EmbeddingServiceProtocol(Protocol):
|
|
| 74 |
"""
|
| 75 |
...
|
| 76 |
|
| 77 |
-
async def add_evidence(
|
| 78 |
-
self, evidence_id: str, content: str, metadata: dict[str, Any]
|
| 79 |
-
) -> None:
|
| 80 |
"""Store evidence with embeddings.
|
| 81 |
|
| 82 |
Args:
|
|
@@ -87,9 +85,7 @@ class EmbeddingServiceProtocol(Protocol):
|
|
| 87 |
"""
|
| 88 |
...
|
| 89 |
|
| 90 |
-
async def search_similar(
|
| 91 |
-
self, query: str, n_results: int = 5
|
| 92 |
-
) -> list[dict[str, Any]]:
|
| 93 |
"""Search for semantically similar content.
|
| 94 |
|
| 95 |
Args:
|
|
|
|
| 74 |
"""
|
| 75 |
...
|
| 76 |
|
| 77 |
+
async def add_evidence(self, evidence_id: str, content: str, metadata: dict[str, Any]) -> None:
|
|
|
|
|
|
|
| 78 |
"""Store evidence with embeddings.
|
| 79 |
|
| 80 |
Args:
|
|
|
|
| 85 |
"""
|
| 86 |
...
|
| 87 |
|
| 88 |
+
async def search_similar(self, query: str, n_results: int = 5) -> list[dict[str, Any]]:
|
|
|
|
|
|
|
| 89 |
"""Search for semantically similar content.
|
| 90 |
|
| 91 |
Args:
|
tests/unit/services/test_service_loader.py
CHANGED
|
@@ -60,6 +60,7 @@ class TestGetEmbeddingService:
|
|
| 60 |
|
| 61 |
# Make llamaindex_rag module raise ImportError on import
|
| 62 |
import sys
|
|
|
|
| 63 |
original_modules = dict(sys.modules)
|
| 64 |
|
| 65 |
# Remove llamaindex_rag if it exists
|
|
@@ -68,9 +69,7 @@ class TestGetEmbeddingService:
|
|
| 68 |
|
| 69 |
try:
|
| 70 |
# Patch to raise ImportError
|
| 71 |
-
mock_embed_module = MagicMock(
|
| 72 |
-
get_embedding_service=lambda: mock_local_service
|
| 73 |
-
)
|
| 74 |
with patch.dict(
|
| 75 |
"sys.modules",
|
| 76 |
{
|
|
|
|
| 60 |
|
| 61 |
# Make llamaindex_rag module raise ImportError on import
|
| 62 |
import sys
|
| 63 |
+
|
| 64 |
original_modules = dict(sys.modules)
|
| 65 |
|
| 66 |
# Remove llamaindex_rag if it exists
|
|
|
|
| 69 |
|
| 70 |
try:
|
| 71 |
# Patch to raise ImportError
|
| 72 |
+
mock_embed_module = MagicMock(get_embedding_service=lambda: mock_local_service)
|
|
|
|
|
|
|
| 73 |
with patch.dict(
|
| 74 |
"sys.modules",
|
| 75 |
{
|