From 95a343eb007a62221027536c682260c1c5011c41 Mon Sep 17 00:00:00 2001 From: "rahul.singh" Date: Tue, 24 Feb 2026 12:59:42 +0100 Subject: [PATCH 1/2] Enhance C++ coverage reusable workflow --- .github/workflows/cpp-coverage.yml | 31 +++++++++-------------------- README.md | 32 +++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.github/workflows/cpp-coverage.yml b/.github/workflows/cpp-coverage.yml index 304798f..d9318cb 100644 --- a/.github/workflows/cpp-coverage.yml +++ b/.github/workflows/cpp-coverage.yml @@ -69,13 +69,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 + # Note: This action writes cache config to ~/.bazelrc + # Projects must include "try-import ~/.bazelrc" in their .bazelrc to enable caching + # See: https://github.com/eclipse-score/reference_integration/blob/main/.bazelrc#L84 - name: Setup Bazel with shared caching uses: bazel-contrib/setup-bazel@0.18.0 with: - disk-cache: ${{ github.workflow }} + disk-cache: ${{ format('{0}_{1}', github.workflow, github.ref_name) }} repository-cache: true bazelisk-cache: true - cache-save: ${{ github.event_name != 'pull_request' }} + cache-save: ${{ github.event_name == 'push' }} - name: Install lcov (+ bc for threshold check) run: | @@ -172,30 +175,14 @@ jobs: echo "::notice::Coverage threshold met: ${coverage_percent}% >= ${min_coverage}%" - - name: Upload coverage HTML report + - name: Upload coverage artifacts if: ${{ always() }} uses: actions/upload-artifact@v6 with: - name: ${{ format('{0}_cpp_coverage_report{1}', github.event.repository.name, inputs.artifact-name-suffix) }} - path: cpp_coverage/ - if-no-files-found: ignore - retention-days: ${{ inputs.retention-days }} - - - name: Upload raw LCOV file - if: ${{ always() }} - uses: actions/upload-artifact@v6 - with: - name: ${{ format('{0}_cpp_coverage_lcov{1}', github.event.repository.name, inputs.artifact-name-suffix) }} - path: coverage.lcov - if-no-files-found: ignore - retention-days: ${{ inputs.retention-days }} - - - name: Upload test logs - if: ${{ always() }} - uses: actions/upload-artifact@v6 - with: - name: ${{ format('{0}_cpp_test_logs{1}', github.event.repository.name, inputs.artifact-name-suffix) }} + name: ${{ format('{0}_cpp_coverage{1}', github.event.repository.name, inputs.artifact-name-suffix) }} path: | + cpp_coverage/ + coverage.lcov bazel-testlogs/**/*.log bazel-testlogs/**/*.xml if-no-files-found: ignore diff --git a/README.md b/README.md index 857bdd8..88232c3 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,30 @@ This workflow: --- -### **7️ Copyright Check Workflow** +### **7️ C++ Coverage Workflow** +**Usage Example** +```yaml +name: C++ Coverage CI + +on: + pull_request: + types: [opened, reopened, synchronize] + push: + branches: + - main + merge_group: + types: [checks_requested] + +jobs: + coverage-report: + uses: eclipse-score/cicd-workflows/.github/workflows/cpp-coverage.yml@main + with: + bazel-target: "//..." +``` + +--- + +### **8️ Copyright Check Workflow** **Usage Example** ```yaml name: Copyright Check CI @@ -223,7 +246,7 @@ This workflow: --- -### **8️ Formatting Check Workflow** +### **9️ Formatting Check Workflow** **Usage Example** ```yaml name: Formatting Check CI @@ -249,7 +272,7 @@ This workflow: > **Default:** `test //:format.check` --- -### **9️ Required Approvals Workflow** +### **10️ Required Approvals Workflow** This workflow enforces **stricter CODEOWNERS checks** than GitHub’s defaults. Normally, GitHub requires approval from *any one* codeowner when multiple are listed. @@ -292,8 +315,7 @@ jobs: --- - -### **10️ QNX Build (Gated) Workflow** +### **11️ QNX Build (Gated) Workflow** Use this workflow when you need QNX secrets for forked PRs and want a manual approval gate via an environment. From f8cf72d2f61b51e16d61305ed5a42b13246c39c9 Mon Sep 17 00:00:00 2001 From: "rahul.singh" Date: Tue, 24 Feb 2026 14:27:38 +0100 Subject: [PATCH 2/2] Cache only on main branch, remove incorrect bazelrc comment --- .github/workflows/cpp-coverage.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpp-coverage.yml b/.github/workflows/cpp-coverage.yml index d9318cb..7f018e1 100644 --- a/.github/workflows/cpp-coverage.yml +++ b/.github/workflows/cpp-coverage.yml @@ -69,16 +69,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 - # Note: This action writes cache config to ~/.bazelrc - # Projects must include "try-import ~/.bazelrc" in their .bazelrc to enable caching - # See: https://github.com/eclipse-score/reference_integration/blob/main/.bazelrc#L84 - name: Setup Bazel with shared caching uses: bazel-contrib/setup-bazel@0.18.0 with: - disk-cache: ${{ format('{0}_{1}', github.workflow, github.ref_name) }} + disk-cache: ${{ github.workflow }} repository-cache: true bazelisk-cache: true - cache-save: ${{ github.event_name == 'push' }} + cache-save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - name: Install lcov (+ bc for threshold check) run: |