mirror of
https://github.com/cyclotruc/gitingest.git
synced 2026-04-26 14:10:47 +00:00
ci: integrate Codecov and pytest-cov (#405)
This commit is contained in:
parent
fa2e192c05
commit
03b015059c
4 changed files with 32 additions and 1 deletions
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
|
|
@ -18,6 +18,11 @@ 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
|
||||
|
||||
|
|
@ -25,6 +30,7 @@ jobs:
|
|||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Locate pip cache
|
||||
id: pip-cache
|
||||
shell: bash
|
||||
|
|
@ -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/action@v3.0.1
|
||||
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ dev = [
|
|||
"pre-commit",
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-cov",
|
||||
"pytest-mock",
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ eval-type-backport
|
|||
pre-commit
|
||||
pytest
|
||||
pytest-asyncio
|
||||
pytest-cov
|
||||
pytest-mock
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue