Skip to content

Commit

Permalink
Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
mahenzon committed Jan 18, 2024
1 parent d5ae48c commit 8090967
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ name: Python testing

on:
push:
# pull_request:
branches:
- main
paths:
- ".github/workflows/testing.yml"
- "fastapi_jsonapi/**"
- "tests/**"
- "codecov.yaml"
- "pyproject.toml"
pull_request:
branches:
- main
paths:
- ".github/workflows/testing.yml"
- "fastapi_jsonapi/**"
- "tests/**"
- "pyproject.toml"

# is there a way to fix doubled pipelines?
# only XXX
# https://github.com/orgs/community/discussions/25654
# https://github.com/orgs/community/discussions/26276

jobs:
lint:
Expand All @@ -16,6 +27,7 @@ jobs:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"

steps:
Expand Down Expand Up @@ -79,6 +91,17 @@ jobs:
- name: Install dependencies
run: poetry install --all-extras
- name: Test with pytest
run: pytest -s -vv tests/
run: |
flags="-s -vv --cov=fastapi_jsonapi --cov-config .coveragerc --cov-report=xml"
pytest $flags tests/
env:
TESTING_DB_URL: ${{ matrix.db-url }}

- name: Upload coverage data to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: unittests
name: py-${{ matrix.python-version }}-db-${{ startsWith(matrix.db-url, 'sqlite') && 'sqlite' || startsWith(matrix.db-url, 'postgres') && 'postgres' || 'unknown' }} }}
fail_ci_if_error: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![](https://img.shields.io/pypi/pyversions/FastAPI-JSONAPI?style=for-the-badge)](https://pypi.org/project/FastAPI-JSONAPI/)
[![](https://img.shields.io/github/license/ycd/manage-fastapi?style=for-the-badge)](https://pypi.org/project/FastAPI-JSONAPI/)
![GitHub Actions](https://img.shields.io/github/actions/workflow/status/mts-ai/FastAPI-JSONAPI/testing.yml?style=for-the-badge)
[![codecov](https://codecov.io/gh/mts-ai/FastAPI-JSONAPI/graph/badge.svg?token=6K39IP2L0Z)](https://codecov.io/gh/mts-ai/FastAPI-JSONAPI)
[![Read the Docs](https://img.shields.io/readthedocs/fastapi-jsonapi?style=for-the-badge)](https://fastapi-jsonapi.readthedocs.io/en/latest/)

[![📖 Docs (gh-pages)](https://github.com/mts-ai/FastAPI-JSONAPI/actions/workflows/documentation.yaml/badge.svg)](https://mts-ai.github.io/FastAPI-JSONAPI/)
Expand Down
24 changes: 24 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codecov:
require_ci_to_pass: yes
branch: main

coverage:
precision: 2
round: down
range: "90..100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
branches:
- main
after_n_builds: 6 # 3 python versions by 2 dbs
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ FastAPI-JSONAPI
:alt: GitHub
:target: https://github.com/mts-ai/FastAPI-JSONAPI

.. image:: https://codecov.io/gh/mts-ai/FastAPI-JSONAPI/graph/badge.svg?token=6K39IP2L0Z
:alt: Codecov
:target: https://codecov.io/gh/mts-ai/FastAPI-JSONAPI


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

0 comments on commit 8090967

Please sign in to comment.