MIL-010 task 6: the coverage report reaches the workflow as an artifact (ADR-0010, RC-073)

Task: MIL-010#6
Refs #160
This commit is contained in:
2026-10-14 13:54:01 +08:00
parent 4fc0a8cab3
commit 0dc5132a2e
8 changed files with 142 additions and 24 deletions
+15 -1
View File
@@ -13,7 +13,9 @@ name: Code metrics
#
# It counts the code files and the lines of code of the repository (comment
# and blank lines are not counted), reads an optional Cobertura XML coverage
# report and commits three SVG badges to a branch of the calling repository.
# report (an artifact of an earlier job of the caller, or a file of the
# repository) and commits three SVG badges to a branch of the calling
# repository.
# It runs no test, needs no secret and writes only the badges branch.
on:
workflow_call:
@@ -30,6 +32,10 @@ on:
description: "Path, relative to the repository root, of a Cobertura XML coverage report; empty writes no coverage badge"
type: string
default: ""
coverage-artifact:
description: "Name of an artifact, uploaded by an earlier job of the same run, that holds the coverage report; empty reads coverage-report from the checkout"
type: string
default: ""
coverage-warn:
description: "Coverage in percent below which the coverage badge is red"
type: string
@@ -57,6 +63,7 @@ jobs:
WORKING_DIRECTORY: ${{ inputs.working-directory }}
EXCLUDE: ${{ inputs.exclude }}
COVERAGE_REPORT: ${{ inputs.coverage-report }}
COVERAGE_ARTIFACT: ${{ inputs.coverage-artifact }}
COVERAGE_WARN: ${{ inputs.coverage-warn }}
COVERAGE_GOOD: ${{ inputs.coverage-good }}
BADGES_BRANCH: ${{ inputs.badges-branch }}
@@ -74,6 +81,13 @@ jobs:
- name: Validate the inputs
run: bash shared-scripts/tools/code-metrics.sh validate
- name: Download the coverage report
if: ${{ inputs.coverage-artifact != '' }}
uses: actions/download-artifact@v4.1.8
with:
name: ${{ inputs.coverage-artifact }}
path: coverage-artifact
- name: Count the code and write the badges
run: bash shared-scripts/tools/code-metrics.sh measure