Skip to content

Commit 1fe5e51

Browse files
authored
Merge pull request #829 from lukaszstolarczuk/clean-badges
Badges in readme
2 parents 9e70ea0 + b329760 commit 1fe5e51

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
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: 23 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,32 @@ 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+
# Only update the badge on push (event is passed only for total coverage)
60+
- name: Update coverity badge
61+
if: ${{ success() && inputs.trigger == 'push' }}
62+
uses: Schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
63+
with:
64+
auth: ${{ secrets.BB_GIST_TOKEN }}
65+
gistID: 3f66c77d7035df39aa75dda8a2ac75b3
66+
filename: umf_coverage_badge.svg
67+
label: Coverage
68+
message: ${{ steps.coverage.outputs.COV_OUT }}%
69+
valColorRange: ${{ steps.coverage.outputs.COV_OUT }}
70+
minColorRange: 50 # <= this value = color: red
71+
maxColorRange: 90 # >= this value = color: green

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Unified Memory Framework
22

3-
[![PR/push](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/pr_push.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/pr_push.yml)
3+
[![PR/push](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/pr_push.yml/badge.svg?branch=main&event=push)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/pr_push.yml)
4+
[![Coverage](https://gist.githubusercontent.com/bb-ur/3f66c77d7035df39aa75dda8a2ac75b3/raw/umf_coverage_badge.svg)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/pr_push.yml?query=branch%3Amain)
45
[![GitHubPages](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/docs.yml)
56
[![Nightly](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/nightly.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/nightly.yml)
6-
[![Bandit](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/bandit.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/bandit.yml)
7-
[![CodeQL](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/codeql.yml)
87
[![Coverity build](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/coverity.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/coverity.yml)
98
[![Coverity report](https://scan.coverity.com/projects/29761/badge.svg?flat=0)](https://scan.coverity.com/projects/oneapi-src-unified-memory-framework)
10-
[![Trivy](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/trivy.yml/badge.svg)](https://github.com/oneapi-src/unified-memory-framework/actions/workflows/trivy.yml)
119
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/oneapi-src/unified-memory-framework/badge)](https://securityscorecards.dev/viewer/?uri=github.com/oneapi-src/unified-memory-framework)
1210

1311
## Introduction

0 commit comments

Comments
 (0)