Skip to content

Commit

Permalink
Update python-app.yml
Browse files Browse the repository at this point in the history
- temporarily skip flake8
- initial draft of coverage badge code (see https://nedbatchelder.com/blog/202209/making_a_coverage_badge.html)
  • Loading branch information
josh-hadley committed Jan 22, 2024
1 parent f1dd135 commit 5506655
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,27 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
echo 'Skipping flake8 temporarily'
- name: Test with pytest and coverage
run: |
pytest --cov
pytest --cov-report='json'
- name: Coverage
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: "Make badge"
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 116f9fefb73f6fcf9ffe8ce34d72efd7 # replace with your real Gist id.
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}

0 comments on commit 5506655

Please sign in to comment.