Skip to content

ci: integrate Codecov and pytest-cov #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

include:
- os: ubuntu-latest
python-version: "3.13"
coverage: true

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Locate pip cache
id: pip-cache
shell: bash
Expand All @@ -36,15 +42,37 @@ jobs:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"

- name: Run tests
if: ${{ matrix.coverage != true }}
run: pytest

# Run pre-commit only on Python 3.13 + ubuntu.
- name: Run tests and collect coverage
if: ${{ matrix.coverage == true }}
run: |
pytest \
--cov=gitingest \
--cov=server \
--cov-branch \
--cov-report=xml \
--cov-report=term

- name: Upload coverage to Codecov
if: ${{ matrix.coverage == true }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: ${{ matrix.os }}-py${{ matrix.python-version }}
name: codecov-${{ matrix.os }}-${{ matrix.python-version }}
fail_ci_if_error: true
verbose: true

- name: Run pre-commit hooks
uses: pre-commit/[email protected]
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<br>
<!-- row 2 — quality & community -->
<a href="https://github.com/coderamp-labs/gitingest/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/coderamp-labs/gitingest/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
<!-- <a href="https://codecov.io/gh/coderamp-labs/gitingest"><img src="https://codecov.io/gh/coderamp-labs/gitingest/graph/badge.svg" alt="Code Coverage"></a> -->
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
<a href="https://scorecard.dev/viewer/?uri=github.com/coderamp-labs/gitingest"><img src="https://api.scorecard.dev/projects/github.com/coderamp-labs/gitingest/badge" alt="OpenSSF Scorecard"></a>
<br>
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dev = [
"pre-commit",
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-mock",
]

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ eval-type-backport
pre-commit
pytest
pytest-asyncio
pytest-cov
pytest-mock
Loading