Skip to content

Commit

Permalink
Add workflow to generate badge (needs GIST_TOKEN)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefsmeets committed Jul 23, 2024
1 parent ef86f2f commit 014deb7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,29 @@ jobs:
pip install pytest
export FWL_DATA="./fwl_data"
source SOCRATES/set_rad_env
pytest
coverage run -m pytest
- name: Report coverage
run: |
coverage json
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
echo $'\n```' >> $GITHUB_STEP_SUMMARY
coverage report >> $GITHUB_STEP_SUMMARY
echo $'\n```' >> $GITHUB_STEP_SUMMARY
- name: Make coverage badge
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 99391a66bb9229771504c3a4db611d05
filename: covbadge.svg
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}


0 comments on commit 014deb7

Please sign in to comment.