-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to generate badge (needs GIST_TOKEN)
- Loading branch information
1 parent
ef86f2f
commit 014deb7
Showing
1 changed file
with
26 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -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 }} | ||
|
||
|