Skip to content

Commit

Permalink
github action fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mpecchi committed Feb 28, 2024
1 parent f4d8910 commit 7705df8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -21,15 +22,16 @@ jobs:
- name: Install pytest
run: |
pip install pytest
pip install pytest pytest-cov
- name: Run tests
run: pytest
run: |
pytest --cov=your_package_name --cov-report=term
- name: Generate Badge
run: |
# Example: Generate badge based on test coverage percentage
COVERAGE=$(pytest --cov-report=term | grep -oP '(?<=TOTAL\s+)[^\s%]+')
COVERAGE=$(pytest --cov-report=xml | grep -oP '(?<=<report.*line-rate=")[^"]*')
curl "https://img.shields.io/badge/coverage-$COVERAGE-green.svg" > coverage.svg
- name: Upload Badge
Expand Down

0 comments on commit 7705df8

Please sign in to comment.