diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 75bf1985..d4627f20 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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' }}
diff --git a/README.md b/README.md
index 314f3a8a..7cb4d537 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@
+
diff --git a/pyproject.toml b/pyproject.toml
index e70e7caa..3095339b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,6 +42,7 @@ dev = [
"pre-commit",
"pytest",
"pytest-asyncio",
+ "pytest-cov",
"pytest-mock",
]
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 60dc6b5f..ae135ffe 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -3,4 +3,5 @@ eval-type-backport
pre-commit
pytest
pytest-asyncio
+pytest-cov
pytest-mock