Skip to content

test: add pytest-cov coverage reporting to CI (#55)#239

Merged
param20h merged 2 commits into
param20h:devfrom
aayushprsingh:test/ci-coverage-issue55
Jun 2, 2026
Merged

test: add pytest-cov coverage reporting to CI (#55)#239
param20h merged 2 commits into
param20h:devfrom
aayushprsingh:test/ci-coverage-issue55

Conversation

@aayushprsingh
Copy link
Copy Markdown
Contributor

@aayushprsingh aayushprsingh commented May 30, 2026

📋 PR Checklist

Thank you for contributing to PDF-Assistant-RAG! 🎉
Please fill out this template before submitting. PRs without it filled in will be closed.


🔗 Related Issue

Closes #55


📝 What does this PR do?

Configures pytest-cov in the CI pipeline and adds a coverage reporting step to .github/workflows/ci.yml.
Adjusts the coverage failure threshold parameter --cov-fail-under to 40 to match the repository's current coverage baseline (42.25%), preventing build failures while ensuring future changes don't decrease coverage significantly.


🗂️ Type of Change

  • ⚙️ CI / tooling / config change
  • 🧪 Tests

🧪 How was this tested?

  • Ran the backend locally (uvicorn app.main:app --reload)
  • Added / updated tests

📸 Screenshots (if UI change)


⚠️ Anything to flag for reviewers?

The initial PR setup tried to enforce 60% backend test coverage, which was failing the build because the repo's baseline is ~42.25%. We updated the failure threshold to 40% to align with the current project codebase.


✅ Self-Review Checklist

  • My branch is based on dev, not main
  • I have not added any secrets / API keys
  • I have not modified main branch or any HuggingFace deployment config
  • My code follows the existing style (no unnecessary formatting changes)
  • I have updated relevant docs / comments if needed

@aayushprsingh aayushprsingh requested a review from param20h as a code owner May 30, 2026 14:24
Copilot AI review requested due to automatic review settings May 30, 2026 14:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Python test coverage reporting to the backend CI workflow, including artifact upload and PR comment integration.

Changes:

  • Installs pytest-cov and runs pytest with coverage thresholds (fail under 60%).
  • Uploads coverage XML and HTML reports as workflow artifacts.
  • Posts a coverage summary comment on pull requests via py-cov-action/python-coverage-comment-action@v3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +58 to +59
- name: Install pytest-cov
run: pip install pytest-cov
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +70 to +75
pytest backend/tests -v \
--cov=backend/app \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--cov-fail-under=60
Comment thread .github/workflows/ci.yml
Comment on lines +87 to +94
- name: Coverage summary comment (PR only)
if: github.event_name == 'pull_request'
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 60
MINIMUM_ORANGE: 40
continue-on-error: true
Comment thread .github/workflows/ci.yml
Comment on lines +87 to +89
- name: Coverage summary comment (PR only)
if: github.event_name == 'pull_request'
uses: py-cov-action/python-coverage-comment-action@v3
Comment thread .github/workflows/ci.yml
Comment on lines +69 to +79
run: |
pytest backend/tests -v \
--cov=backend/app \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--cov-fail-under=60

- name: Upload coverage XML report
if: always()
uses: actions/upload-artifact@v4
Comment thread .github/workflows/ci.yml
Comment on lines +81 to +84
name: coverage-report
path: |
coverage.xml
htmlcov/
@aayushprsingh aayushprsingh force-pushed the test/ci-coverage-issue55 branch from 8a69c01 to 2749f4f Compare June 2, 2026 02:56
@aayushprsingh
Copy link
Copy Markdown
Contributor Author

Hi @param20h, I've rebased this PR on the latest dev branch, and adjusted the test coverage threshold to 40% to align with the current repository baseline (~42.25%). All checks are now fully passing. Could you please review and merge? Thanks!

@param20h param20h merged commit 4aee457 into param20h:dev Jun 2, 2026
6 checks passed
@github-actions github-actions Bot added devops CI/CD, Docker, infra gssoc GirlScript Summer of Code 2026 issue/PR gssoc:approved Approved for GSSoC base points (+50 pts) medium Medium difficulty mentor:param20h Mentor for this PR testing Tests — unit, integration, E2E labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops CI/CD, Docker, infra gssoc:approved Approved for GSSoC base points (+50 pts) gssoc GirlScript Summer of Code 2026 issue/PR medium Medium difficulty mentor:param20h Mentor for this PR testing Tests — unit, integration, E2E

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add test coverage reporting to CI

3 participants