diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12338cb..09e7ef8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,20 @@ jobs: python-version: "3.11" cache: pip - run: pip install -r requirements.txt - - run: pytest tests/ -v --tb=short + # Coverage is scoped to production code: backend/.coveragerc omits + # tests/ so the gate reflects untested application code (with tests + # included the total was ~66%; production-only it is ~51%). + - run: | + pytest tests/ -v --tb=short \ + --cov=. \ + --cov-report=xml \ + --cov-report=term-missing \ + --cov-fail-under=50 + - uses: actions/upload-artifact@v4 + if: always() + with: + name: backend-coverage + path: backend/coverage.xml backend-security: name: Backend Security Scan diff --git a/backend/.coveragerc b/backend/.coveragerc new file mode 100644 index 0000000..a7cba45 --- /dev/null +++ b/backend/.coveragerc @@ -0,0 +1,3 @@ +[run] +omit = + tests/* diff --git a/backend/requirements.txt b/backend/requirements.txt index 37850d1..4f260ed 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -26,6 +26,7 @@ nbformat>=5.10.0 jupyter_client>=8.6.0 pytest>=9.0.0 pytest-asyncio>=1.3.0 +pytest-cov>=6.0.0 httpx>=0.28.0 # Paper + web search backends