name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Verify package can be imported
run: |
python -c "from local_faiss_mcp import FAISSVectorStore; print('Package imported successfully')"
- name: Verify CLI command is installed
run: |
local-faiss-mcp --help
- name: Run all tests with pytest
run: |
pytest tests/ -v
- name: Test server initialization
run: |
python -c "
import sys
from pathlib import Path
from local_faiss_mcp import FAISSVectorStore
# Test basic initialization
store = FAISSVectorStore(
index_path='test.index',
metadata_path='test_metadata.json'
)
print('Vector store initialized')
# Cleanup
Path('test.index').unlink(missing_ok=True)
Path('test_metadata.json').unlink(missing_ok=True)
print('All initialization tests passed')
"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run ruff linter
run: |
ruff check . --exclude venv
continue-on-error: true
- name: Check Python syntax
run: |
python -m py_compile local_faiss_mcp/server.py local_faiss_mcp/__init__.py local_faiss_mcp/__main__.py tests/test_standalone.py tests/test_embedding_models.py