Skip to content

Commit

Permalink
add unit test and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaopeuko committed Apr 28, 2024
1 parent 692082f commit 93b09d6
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit Test

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Run pytest with coverage
run: |
poetry run pytest --cov=secured tests/
- name: Generate coverage report
run: |
poetry run pytest --cov=secured --cov-report=xml:coverage.xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
fail_ci_if_error: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/secured)
![PyPI - Downloads](https://img.shields.io/pypi/dm/secured)
![PyPI](https://img.shields.io/pypi/v/secured)
[![codecov](https://codecov.io/gh/your_username/your_repository/branch/main/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/your_username/your_repository)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/secured)
![PyPI - License](https://img.shields.io/pypi/l/secured)

Expand Down
89 changes: 87 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
pyyaml = "^6.0.1"


Expand All @@ -16,6 +16,7 @@ pre-commit = "^3.7.0"
python-dotenv = "^1.0.1"
tomlkit = "^0.12.4"
pytest = "^8.1.2"
pytest-cov = "^5.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 93b09d6

Please sign in to comment.