@@ -34,16 +34,34 @@ jobs:
3434
3535 - name : Compute coverage
3636 working-directory : ${{env.COVERAGE_DIR}}
37+ id : coverage
3738 run : |
3839 echo "DIR: $(pwd)" && ls -al
3940 ../scripts/coverage/merge_coverage_files.sh exports-coverage total_coverage
4041 genhtml --no-function-coverage -o html_report total_coverage 2>&1 | tee output.txt
4142 mkdir coverage_report
4243 mv html_report ./coverage_report/
4344 tail -n2 output.txt >> $GITHUB_STEP_SUMMARY
45+ echo "COV_OUT=$(tail -n1 output.txt | grep -oP "lines[.]+: [\d.]+%" | cut -d ' ' -f2 | tr -d '%')" >> $GITHUB_OUTPUT
4446
4547 - name : Upload coverage report
4648 uses : actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
4749 with :
4850 name : coverage_html_report
4951 path : coverage/coverage_report
52+
53+ # XXX: add check to only update on merge!!!
54+ # preview of the badge: https://gist.github.com/bb-ur/3f66c77d7035df39aa75dda8a2ac75b3
55+ # Only update the badge on merge in upstream and if build is successful
56+ - name : Update coverity badge
57+ if : ${{ success() && github.repository == 'oneapi-src/unified-memory-framework' }}
58+ uses : Schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
59+ with :
60+ auth : ${{ secrets.BB_GIST_TOKEN }}
61+ gistID : 3f66c77d7035df39aa75dda8a2ac75b3
62+ filename : umf_coverage_badge.svg
63+ label : Coverage
64+ message : ${{ steps.coverage.outputs.COV_OUT }}%
65+ valColorRange : ${{ steps.coverage.outputs.COV_OUT }}
66+ minColorRange : 50 # <= this value = color: red
67+ maxColorRange : 90 # >= this value = color: green
0 commit comments