diff --git a/.github/workflows/pr_push.yml b/.github/workflows/pr_push.yml index 86fa50fd20..8b78ce3d0f 100644 --- a/.github/workflows/pr_push.yml +++ b/.github/workflows/pr_push.yml @@ -57,6 +57,9 @@ jobs: if: github.repository == 'oneapi-src/unified-memory-framework' needs: [Build, DevDax, GPU, MultiNuma, Qemu, ProxyLib] uses: ./.github/workflows/reusable_coverage.yml + secrets: inherit + with: + trigger: "${{github.event_name}}" Coverage_partial: # partial coverage (on forks) if: github.repository != 'oneapi-src/unified-memory-framework' diff --git a/.github/workflows/reusable_coverage.yml b/.github/workflows/reusable_coverage.yml index b71836fa6d..c8dde20ec4 100644 --- a/.github/workflows/reusable_coverage.yml +++ b/.github/workflows/reusable_coverage.yml @@ -1,7 +1,13 @@ # Coverage build - gather artifacts from other builds and merge them into a single report name: Coverage -on: workflow_call +on: + workflow_call: + inputs: + trigger: + description: Type of workflow trigger + type: string + required: false permissions: contents: read @@ -34,6 +40,7 @@ jobs: - name: Compute coverage working-directory: ${{env.COVERAGE_DIR}} + id: coverage run: | echo "DIR: $(pwd)" && ls -al ../scripts/coverage/merge_coverage_files.sh exports-coverage total_coverage @@ -41,9 +48,24 @@ jobs: mkdir coverage_report mv html_report ./coverage_report/ tail -n2 output.txt >> $GITHUB_STEP_SUMMARY + echo "COV_OUT=$(tail -n1 output.txt | grep -oP "lines[.]+: [\d.]+%" | cut -d ' ' -f2 | tr -d '%')" >> $GITHUB_OUTPUT - name: Upload coverage report uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: coverage_html_report path: coverage/coverage_report + + # Only update the badge on push (event is passed only for total coverage) + - name: Update coverity badge + if: ${{ success() && inputs.trigger == 'push' }} + uses: Schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0 + with: + auth: ${{ secrets.BB_GIST_TOKEN }} + gistID: 3f66c77d7035df39aa75dda8a2ac75b3 + filename: umf_coverage_badge.svg + label: Coverage + message: ${{ steps.coverage.outputs.COV_OUT }}% + valColorRange: ${{ steps.coverage.outputs.COV_OUT }} + minColorRange: 50 # <= this value = color: red + maxColorRange: 90 # >= this value = color: green diff --git a/README.md b/README.md index 2c4146dc6d..f759f86361 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ # Unified Memory Framework -[![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) +[![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) +[![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) [![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) [![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) -[![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) -[![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) [![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) [![Coverity report](https://scan.coverity.com/projects/29761/badge.svg?flat=0)](https://scan.coverity.com/projects/oneapi-src-unified-memory-framework) -[![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) [![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) ## Introduction