Skip to content

Commit

Permalink
Add coverage workflow and update README with coverage percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
fvergaracl committed Feb 9, 2024
1 parent e037a8f commit e4707b7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update Coverage in README

on: [push]

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
pip install pytest pytest-cov
- name: Run pytest and update README
run: |
coverage=$(pytest --cov=app --cov-report=term tests/ | tail -n 1 | awk '{print $4}')
sed -i "s/coverage: [0-9]*%/coverage: $coverage/" README.md
- name: Commit and push if changed
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -am "Update coverage in README" && git push || echo "No changes to commit"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GAME (Goals And Motivation Engine) 🎮

Coverage: [0-9]\*%

## Description 📝

GAME (Goals And Motivation Engine) is a system designed to foster motivation and achievement of goals through gamification. This open-source project utilizes a PostgreSQL database and is developed with FastAPI in Python, managed via Poetry for environment handling.
Expand Down
Empty file added app/core/test_config.py
Empty file.
5 changes: 2 additions & 3 deletions app/model/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ def __repr__(self):
return f"BaseModel: (id={self.id}, created_at={self.created_at}, updated_at={self.updated_at})"

def __eq__(self, other):
if not isinstance(other, BaseModel):
return False
return (
self.id == other.id
isinstance(other, BaseModel)
and self.id == other.id
and self.created_at == other.created_at
and self.updated_at == other.updated_at
)
Expand Down

0 comments on commit e4707b7

Please sign in to comment.