Skip to content

Commit 60c1884

Browse files
test cov badge
1 parent b8088be commit 60c1884

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.github/workflows/pr_push.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
if: github.repository == 'oneapi-src/unified-memory-framework'
5858
needs: [Build, DevDax, GPU, MultiNuma, Qemu, ProxyLib]
5959
uses: ./.github/workflows/reusable_coverage.yml
60+
secrets: inherit
61+
with:
62+
trigger: "${{github.event_name}}"
6063
Coverage_partial:
6164
# partial coverage (on forks)
6265
if: github.repository != 'oneapi-src/unified-memory-framework'

.github/workflows/reusable_coverage.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# Coverage build - gather artifacts from other builds and merge them into a single report
22
name: Coverage
33

4-
on: workflow_call
4+
on:
5+
workflow_call:
6+
inputs:
7+
trigger:
8+
description: Type of workflow trigger
9+
type: string
10+
required: false
511

612
permissions:
713
contents: read
@@ -34,16 +40,33 @@ jobs:
3440

3541
- name: Compute coverage
3642
working-directory: ${{env.COVERAGE_DIR}}
43+
id: coverage
3744
run: |
3845
echo "DIR: $(pwd)" && ls -al
3946
../scripts/coverage/merge_coverage_files.sh exports-coverage total_coverage
4047
genhtml --no-function-coverage -o html_report total_coverage 2>&1 | tee output.txt
4148
mkdir coverage_report
4249
mv html_report ./coverage_report/
4350
tail -n2 output.txt >> $GITHUB_STEP_SUMMARY
51+
echo "COV_OUT=$(tail -n1 output.txt | grep -oP "lines[.]+: [\d.]+%" | cut -d ' ' -f2 | tr -d '%')" >> $GITHUB_OUTPUT
4452
4553
- name: Upload coverage report
4654
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
4755
with:
4856
name: coverage_html_report
4957
path: coverage/coverage_report
58+
59+
# preview of the badge: https://gist.github.com/bb-ur/3f66c77d7035df39aa75dda8a2ac75b3
60+
# Only update the badge on push (event is passed only for total coverage)
61+
- name: Update coverity badge
62+
if: ${{ success() && inputs.trigger == 'push' }}
63+
uses: Schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
64+
with:
65+
auth: ${{ secrets.BB_GIST_TOKEN }}
66+
gistID: 3f66c77d7035df39aa75dda8a2ac75b3
67+
filename: umf_coverage_badge.svg
68+
label: Coverage
69+
message: ${{ steps.coverage.outputs.COV_OUT }}%
70+
valColorRange: ${{ steps.coverage.outputs.COV_OUT }}
71+
minColorRange: 50 # <= this value = color: red
72+
maxColorRange: 90 # >= this value = color: green

0 commit comments

Comments
 (0)