Skip to content

Commit

Permalink
CI: add codecoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gil-air-may committed May 24, 2024
1 parent 0b5b5e6 commit 21521ed
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ jobs:
test:
runs-on: ubuntu-latest

services:
docker:
image: docker:19.03.12
options: --privileged

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -28,9 +23,32 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
- name: Run tests with coverage
run: |
coverage run -m pytest
coverage xml
coverage-badge -o coverage.svg
- name: Setup Git for Pages
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Checkout gh-pages branch
run: |
git fetch origin
git checkout gh-pages || git checkout --orphan gh-pages
rm -rf *
cp ../coverage.svg .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push to gh-pages branch
run: |
pytest
git add coverage.svg
git commit -m "Update coverage badge"
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Your Project

![Coverage](https://your-username.github.io/your-repository/coverage.svg)

## Description

Your project description...
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
coverage==7.5.1
coverage-badge==1.1.1
cryptography==42.0.7
decorator==5.1.1
dnspython==2.6.1
Expand Down Expand Up @@ -45,6 +47,7 @@ Pygments==2.18.0
PyMySQL==1.1.0
pytest==8.2.0
pytest-asyncio==0.23.7
pytest-cov==5.0.0
python-dotenv==1.0.1
python-multipart==0.0.9
PyYAML==6.0.1
Expand Down

0 comments on commit 21521ed

Please sign in to comment.