tests.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Offline Unit Tests
  2. on:
  3. push:
  4. branches: [ main, dev ]
  5. pull_request:
  6. branches: [ main, dev ]
  7. types: [opened, synchronize, reopened, ready_for_review]
  8. jobs:
  9. offline-tests:
  10. name: Offline Tests
  11. if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. python-version: ['3.12', '3.14']
  16. steps:
  17. - uses: actions/checkout@v6
  18. - name: Set up Python ${{ matrix.python-version }}
  19. uses: actions/setup-python@v6
  20. with:
  21. python-version: ${{ matrix.python-version }}
  22. - name: Cache pip packages
  23. uses: actions/cache@v5
  24. with:
  25. path: ~/.cache/pip
  26. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml') }}
  27. restore-keys: |
  28. ${{ runner.os }}-pip-
  29. - name: Install dependencies
  30. run: |
  31. python -m pip install --upgrade pip
  32. # Install optional-storage and optional-llm deps too — the offline
  33. # test suite contains mock-based unit tests that construct real
  34. # data classes from these libraries (qdrant-client, pymongo,
  35. # anthropic, boto3, etc.). Without them, importorskip falls back
  36. # and the tests are silently skipped.
  37. pip install -e ".[api,offline-storage,offline-llm]"
  38. pip install pytest pytest-asyncio
  39. - name: Run offline tests
  40. run: |
  41. # Run only tests marked as 'offline' (no external dependencies)
  42. # Integration tests requiring databases/APIs are skipped by default
  43. pytest tests/ -m offline -v --tb=short
  44. - name: Upload test results
  45. if: always()
  46. uses: actions/upload-artifact@v7
  47. with:
  48. name: test-results-py${{ matrix.python-version }}
  49. path: |
  50. .pytest_cache/
  51. test-results.xml
  52. retention-days: 7