Skip to content

Commit a16ba50

Browse files
committed
switch to github cov
1 parent 8a99632 commit a16ba50

4 files changed

Lines changed: 65 additions & 10 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Coverage Badge
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
badge:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
cache: "pip"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install -e ".[test]"
28+
python -m pip install coverage-badge
29+
30+
- name: Run tests with coverage
31+
run: |
32+
pytest -q --cov=fastapi_observer --cov-report=term-missing --cov-report=xml
33+
34+
- name: Generate coverage badge
35+
run: |
36+
mkdir -p assets
37+
coverage-badge -o assets/coverage.svg -f
38+
39+
- name: Commit updated badge
40+
uses: stefanzweifel/git-auto-commit-action@v5
41+
with:
42+
commit_message: "chore(ci): update coverage badge"
43+
file_pattern: assets/coverage.svg

.github/workflows/tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ jobs:
4242
- name: Run tests via tox
4343
run: tox -e ${{ matrix.toxenv }}
4444

45-
- name: Upload coverage to Codecov
46-
uses: codecov/codecov-action@v5
47-
with:
48-
files: ./coverage.xml
49-
flags: unittests
50-
name: python-${{ matrix.python-version }}
51-
fail_ci_if_error: false
52-
token: ${{ secrets.CODECOV_TOKEN }}
53-
5445
- name: Upload coverage artifact
5546
if: always()
5647
uses: actions/upload-artifact@v4

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FastAPI Observer provides structured logging and observability helpers for FastAPI applications.
44

55
[![Test](https://github.com/MehrazRumman/fastapi-observer/actions/workflows/tests.yml/badge.svg)](https://github.com/MehrazRumman/fastapi-observer/actions/workflows/tests.yml)
6-
[![coverage](https://codecov.io/gh/MehrazRumman/fastapi-observer/graph/badge.svg)](https://codecov.io/gh/MehrazRumman/fastapi-observer)
6+
[![coverage](https://raw.githubusercontent.com/MehrazRumman/fastapi-observer/main/assets/coverage.svg)](https://github.com/MehrazRumman/fastapi-observer/actions/workflows/coverage-badge.yml)
77
[![pypi package](https://img.shields.io/pypi/v/fastapi-observer?logo=pypi&label=pypi%20package)](https://pypi.org/project/fastapi-observer/)
88
[![python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-brightgreen?logo=python&logoColor=white)](#python-compatibility)
99

assets/coverage.svg

Lines changed: 21 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)