Skip to content

Commit

Permalink
CI/CD: Added coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Seluj78 committed Jun 10, 2024
1 parent 4472db6 commit 091f511
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Coverage

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox -e coverage
tox -e report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/seluj78/flask-utils/tests.yml?label=tests)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/seluj78/flask-utils/linting.yml?label=linting)
![GitHub License](https://img.shields.io/github/license/seluj78/flask-utils)
[![codecov](https://codecov.io/gh/Seluj78/flask-utils/graph/badge.svg?token=ChUOweAp4b)](https://codecov.io/gh/Seluj78/flask-utils)

[//]: # (TODO: Uncomment when flask-utils had been freed from pypi)
[//]: # (![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-utils))
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
-r requirements.txt
black
coverage
flake8
mypy
packaging
pre-commit
pytest
pytest-cov
pytest-flask
reorder-python-imports
sphinx-lint
Expand Down
20 changes: 20 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,23 @@ deps =
flask30: Flask==3.*
flasklatest: Flask
commands = pytest

[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase

[testenv:coverage]
commands = pytest --cov --cov-report=term-missing
deps =
pytest
pytest-cov
coverage
flask

[testenv:report]
commands =
coverage report
coverage html
deps = coverage
skip_install = true

0 comments on commit 091f511

Please sign in to comment.