Skip to content

Commit f456dbc

Browse files
authored
Merge pull request #72 from mts-ai/feature/codecov
Add Codecov
2 parents d5ae48c + ef091fb commit f456dbc

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

.github/workflows/testing.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@ name: Python testing
22

33
on:
44
push:
5-
# pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/testing.yml"
9+
- "fastapi_jsonapi/**"
10+
- "tests/**"
11+
- "codecov.yaml"
12+
- "pyproject.toml"
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- ".github/workflows/testing.yml"
18+
- "fastapi_jsonapi/**"
19+
- "tests/**"
20+
- "pyproject.toml"
621

7-
# is there a way to fix doubled pipelines?
8-
# only XXX
9-
# https://github.com/orgs/community/discussions/25654
10-
# https://github.com/orgs/community/discussions/26276
1122

1223
jobs:
1324
lint:
@@ -16,6 +27,7 @@ jobs:
1627
matrix:
1728
python-version:
1829
- "3.9"
30+
- "3.10"
1931
- "3.11"
2032

2133
steps:
@@ -79,6 +91,17 @@ jobs:
7991
- name: Install dependencies
8092
run: poetry install --all-extras
8193
- name: Test with pytest
82-
run: pytest -s -vv tests/
94+
run: |
95+
flags="-s -vv --cov=fastapi_jsonapi --cov-config .coveragerc --cov-report=xml"
96+
pytest $flags tests/
8397
env:
8498
TESTING_DB_URL: ${{ matrix.db-url }}
99+
100+
- name: Upload coverage data to Codecov
101+
uses: codecov/codecov-action@v3
102+
with:
103+
token: ${{ secrets.CODECOV_TOKEN }}
104+
files: coverage.xml
105+
flags: unittests
106+
name: py-${{ matrix.python-version }}-db-${{ startsWith(matrix.db-url, 'sqlite') && 'sqlite' || startsWith(matrix.db-url, 'postgres') && 'postgres' || 'unknown' }} }}
107+
fail_ci_if_error: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![](https://img.shields.io/github/license/ycd/manage-fastapi?style=for-the-badge)](https://pypi.org/project/FastAPI-JSONAPI/)
55
![GitHub Actions](https://img.shields.io/github/actions/workflow/status/mts-ai/FastAPI-JSONAPI/testing.yml?style=for-the-badge)
66
[![Read the Docs](https://img.shields.io/readthedocs/fastapi-jsonapi?style=for-the-badge)](https://fastapi-jsonapi.readthedocs.io/en/latest/)
7+
![Codecov](https://img.shields.io/codecov/c/github/mts-ai/FastAPI-JSONAPI?style=for-the-badge)
78

89
[![📖 Docs (gh-pages)](https://github.com/mts-ai/FastAPI-JSONAPI/actions/workflows/documentation.yaml/badge.svg)](https://mts-ai.github.io/FastAPI-JSONAPI/)
910

codecov.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
branch: main
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "90..100"
9+
10+
parsers:
11+
gcov:
12+
branch_detection:
13+
conditional: yes
14+
loop: yes
15+
method: no
16+
macro: no
17+
18+
comment:
19+
layout: "reach,diff,flags,tree"
20+
behavior: default
21+
require_changes: no
22+
branches:
23+
- main
24+
after_n_builds: 6 # 3 python versions by 2 dbs

docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ FastAPI-JSONAPI
1212
:alt: GitHub
1313
:target: https://github.com/mts-ai/FastAPI-JSONAPI
1414

15+
.. image:: https://img.shields.io/codecov/c/github/mts-ai/FASTAPI-JSONAPI?style=for-the-badge
16+
:alt: Codecov
17+
:target: https://codecov.io/gh/mts-ai/FastAPI-JSONAPI
18+
1519

1620
**FastAPI-JSONAPI** is an extension for FastAPI that adds support for quickly building REST APIs
1721
with huge flexibility around the JSON:API 1.0 specification.

0 commit comments

Comments
 (0)