-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coverage workflow and update README with coverage percentage
- Loading branch information
1 parent
e037a8f
commit e4707b7
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters