Add lint github action

This commit is contained in:
Yiorgis Gozadinos 2025-12-26 19:35:24 +02:00
parent b64a2b08ee
commit 5844d07c5d
No known key found for this signature in database
3 changed files with 35 additions and 4 deletions

View file

@ -7,7 +7,26 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies
run: uv sync --all-extras
- name: Lint
run: uv run ruff check
- name: Type check
run: uv run pyright
test: test:
needs: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -22,7 +41,3 @@ jobs:
run: uv sync --all-extras run: uv sync --all-extras
- name: Run tests - name: Run tests
run: uv run pytest run: uv run pytest
- name: Type check
run: uv run pyright
- name: Lint
run: uv run ruff check

View file

@ -1,6 +1,18 @@
# Changelog # Changelog
## [Unreleased] ## [Unreleased]
### Added
- **GitHub Actions CI**: Test workflow runs pytest, pyright, and ruff on push/PR to main
- **VCR Cassette Recording**: Integration tests use recorded HTTP responses for deterministic CI runs
- LLM tests (QA, embeddings, research graph) replay from cassettes without real API calls
- docling-serve tests run without Docker container in CI
- Uses pytest-recording with custom JSON body serializer
### Removed
- Removed obsolete `test_config_validation_on_db_load` test (chunk_size changes don't invalidate database)
## [0.23.0] - 2025-12-26 ## [0.23.0] - 2025-12-26
### Added ### Added

View file

@ -1,3 +1,4 @@
import importlib.util
from pathlib import Path from pathlib import Path
import pytest import pytest
@ -8,6 +9,8 @@ from haiku.rag.client import HaikuRAG
from haiku.rag.config.models import ModelConfig from haiku.rag.config.models import ModelConfig
from haiku.rag.qa.agent import QuestionAnswerAgent from haiku.rag.qa.agent import QuestionAnswerAgent
HAS_ANTHROPIC = importlib.util.find_spec("anthropic") is not None
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def vcr_cassette_dir(): def vcr_cassette_dir():
@ -63,6 +66,7 @@ async def test_qa_openai(allow_model_requests, qa_corpus: Dataset, temp_db_path)
@pytest.mark.vcr() @pytest.mark.vcr()
@pytest.mark.skipif(not HAS_ANTHROPIC, reason="Anthropic not installed")
async def test_qa_anthropic(allow_model_requests, qa_corpus: Dataset, temp_db_path): async def test_qa_anthropic(allow_model_requests, qa_corpus: Dataset, temp_db_path):
"""Test Anthropic QA with LLM judge (VCR recorded).""" """Test Anthropic QA with LLM judge (VCR recorded)."""
client = HaikuRAG(temp_db_path, create=True) client = HaikuRAG(temp_db_path, create=True)