62 Commits
Author SHA1 Message Date
Tirsvad 302346103e Merge pull request 'Release 2.1.1: changelog entry' (#179) from release-2.1.1 into main
Validate workflows / validate (push) Successful in 37s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 8s
Reviewed-on: #179
2026-10-14 11:20:15 +02:00
Tirsvad 469edab57b Release 2.1.1: changelog entry
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 36s
2026-10-14 17:19:27 +08:00
Tirsvad 49af328232 Merge pull request 'MIL-011 tasks 2 to 5: the default tools-ref is the current major' (#178) from mil-011-fix into main
Publish wiki / publish-wiki (push) Successful in 23s
Publish own wiki / wiki (push) Successful in 23s
Publish accepted milestones / publish (push) Successful in 56s
Validate workflows / validate (push) Successful in 38s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Reviewed-on: #178
2026-10-14 11:17:50 +02:00
Tirsvad 604d4c2d0c Resolve pending commit links for MIL-011
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 31s
2026-10-14 17:13:23 +08:00
Tirsvad a6892c372a MIL-011 tasks 5 and 9: results of the run on the instance, RC-078
The fixed workflow at the branch, with every input at its default, ran
as run 1509: tools-ref resolved to v2, the scripts were fetched and the
badges were committed. RC-078 reviews the deliverables of tasks 2 to 5:
Go; criteria 6 to 8 stay open until the release and the framework page.
2026-10-14 17:13:20 +08:00
Tirsvad eaa0e30bea MIL-011 tasks 2 to 4: the default tools-ref is the current major
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
code-metrics.yml defaulted tools-ref to v1 and its guide said @v1, but
the workflow and its scripts exist only from v2.1.0. The default of the
five reusable workflows is now the current major, defined once in
MAJOR_TAG, and tests/test_tools_ref.py fails when a default differs from
it or names a tag without the script. Guides, README and wiki (en, da,
ms) call code-metrics.yml at @v2; ADR-0005, 0008, 0009 and 0010 carry
an amendment; RC-077 accepts the milestone's task 1 results.

Task: MIL-011#2
2026-10-14 17:09:34 +08:00
Tirsvad 76f6b56f8d Merge pull request 'MIL-011 task 1: reproduce the defect and list the defaults' (#177) from mil-011-task-1 into main
Publish accepted milestones / publish (push) Successful in 1m6s
Validate workflows / validate (push) Successful in 28s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #177
2026-10-14 11:02:14 +02:00
Tirsvad 49d27f98db Resolve pending commit link for MIL-011
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 31s
2026-10-14 16:34:18 +08:00
Tirsvad e11c43f0a4 MIL-011 task 1: reproduce the defect and list the defaults
On a throwaway branch, code-metrics.yml at @v2 with the defaults fails
in "Validate the inputs" (tools/code-metrics.sh absent at v1, run 1499),
and a call at @v1 creates no run at all. Of the five reusable workflows
only code-metrics.yml names a tag without its script.
2026-10-14 16:34:17 +08:00
Tirsvad 04f98c2e4e Merge pull request 'Review and accept MIL-011 (RC-076)' (#167) from mil-011-code-metrics-defaults into main
Publish accepted milestones / publish (push) Successful in 53s
Validate workflows / validate (push) Successful in 29s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Reviewed-on: #167
2026-10-14 10:05:07 +02:00
Tirsvad 60da2583d1 Resolve pending commit links for RC-076
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 32s
2026-10-14 16:00:05 +08:00
Tirsvad 3d7a9df3a3 Review and accept MIL-011 (RC-076)
First read found three corrections: the wording of O5 in the
traceability, "ten milestones" in the plan's purpose, and a scope row that
is not a Business Case item. Go; accepted by the author as stand-in for
S01, not independent. MIL-011 and its plan row are Accepted; the
traceability matrix has the new rows.
2026-10-14 16:00:04 +08:00
Tirsvad 0027da529c Merge pull request 'Plan MIL-011: fix the defaults of the code metrics workflow' (#166) from mil-011-code-metrics-defaults into main
Validate workflows / validate (push) Successful in 37s
Publish accepted milestones / publish (push) Successful in 48s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #166
2026-10-14 09:58:30 +02:00
Tirsvad 60f39e3854 Resolve pending commit links for MIL-011
Validate workflows / validate (pull_request) Successful in 31s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
2026-10-14 15:57:20 +08:00
Tirsvad 02e3794d7b Plan MIL-011: fix the defaults of the code metrics workflow
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Release 2.1.0 documents code-metrics.yml at @v1 and defaults tools-ref to
v1, but the workflow and its scripts exist only from v2.1.0. MIL-011
plans the fix (a patch release 2.1.1), the test that would have caught
it, the guide and wiki corrections, and the removal of the workaround
from the framework Badges page. Proposed; no code changes yet.
2026-10-14 15:57:16 +08:00
Tirsvad ae04bc759f Merge pull request 'MIL-010: release 2.1.0 and outcome review RC-075' (#165) from mil-010-outcome into main
Publish wiki / publish-wiki (push) Successful in 11s
Publish own wiki / wiki (push) Successful in 11s
Publish accepted milestones / publish (push) Successful in 46s
Validate workflows / validate (push) Successful in 29s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 8s
Reviewed-on: #165
2026-10-14 09:13:28 +02:00
Tirsvad 62d280f07f Resolve pending commit links
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 31s
2026-10-14 15:10:33 +08:00
Tirsvad aa20e56110 MIL-010 task 9: release 2.1.0, outcome review RC-075
Task: MIL-010#9
Refs #163
2026-10-14 15:10:32 +08:00
Tirsvad 16faffaf13 Merge pull request 'MIL-010: code metrics and coverage badges workflow' (#164) from mil-010-implementation into main
Publish accepted milestones / publish (push) Successful in 55s
Validate workflows / validate (push) Successful in 33s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Publish wiki / publish-wiki (push) Successful in 22s
Publish own wiki / wiki (push) Successful in 22s
Reviewed-on: #164
2026-10-14 08:59:20 +02:00
Tirsvad a795f3b03e Re-run the checks: the status of the previous head stayed pending
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 32s
2026-10-14 14:10:45 +08:00
Tirsvad 292886531e Resolve pending commit links
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 28s
2026-10-14 14:05:29 +08:00
Tirsvad 5c5a1d19d9 MIL-010 task 8: adoption in a throwaway repository, results and RC-074; release entry 2.1.0
Task: MIL-010#8
Refs #162
2026-10-14 14:05:20 +08:00
Tirsvad 95f9577a14 MIL-010 task 7: guide, README, wiki pages in three languages
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Task: MIL-010#7
Refs #161
2026-10-14 13:56:49 +08:00
Tirsvad 0dc5132a2e MIL-010 task 6: the coverage report reaches the workflow as an artifact (ADR-0010, RC-073)
Task: MIL-010#6
Refs #160
2026-10-14 13:54:01 +08:00
Tirsvad 4fc0a8cab3 MIL-010 task 6: reusable workflow code-metrics.yml and tools/code-metrics.sh
Task: MIL-010#6
Refs #160
2026-10-14 13:50:34 +08:00
Tirsvad 5bc14d789d MIL-010 tasks 4 and 5: counter, coverage reader and badge renderer
Task: MIL-010#4
Task: MIL-010#5
Refs #158
Refs #159
2026-10-14 13:48:04 +08:00
Tirsvad 6c3544837c MIL-010 task 3: results of the delivery check
Refs #157
2026-10-14 13:44:34 +08:00
Tirsvad aa4ca0f897 MIL-010 task 2: ADR-0010, the contract of the code metrics badges (RC-072)
Refs #156
2026-10-14 13:43:15 +08:00
Tirsvad 9ca9673b00 MIL-010 task 1: use case UC-008, stories US-001.18 to US-001.20, RC-069 to RC-071
Refs #155
2026-10-14 13:41:14 +08:00
Tirsvad 6d2020e9ab Merge pull request 'MIL-010: plan the code metrics and coverage badges workflow' (#154) from mil-010-code-metrics-badges into main
Publish accepted milestones / publish (push) Successful in 47s
Validate workflows / validate (push) Successful in 22s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #154
2026-10-14 07:37:14 +02:00
Tirsvad 1c3d810284 Resolve pending commit links
Validate workflows / validate (pull_request) Successful in 24s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
2026-10-14 13:35:57 +08:00
Tirsvad 50024505fe MIL-010: plan the code metrics and coverage badges workflow
Adds objective O5 to BC-001 (RC-067), the milestone MIL-010 with nine tasks and
the plan row of PP-001 (RC-068); the traceability matrix is updated.
2026-10-14 13:35:53 +08:00
Tirsvad 285084fb0d Merge pull request 'Move the framework pin from v0.6.2 to v0.7.0' (#153) from framework-pin-0-7-0 into main
Validate workflows / validate (push) Successful in 25s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #153
2026-10-14 06:57:39 +02:00
Tirsvad bf54f346a5 Move the framework pin from v0.6.2 to v0.7.0
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 25s
v0.7.0 carries the conventions (gitignore API, LF line endings, CRUD
template), process/wiki.md and the publish-wiki.yml caller template, and its
files are LF. Tests (413) and the milestone sync dry run pass with it.
2026-10-14 12:56:12 +08:00
Tirsvad f43d93d141 Merge pull request 'MIL-009: verification results and outcome review RC-066' (#152) from mil-009-outcome into main
Publish accepted milestones / publish (push) Successful in 43s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Validate workflows / validate (push) Successful in 22s
Reviewed-on: #152
2026-10-14 06:31:31 +02:00
Tirsvad c8e111d2b5 Re-run the checks: the status of the previous head stayed pending
Validate workflows / validate (pull_request) Successful in 23s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
2026-10-14 12:21:54 +08:00
Tirsvad 905b21dae9 Resolve pending commit links
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 25s
2026-10-14 12:19:04 +08:00
Tirsvad 95abc18a95 MIL-009: verification results and outcome review RC-066
All seven Go / No-Go criteria are met: framework v0.7.0, seven repositories
calling publish-wiki-pages.yml with 0-difference read-backs, no wiki/.publish
in 48 repositories, the scoped workflow removed, ADR-0004 superseded, 2.0.0
released with v1 left at 1.2.2. The acceptance is recorded as AI stand-in for
S01 (mode autonomous, not independent).
2026-10-14 12:19:02 +08:00
Tirsvad 6e8e5489d1 Merge pull request 'MIL-009: remove the scoped publish-wiki workflow and the marker; ADR-0004 superseded' (#151) from mil-009-remove-scoped into main
Publish accepted milestones / publish (push) Successful in 44s
Validate workflows / validate (push) Successful in 23s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Publish wiki / publish-wiki (push) Successful in 28s
Publish own wiki / wiki (push) Successful in 28s
2026-10-14 06:15:32 +02:00
Tirsvad 8e32f48757 Resolve pending commit links
Validate workflows / validate (pull_request) Successful in 27s
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
2026-10-14 11:45:08 +08:00
Tirsvad 78d21b34a3 Remove the scoped publish-wiki workflow and the marker path (2.0.0)
- .gitea/scoped_workflows/publish-wiki.yml is deleted
- tools/publish_wiki.py requires WIKI_PRUNE, reads no marker, and defaults
  WIKI_DIR to docs/wiki; its tests follow
- README, onboarding, troubleshooting and upgrading guides, and the wiki pages
  in English, Danish and Bahasa Malaysia no longer describe the scoped workflow
- changelog entry 2.0.0 with the Breaking group

Task: MIL-009#6
Task: MIL-009#8
2026-10-14 11:45:03 +08:00
Tirsvad 22fc323b41 ADR-0004: superseded by ADR-0009; review record RC-065
The scoped delivery and the wiki/.publish marker are replaced by the reusable
workflow of ADR-0009. The AI records the acceptance as stand-in for S01
(mode autonomous, not independent).

Task: MIL-009#7
2026-10-14 11:45:01 +08:00
Tirsvad 878adbf148 Merge pull request 'MIL-009, PP-001 and RC-064: accepted' (#142) from plan-mil-009 into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 45s
Validate workflows / validate (push) Successful in 22s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
2026-10-13 18:01:46 +02:00
Tirsvad 9963d69731 Resolve pending commit links
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 24s
2026-10-14 00:00:39 +08:00
Tirsvad 2f267df2a2 MIL-009, PP-001 and RC-064: accepted
The user switched to autonomous mode and accepted the plan in chat on
2026-10-14 with the defaults: target date 2026-11-30, no publishing for
027-sandbox and 028-pomodoro, framework release 0.7.0. The acceptance is
recorded as AI stand-in for S01 (RC-064, mode autonomous, not independent).
2026-10-14 00:00:38 +08:00
Tirsvad 8051a07e7b Merge pull request 'PP-001: add MIL-009 and review record RC-064' (#141) from plan-mil-009 into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 53s
Validate workflows / validate (push) Successful in 27s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 7s
Reviewed-on: #141
2026-10-13 17:59:28 +02:00
Tirsvad 38deeba89b Resolve pending commit link of RC-064
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 26s
2026-10-13 23:58:46 +08:00
Tirsvad 856197d0bb Resolve pending commit links
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
2026-10-13 23:58:34 +08:00
Tirsvad 86e69ce85d PP-001: add MIL-009 and review record RC-064
MIL-009 (migrate the wiki callers, remove the scoped workflow) joins the
Gateway Schedule, the Gantt, Scope Coverage, Dependencies and Plan Risks.
RC-064 records the review; MIL-009, the plan row and the record stay
Proposed until S01 gives the Go and confirms the target date.
2026-10-13 23:58:33 +08:00
Tirsvad bb3b0f242b Merge pull request 'MIL-009: draft the milestone to migrate the wiki callers and remove the scoped workflow' (#140) from mil-009-migrate-and-remove into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 56s
Validate workflows / validate (push) Successful in 25s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Reviewed-on: #140
2026-10-13 17:48:57 +02:00
Tirsvad 922ff18c0a Resolve pending commit link of MIL-009
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 25s
2026-10-13 23:36:25 +08:00
Tirsvad 2b53ee6d21 MIL-009: draft the milestone to migrate the wiki callers and remove the scoped workflow
Proposed. Seven repositories still publish through the scoped
publish-wiki.yml with wiki/.publish; MIL-009 moves them to docs/wiki/ and a
caller of publish-wiki-pages.yml, removes the scoped workflow, supersedes
ADR-0004 and releases 2.0.0. The target date awaits S01.
2026-10-13 23:36:23 +08:00
Tirsvad 157bf6560d Merge pull request 'ADR-0009 and RC-063: review and acceptance' (#139) from review-adr-0009 into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 35s
Validate workflows / validate (push) Successful in 21s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #139
2026-10-13 17:33:55 +02:00
Tirsvad 8c0f006dc5 Resolve pending commit link of RC-063
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 24s
2026-10-13 23:32:52 +08:00
Tirsvad 7fecb33a72 Resolve pending commit links 2026-10-13 23:32:41 +08:00
Tirsvad 8c2c52ebd2 ADR-0009 and RC-063: review and acceptance
RC-063 reviews ADR-0009 against QC-ADR-001: three findings fixed (stale
verification statement, security impact named, product owner spelled out).
S01 gave the Go in chat on 2026-10-13; ADR-0009 and RC-063 are Accepted.
2026-10-13 23:32:39 +08:00
Tirsvad 2ee3d4d535 Merge pull request 'PP-001 and RC-062: accepted' (#138) from accept-pp-001-mil-008 into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 33s
Validate workflows / validate (push) Successful in 21s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #138
2026-10-13 16:43:04 +02:00
Tirsvad 8f0ded2593 Resolve pending commit links
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 20s
2026-10-13 22:42:06 +08:00
Tirsvad 23a64a3f35 PP-001 and RC-062: accepted
S01 gave the Go on the MIL-008 plan change in chat on 2026-10-13. The change
was merged as pull request 137 with the plan row Proposed; this sets PP-001
and RC-062 to Accepted.
2026-10-13 22:42:04 +08:00
Tirsvad 8c1fba6d9d Merge pull request 'PP-001: add MIL-008 and review record RC-062' (#137) from project-plan-mil-008 into main
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
Publish accepted milestones / publish (push) Successful in 36s
Validate workflows / validate (push) Successful in 22s
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Reviewed-on: #137
2026-10-13 16:38:52 +02:00
Tirsvad 672bc2988e Resolve pending commit links
TirSystem/github-action: Publish wiki / publish-wiki (push) Skipped
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 23s
2026-10-13 22:37:54 +08:00
Tirsvad 9aeb74e8b0 PP-001: add MIL-008 and review record RC-062
MIL-008 (wiki publishing as a reusable workflow) joins the Gateway Schedule,
the Gantt, Scope Coverage, Dependencies and Plan Risks. RC-062 records the
review; the plan row stays Proposed until S01 gives the Go.
2026-10-13 22:37:52 +08:00
91 changed files with 4499 additions and 536 deletions
-48
View File
@@ -1,48 +0,0 @@
name: Publish wiki
# DEPRECATED (ADR-0009, MIL-008): repositories publish their wiki by calling
# the reusable workflow publish-wiki-pages.yml. This scoped workflow stays
# until every repository that has wiki/.publish has migrated; it is then
# removed in a later major release.
# Shared through scoped delivery: it runs in every repository of an
# organization, but writes only where the repository has opted in with
# wiki/.publish (ADR-0004). TOKEN_FOR_GITEA_WIKI is read from the organization
# secrets; there is no fallback to the read-only sync token. The script is a
# file of TirSystem/github-action (tools/publish_wiki.py), fetched with a
# second checkout so that it is readable, lintable and tested as a file
# (MIL-004 task 6).
on:
push:
branches: [ main ]
paths:
- "wiki/**"
workflow_dispatch:
concurrency:
group: publish-wiki
cancel-in-progress: false
jobs:
publish-wiki:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out the repository
uses: actions/checkout@v4.2.2
- name: Fetch the shared script
uses: actions/checkout@v4.2.2
with:
repository: TirSystem/github-action
ref: v1
path: shared-scripts
- name: Publish the pages to the wiki
env:
GITEA_API_URL: ${{ gitea.api_url }}
SOURCE_REPOSITORY: ${{ gitea.repository }}
WIKI_CREDENTIALS: ${{ secrets.TOKEN_FOR_GITEA_WIKI }}
run: python3 shared-scripts/tools/publish_wiki.py
+95
View File
@@ -0,0 +1,95 @@
name: Code metrics
# Reusable workflow (ADR-0010). A repository calls it with
#
# on:
# push:
# branches: [main]
# jobs:
# metrics:
# uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2
# permissions:
# contents: write
#
# 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 (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:
inputs:
working-directory:
description: "Directory, relative to the repository root, whose code is counted"
type: string
default: "."
exclude:
description: "Comma list of patterns of files and directories that are not counted, in addition to the defaults of ADR-0010"
type: string
default: ""
coverage-report:
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
default: "60"
coverage-good:
description: "Coverage in percent from which the coverage badge is green"
type: string
default: "80"
badges-branch:
description: "Branch that holds the badge files; it is created when it does not exist"
type: string
default: "badges"
tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/ files are run; pin it to the exact tag together with the workflow"
type: string
default: "v2"
jobs:
code-metrics:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 10
env:
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 }}
steps:
- name: Check out the repository
uses: actions/checkout@v4.2.2
- name: Fetch the shared scripts
uses: actions/checkout@v4.2.2
with:
repository: TirSystem/github-action
ref: ${{ inputs.tools-ref }}
path: shared-scripts
- 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
- name: Publish the badges
run: bash shared-scripts/tools/code-metrics.sh publish
+1 -1
View File
@@ -31,7 +31,7 @@ on:
tools-ref: tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/publish_wiki.py is run; pin it to the exact tag together with the workflow" description: "Tag or branch of TirSystem/github-action whose tools/publish_wiki.py is run; pin it to the exact tag together with the workflow"
type: string type: string
default: "v1" default: "v2"
secrets: secrets:
TOKEN_FOR_GITEA_WIKI: TOKEN_FOR_GITEA_WIKI:
description: "Gitea token with write access to the wiki of the calling repository" description: "Gitea token with write access to the wiki of the calling repository"
+1 -1
View File
@@ -36,7 +36,7 @@ on:
tools-ref: tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/quality-checks-cpp.sh is run; pin it to the exact tag together with the workflow" description: "Tag or branch of TirSystem/github-action whose tools/quality-checks-cpp.sh is run; pin it to the exact tag together with the workflow"
type: string type: string
default: "v1" default: "v2"
jobs: jobs:
quality-checks-cpp: quality-checks-cpp:
+1 -1
View File
@@ -27,7 +27,7 @@ on:
tools-ref: tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/quality-checks-csharp.sh is run; pin it to the exact tag together with the workflow" description: "Tag or branch of TirSystem/github-action whose tools/quality-checks-csharp.sh is run; pin it to the exact tag together with the workflow"
type: string type: string
default: "v1" default: "v2"
jobs: jobs:
quality-checks-csharp: quality-checks-csharp:
+1 -1
View File
@@ -38,7 +38,7 @@ on:
tools-ref: tools-ref:
description: "Tag or branch of TirSystem/github-action whose tools/quality-checks.sh is run; pin it to the exact tag together with the workflow" description: "Tag or branch of TirSystem/github-action whose tools/quality-checks.sh is run; pin it to the exact tag together with the workflow"
type: string type: string
default: "v1" default: "v2"
jobs: jobs:
quality-checks: quality-checks:
+53
View File
@@ -20,6 +20,59 @@ Each release lists its changes in these groups, in this order:
## [Unreleased] ## [Unreleased]
## [2.1.1] - 2026-10-14
### Fixed
- `code-metrics.yml` could not be called as documented. Its guide, header
comment and `tools-ref` default named `v1`, which has neither the workflow nor
`tools/code-metrics.sh`: a call at `@v1` created no run, and a call at `@v2`
with the defaults failed in "Validate the inputs" (exit 127). The default
`tools-ref` of `code-metrics.yml`, `quality-checks.yml`,
`quality-checks-cpp.yml`, `quality-checks-csharp.yml` and
`publish-wiki-pages.yml` is now the current major (`v2`), defined once in
`MAJOR_TAG`, and a test fails when a default differs from it or names a tag
without the script. The guides, README and wiki pages call
`code-metrics.yml` at `@v2`.
## [2.1.0] - 2026-10-14
### Added
- The reusable workflow `code-metrics.yml` (ADR-0010, MIL-010). It counts the
code files and the lines of code (without comment and blank lines) of a
repository, reads a Cobertura XML coverage report that the caller uploads as an
artifact, and commits three SVG badges (code files, lines of code, coverage) to
a `badges` branch. It needs `contents: write` and no secret; the inputs are
`working-directory`, `exclude`, `coverage-report`, `coverage-artifact`,
`coverage-warn`, `coverage-good`, `badges-branch` and `tools-ref`. See
`guides/code-metrics.md`.
## [2.0.0] - 2026-10-14
### Breaking
- The scoped workflow `publish-wiki.yml` and the `wiki/.publish` marker are
removed (ADR-0009, MIL-009). A repository publishes its wiki by calling the
reusable workflow `publish-wiki-pages.yml`; one that still has the marker no
longer publishes. The seven repositories that used the scoped workflow on
2026-10-13 have a caller (checked on 2026-10-14). A repository that has
`wiki/.publish` moves `wiki/` to `docs/wiki/`, copies
`templates/ci/publish-wiki.yml` of the SQA and QC framework (0.7.0 or later)
to `.gitea/workflows/publish-wiki.yml` and removes the marker.
- `tools/publish_wiki.py` requires `WIKI_PRUNE` (`true` or `false`) and no longer
reads a marker; `WIKI_DIR` defaults to `docs/wiki`.
### Changed
- The README, the onboarding, troubleshooting and upgrading guides and the
wiki pages (English, Danish, Bahasa Malaysia) no longer describe the scoped
workflow or the marker.
- ADR-0004 is `Superseded by ADR-0009`.
- Callers of `quality-checks.yml`, `quality-checks-cpp.yml`,
`quality-checks-csharp.yml`, `release.yml` and `publish-wiki-pages.yml` need no
change; `v1` stays at 1.2.2 and `v2` is the new moving major tag.
## [1.2.2] - 2026-10-13 ## [1.2.2] - 2026-10-13
### Added ### Added
+1
View File
@@ -0,0 +1 @@
v2
+48 -48
View File
@@ -17,7 +17,7 @@ A collection of reusable Gitea Actions workflows for DevOps professionals and so
This repository is the central collection of reusable automation for TirSystem repositories. The primary repository lives at `git.tirsystem.com` (Gitea) and is push-mirrored to GitHub. This repository is the central collection of reusable automation for TirSystem repositories. The primary repository lives at `git.tirsystem.com` (Gitea) and is push-mirrored to GitHub.
It contains ten workflows: metadata sync to the GitHub mirror, wiki publishing (scoped, and reusable for repositories that call it), shared quality checks for Python and shell, for C and C++ and for C#, a release workflow, the publishing of accepted milestones and the repository's own validation. They are listed with their purpose and a diagram under [Workflows](#-workflows). It contains ten workflows: metadata sync to the GitHub mirror, wiki publishing (called by each repository), shared quality checks for Python and shell, for C and C++ and for C#, code metrics and coverage badges, a release workflow, the publishing of accepted milestones and the repository's own validation. They are listed with their purpose and a diagram under [Workflows](#-workflows).
## 🔧 Workflows ## 🔧 Workflows
@@ -26,11 +26,11 @@ Ten workflows live in this repository. A **scoped** workflow is delivered by the
| Workflow | File | Kind | Starts on | Purpose | | Workflow | File | Kind | Starts on | Purpose |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Sync GitHub mirror metadata | [`sync-github-metadata.yml`](.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push to `main`, manual, daily 03:17 UTC | Copies the description and topics of a Gitea repository to its GitHub push mirror | | Sync GitHub mirror metadata | [`sync-github-metadata.yml`](.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push to `main`, manual, daily 03:17 UTC | Copies the description and topics of a Gitea repository to its GitHub push mirror |
| Publish wiki | [`publish-wiki.yml`](.gitea/scoped_workflows/publish-wiki.yml) | Scoped, opt-in with `wiki/.publish`; deprecated, replaced by the reusable workflow below (ADR-0009) | push to `main` that changes `wiki/**`, manual | Publishes the pages in `wiki/` to the repository wiki |
| Publish wiki pages | [`publish-wiki-pages.yml`](.gitea/workflows/publish-wiki-pages.yml) | Reusable (`workflow_call`) | a call from another repository | Publishes the pages in `docs/wiki/` (or the folder named by `wiki_dir`) to the wiki of the calling repository | | Publish wiki pages | [`publish-wiki-pages.yml`](.gitea/workflows/publish-wiki-pages.yml) | Reusable (`workflow_call`) | a call from another repository | Publishes the pages in `docs/wiki/` (or the folder named by `wiki_dir`) to the wiki of the calling repository |
| Quality checks | [`quality-checks.yml`](.gitea/workflows/quality-checks.yml) | Reusable (`workflow_call`) | a call from another repository | Runs ruff, mypy, shellcheck and shfmt on the tracked files and changes nothing | | Quality checks | [`quality-checks.yml`](.gitea/workflows/quality-checks.yml) | Reusable (`workflow_call`) | a call from another repository | Runs ruff, mypy, shellcheck and shfmt on the tracked files and changes nothing |
| Quality checks C++ | [`quality-checks-cpp.yml`](.gitea/workflows/quality-checks-cpp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs clang-format and clang-tidy at exact versions on the tracked C and C++ files and changes nothing | | Quality checks C++ | [`quality-checks-cpp.yml`](.gitea/workflows/quality-checks-cpp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs clang-format and clang-tidy at exact versions on the tracked C and C++ files and changes nothing |
| Quality checks C# | [`quality-checks-csharp.yml`](.gitea/workflows/quality-checks-csharp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs `dotnet format` and `dotnet build` on an exact .NET SDK 10 or later and changes nothing | | Quality checks C# | [`quality-checks-csharp.yml`](.gitea/workflows/quality-checks-csharp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs `dotnet format` and `dotnet build` on an exact .NET SDK 10 or later and changes nothing |
| Code metrics | [`code-metrics.yml`](.gitea/workflows/code-metrics.yml) | Reusable (`workflow_call`) | a call from another repository | Counts the code files and the lines of code (without comment and blank lines), reads a Cobertura coverage report and commits three SVG badges to a `badges` branch |
| Publish own wiki | [`publish-own-wiki.yml`](.gitea/workflows/publish-own-wiki.yml) | This repository only | push to `main` that changes `docs/wiki/**`, manual | Calls the reusable Publish wiki pages workflow for the wiki of this repository | | Publish own wiki | [`publish-own-wiki.yml`](.gitea/workflows/publish-own-wiki.yml) | This repository only | push to `main` that changes `docs/wiki/**`, manual | Calls the reusable Publish wiki pages workflow for the wiki of this repository |
| Release | [`release.yml`](.gitea/workflows/release.yml) | This repository only | manual | Creates the version tag, the release page and the major tag after the checks | | Release | [`release.yml`](.gitea/workflows/release.yml) | This repository only | manual | Creates the version tag, the release page and the major tag after the checks |
| Publish accepted milestones | [`sync-milestones.yml`](.gitea/workflows/sync-milestones.yml) | This repository only | push to `main` that changes `docs/milestones/**` or `docs/sqa/reviews/**`, manual (dry run by default) | Creates or updates the Gitea milestone and issues of every milestone that is Accepted with a Go review | | Publish accepted milestones | [`sync-milestones.yml`](.gitea/workflows/sync-milestones.yml) | This repository only | push to `main` that changes `docs/milestones/**` or `docs/sqa/reviews/**`, manual (dry run by default) | Creates or updates the Gitea milestone and issues of every milestone that is Accepted with a Go review |
@@ -102,50 +102,6 @@ deactivate Workflow
@enduml @enduml
``` ```
### 📖 Publish wiki (scoped, deprecated)
Publishes `wiki/` to the repository wiki, only in a repository that has opted in with `wiki/.publish`. The word `prune` in that file also deletes pages that are not in `wiki/`.
#### 🔀 Workflow
```plantuml
@startuml
title Publish wiki/ to the repository wiki
autonumber
actor "Push to main that changes wiki/**,\nor manual trigger" as Trigger
participant "Gitea Actions\npublish-wiki" as Workflow
participant "shared-scripts\n(tools/publish_wiki.py at v1)" as Script
participant "Gitea wiki API" as Wiki
Trigger -> Workflow: Start workflow
activate Workflow
Workflow -> Script: Check out the repository and the script, run it
activate Script
alt wiki/.publish does not exist
Script --> Workflow: Log that publishing is not enabled and succeed\n(nothing is written)
else wiki/ has no Markdown pages
Script --> Workflow: Fail with [configuration]\n(an empty wiki/ never deletes pages)
else
Script -> Script: Read the marker (empty, or the word prune)\nand TOKEN_FOR_GITEA_WIKI
Script -> Wiki: GET repository (preflight)
Wiki --> Script: Wiki is enabled, token accepted
Script -> Wiki: GET pages
Wiki --> Script: Existing pages
Script -> Wiki: Create new pages, update changed pages
opt marker says prune
Script -> Wiki: Delete pages that are not in wiki/
end
Script --> Workflow: Log created, updated and deleted counts
end
deactivate Script
Workflow --> Trigger: Workflow result
deactivate Workflow
@enduml
```
### ✅ Quality checks ### ✅ Quality checks
A reusable workflow for Python and shell, called with `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (see the [guide](guides/quality-checks.md)). A reusable workflow for Python and shell, called with `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (see the [guide](guides/quality-checks.md)).
@@ -282,6 +238,50 @@ deactivate Workflow
@enduml @enduml
``` ```
### 🏅 Code metrics
A reusable workflow that counts the code files and the lines of code (without comment and blank lines) of a repository and publishes them, with the test coverage, as three SVG badges on a `badges` branch, called with `uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2` (ADR-0010). It needs `contents: write` and runs no test: an earlier job of the caller produces a Cobertura XML coverage report and uploads it as an artifact ([guide](guides/code-metrics.md)).
#### 🔀 Workflow
```plantuml
@startuml
title Code metrics and coverage badges (reusable workflow)
autonumber
actor "Calling repository\nuses: ...code-metrics.yml@v2" as Caller
participant "Gitea Actions\ncode-metrics" as Workflow
participant "Branch badges\nof the caller" as Branch
Caller -> Workflow: workflow_call with working-directory, exclude,\ncoverage-report and thresholds
activate Workflow
Workflow -> Workflow: Check out the caller and the shared scripts
Workflow -> Workflow: Validate the inputs
alt an input is invalid
Workflow --> Caller: Fail with [configuration]
end
Workflow -> Workflow: Download the coverage artifact (when given)
Workflow -> Workflow: Count code files and lines of code
alt a coverage report is given but missing or malformed
Workflow --> Caller: Fail with [configuration] that names the file
else
Workflow -> Workflow: Write code-files.svg, code-lines.svg\nand coverage.svg
end
Workflow -> Branch: Compare with the files of the branch
alt no badge changed
Workflow --> Caller: Notice: nothing to commit, pass
else
Workflow -> Branch: One commit with [skip ci]
Workflow --> Caller: Badges published
end
deactivate Workflow
@enduml
```
### 🏷️ Release ### 🏷️ Release
Started by hand by a maintainer; with `dry_run` `true` (the default) it only checks (see the [release process](guides/release-process.md)). Started by hand by a maintainer; with `dry_run` `true` (the default) it only checks (see the [release process](guides/release-process.md)).
@@ -542,10 +542,10 @@ Rows that say Implemented or Guides written exist today. The rest is planned and
| Synchronize repository metadata (Gitea to GitHub mirror) | Implemented in `.gitea/scoped_workflows/`, with offline tests and a validation workflow | | Synchronize repository metadata (Gitea to GitHub mirror) | Implemented in `.gitea/scoped_workflows/`, with offline tests and a validation workflow |
| Configure and validate workflow credentials | Implemented for the sync workflow: preflight checks both tokens before any change ([guide](guides/credentials.md)) | | Configure and validate workflow credentials | Implemented for the sync workflow: preflight checks both tokens before any change ([guide](guides/credentials.md)) |
| Onboard a repository, manage runners, diagnose failures | Guides written ([onboarding](guides/onboarding.md), [troubleshooting](guides/troubleshooting.md)); scoped delivery to the repositories of all four organizations verified (MIL-002) | | Onboard a repository, manage runners, diagnose failures | Guides written ([onboarding](guides/onboarding.md), [troubleshooting](guides/troubleshooting.md)); scoped delivery to the repositories of all four organizations verified (MIL-002) |
| Publish a repository wiki from `wiki/` (opt-in, delivered to every organization) | Implemented in `.gitea/scoped_workflows/publish-wiki.yml`, with offline tests; a pilot in a second repository publishes its wiki (MIL-006); being replaced by the reusable workflow below (ADR-0009) | | Publish a repository wiki from `docs/wiki/` through a called workflow | Implemented as the reusable workflow `.gitea/workflows/publish-wiki-pages.yml`, with offline tests; called by every repository that publishes a wiki, and this repository's own wiki is in `docs/wiki/` (MIL-008, MIL-009) |
| Publish a repository wiki from `docs/wiki/` through a called workflow | Implemented as the reusable workflow `.gitea/workflows/publish-wiki-pages.yml`, with offline tests; this repository's own wiki is in `docs/wiki/` and published by it through `publish-own-wiki.yml`; not yet called from another repository (MIL-008) |
| Shared quality checks (Python and shell) | Implemented as the reusable workflow `.gitea/workflows/quality-checks.yml`, with offline tests and a trial in a second organization; adopted in RepoFoundry ([guide](guides/quality-checks.md)) | | Shared quality checks (Python and shell) | Implemented as the reusable workflow `.gitea/workflows/quality-checks.yml`, with offline tests and a trial in a second organization; adopted in RepoFoundry ([guide](guides/quality-checks.md)) |
| Shared quality checks (C and C++, C#) | Implemented as the reusable workflows `.gitea/workflows/quality-checks-cpp.yml` and `.gitea/workflows/quality-checks-csharp.yml` with exact tool versions and offline tests; not yet used in another repository (MIL-007) ([C and C++ guide](guides/quality-checks-cpp.md), [C# guide](guides/quality-checks-csharp.md)) | | Shared quality checks (C and C++, C#) | Implemented as the reusable workflows `.gitea/workflows/quality-checks-cpp.yml` and `.gitea/workflows/quality-checks-csharp.yml` with exact tool versions and offline tests; not yet used in another repository (MIL-007) ([C and C++ guide](guides/quality-checks-cpp.md), [C# guide](guides/quality-checks-csharp.md)) |
| Code metrics and coverage badges | Implemented and released in 2.1.0 as the reusable workflow `.gitea/workflows/code-metrics.yml` with a counter, a Cobertura reader, an SVG renderer and offline tests; tried in a throwaway repository, not yet used in a project repository (MIL-010) ([guide](guides/code-metrics.md)) |
| Versioned release and publishing | Release process, changelog and upgrade guide defined; the release workflow exists and `v1.0.0` is released (MIL-004) ([guide](guides/upgrading.md)) | | Versioned release and publishing | Release process, changelog and upgrade guide defined; the release workflow exists and `v1.0.0` is released (MIL-004) ([guide](guides/upgrading.md)) |
## 📄 License ## 📄 License
@@ -4,13 +4,13 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | ADR-0004 | | ID | ADR-0004 |
| CrossReference | [MIL-006], [ADR-0003], [ADR-0002] | | CrossReference | [MIL-006], [ADR-0003], [ADR-0002], [ADR-0009] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Initial version | [b22a2cd] | | 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Reviewed (RC-018): the `prune` variant added to the evaluated options | [b22a2cd] |
| 2026-10-10 | Accepted | Jens Tirsvad Nielsen | S01 | Reviewed (RC-018): the `prune` variant added to the evaluated options | [b22a2cd] | | 2026-10-14 | Superseded by ADR-0009 | Jens Tirsvad Nielsen | AI as stand-in for S01 | The scoped delivery and the `wiki/.publish` marker are replaced by the reusable workflow of ADR-0009 and removed (MIL-009); the token and the empty-folder rules stand and are carried by ADR-0009; reviewed (RC-065) | [22fc323] |
Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`. Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`.
@@ -108,10 +108,13 @@ The rules that follow from it:
- [ADR-0003] — its fallback to `TOKEN_FOR_GITEA` no longer applies to the - [ADR-0003] — its fallback to `TOKEN_FOR_GITEA` no longer applies to the
shared workflow. shared workflow.
- [ADR-0002] — the stand-in rule applies to the review of this ADR. - [ADR-0002] — the stand-in rule applies to the review of this ADR.
- [ADR-0009] — the successor: the reusable workflow replaces the scoped delivery and the marker.
--- ---
[MIL-006]: ../milestones/mil-006-shared-wiki-publishing.md [MIL-006]: ../milestones/mil-006-shared-wiki-publishing.md
[ADR-0003]: ./adr-0003-wiki-publish-token.md [ADR-0003]: ./adr-0003-wiki-publish-token.md
[ADR-0002]: ./adr-0002-s01-approves-as-stand-in.md [ADR-0002]: ./adr-0002-s01-approves-as-stand-in.md
[ADR-0009]: ./adr-0009-wiki-publishing-reusable-workflow.md
[b22a2cd]: https://git.tirsystem.com/TirSystem/github-action/commit/b22a2cd59235078656c4440b945b787f88fbd345 [b22a2cd]: https://git.tirsystem.com/TirSystem/github-action/commit/b22a2cd59235078656c4440b945b787f88fbd345
[22fc323]: https://git.tirsystem.com/TirSystem/github-action/commit/22fc323b41074ee0029ea2f07445a8e329e15d15
+10 -1
View File
@@ -9,8 +9,8 @@
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Reviewed (RC-038): the security impact of installing the tools from PyPI named | [385d2fb] |
| 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | Added the input tools-ref: the shell steps moved to a script file fetched at that ref (RC-051) | [670f0ac] | | 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | Added the input tools-ref: the shell steps moved to a script file fetched at that ref (RC-051) | [670f0ac] |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Amendment: the default `tools-ref` is the current major tag (MIL-011) | [eaa0e30] |
Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`. Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`.
@@ -118,6 +118,14 @@ The rules that follow from it:
- [ADR-0004] — the same pattern of a shared scoped or reusable workflow with an - [ADR-0004] — the same pattern of a shared scoped or reusable workflow with an
explicit gate; this ADR does not change it. explicit gate; this ADR does not change it.
## Amendment (MIL-011)
The default of the input `tools-ref` in the quality-check contract is the current major tag, defined once in the file
`MAJOR_TAG` of this repository (`v2` from release 2.1.1), and no longer `v1`. A default must
name a tag that holds the script the workflow runs; a test checks it. Callers at `@v1` are
not affected: the `v1` tag keeps the `v1` workflow files.
--- ---
[MIL-003]: ../milestones/mil-003-quality-checks.md [MIL-003]: ../milestones/mil-003-quality-checks.md
@@ -126,3 +134,4 @@ The rules that follow from it:
[ADR-0004]: ./adr-0004-shared-wiki-publishing-opt-in.md [ADR-0004]: ./adr-0004-shared-wiki-publishing-opt-in.md
[385d2fb]: https://git.tirsystem.com/TirSystem/github-action/commit/385d2fb7cb9be1fdc8fd3503d0af624fa38eafc7 [385d2fb]: https://git.tirsystem.com/TirSystem/github-action/commit/385d2fb7cb9be1fdc8fd3503d0af624fa38eafc7
[670f0ac]: https://git.tirsystem.com/TirSystem/github-action/commit/670f0ac469043bb166c84290c0dbf62b4908e3cc [670f0ac]: https://git.tirsystem.com/TirSystem/github-action/commit/670f0ac469043bb166c84290c0dbf62b4908e3cc
[eaa0e30]: https://git.tirsystem.com/TirSystem/github-action/commit/eaa0e30beaa097dfeb1c07c814a71d02a6987060
@@ -9,8 +9,8 @@
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-11 | Deprecated | Jens Tirsvad Nielsen | S01 | Initial version | [11cba35] |
| 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | Reviewed (RC-054): abbreviations expanded at first use and the security impact of downloading tools named | [9e7aedd] | | 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | Reviewed (RC-054): abbreviations expanded at first use and the security impact of downloading tools named | [9e7aedd] |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Amendment: the default `tools-ref` is the current major tag (MIL-011) | [eaa0e30] |
Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`. Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`.
@@ -134,6 +134,14 @@ The rules that follow from it:
- [ADR-0005] — the contract that this decision extends, unchanged. - [ADR-0005] — the contract that this decision extends, unchanged.
- [ADR-0006] — raising a default tool version is breaking. - [ADR-0006] — raising a default tool version is breaking.
## Amendment (MIL-011)
The default of the input `tools-ref` in the C++ and C# quality-check contract is the current major tag, defined once in the file
`MAJOR_TAG` of this repository (`v2` from release 2.1.1), and no longer `v1`. A default must
name a tag that holds the script the workflow runs; a test checks it. Callers at `@v1` are
not affected: the `v1` tag keeps the `v1` workflow files.
--- ---
[MIL-007]: ../milestones/mil-007-cpp-csharp-quality-checks.md [MIL-007]: ../milestones/mil-007-cpp-csharp-quality-checks.md
@@ -143,3 +151,4 @@ The rules that follow from it:
[ADR-0006]: ./adr-0006-release-process-and-version-pinning.md [ADR-0006]: ./adr-0006-release-process-and-version-pinning.md
[11cba35]: https://git.tirsystem.com/TirSystem/github-action/commit/11cba358b83cb7b6624f6b0956ae7b0c112d3692 [11cba35]: https://git.tirsystem.com/TirSystem/github-action/commit/11cba358b83cb7b6624f6b0956ae7b0c112d3692
[9e7aedd]: https://git.tirsystem.com/TirSystem/github-action/commit/9e7aeddb11c2b41ac893d9f7893d663a53fbe470 [9e7aedd]: https://git.tirsystem.com/TirSystem/github-action/commit/9e7aeddb11c2b41ac893d9f7893d663a53fbe470
[eaa0e30]: https://git.tirsystem.com/TirSystem/github-action/commit/eaa0e30beaa097dfeb1c07c814a71d02a6987060
@@ -9,7 +9,8 @@
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [01b9c29] | | 2026-10-13 | Accepted | Jens Tirsvad Nielsen | S01 | Review findings fixed (RC-063): the product owner's language is spelled out, the security consequence is named, and the secret passing is recorded as verified | [8c2c52e] |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Amendment: the default `tools-ref` is the current major tag (MIL-011) | [eaa0e30] |
Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`. Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`.
@@ -22,7 +23,8 @@ repository of an organisation, and a marker file `wiki/.publish` is the opt-in.
That avoids a copy of the workflow, but it runs where nobody asked for it and That avoids a copy of the workflow, but it runs where nobody asked for it and
needs a safety gate for that reason; its trigger path (`wiki/**`) and the needs a safety gate for that reason; its trigger path (`wiki/**`) and the
version of the script (`v1`) are fixed centrally. The framework now prescribes version of the script (`v1`) are fixed centrally. The framework now prescribes
the wiki in `docs/wiki/` with English and the PO language as a minimum, and the wiki in `docs/wiki/` with English and the product owner's language as a
minimum, and
repositories need to say where their wiki is. repositories need to say where their wiki is.
Options: Options:
@@ -61,6 +63,9 @@ The rules that follow from it:
to `docs/wiki/` one repository at a time. to `docs/wiki/` one repository at a time.
- Opting in is a file in the repository, reviewed in a pull request, and a - Opting in is a file in the repository, reviewed in a pull request, and a
repository without a caller is never written to. repository without a caller is never written to.
- Security: the token is passed explicitly by the caller and is never
inherited or taken from a fallback, so a repository that does not pass it
cannot write a wiki.
- One call convention for every shared workflow of this repository. - One call convention for every shared workflow of this repository.
**Negative:** **Negative:**
@@ -74,8 +79,13 @@ The rules that follow from it:
their migrations. their migrations.
- The owner chose a patch release (1.2.2) for this change although a new - The owner chose a patch release (1.2.2) for this change although a new
workflow is a minor one under [ADR-0006]; the changelog states the deviation. workflow is a minor one under [ADR-0006]; the changelog states the deviation.
- Passing a declared secret through `workflow_call` is not yet verified on this - Anyone who can change the caller file of a repository can change the folder
Gitea instance; it is checked by the first call, in this repository. and `prune`, and so what the token deletes in that repository's wiki; this is
the same exposure as the marker had, and it is reviewed through the pull
request that changes the caller.
- Passing a declared secret through `workflow_call`, and a local `uses:` call,
were verified on this Gitea instance by run 316 of this repository on
2026-10-13.
## Affected Artifacts ## Affected Artifacts
@@ -83,6 +93,14 @@ The rules that follow from it:
- [ADR-0004] — its scoped delivery and marker parts are replaced once the - [ADR-0004] — its scoped delivery and marker parts are replaced once the
scoped workflow is removed; its token and safety rules stand. scoped workflow is removed; its token and safety rules stand.
## Amendment (MIL-011)
The default of the input `tools-ref` in the wiki publishing contract is the current major tag, defined once in the file
`MAJOR_TAG` of this repository (`v2` from release 2.1.1), and no longer `v1`. A default must
name a tag that holds the script the workflow runs; a test checks it. Callers at `@v1` are
not affected: the `v1` tag keeps the `v1` workflow files.
--- ---
[MIL-008]: ../milestones/mil-008-wiki-reusable-workflow.md [MIL-008]: ../milestones/mil-008-wiki-reusable-workflow.md
@@ -91,3 +109,5 @@ The rules that follow from it:
[ADR-0006]: ./adr-0006-release-process-and-version-pinning.md [ADR-0006]: ./adr-0006-release-process-and-version-pinning.md
[ADR-0005]: ./adr-0005-quality-check-contract.md [ADR-0005]: ./adr-0005-quality-check-contract.md
[01b9c29]: https://git.tirsystem.com/TirSystem/github-action/commit/01b9c2972b4317bcc590540010aea0eaf7f30014 [01b9c29]: https://git.tirsystem.com/TirSystem/github-action/commit/01b9c2972b4317bcc590540010aea0eaf7f30014
[8c2c52e]: https://git.tirsystem.com/TirSystem/github-action/commit/8c2c52ebd2a27e4d0edb4008c31c002718d280fb
[eaa0e30]: https://git.tirsystem.com/TirSystem/github-action/commit/eaa0e30beaa097dfeb1c07c814a71d02a6987060
@@ -0,0 +1,226 @@
# ADR-0010: Contract of the code metrics and coverage badges workflow
## Metadata
| Key | Value |
| --- | --- |
| ID | ADR-0010 |
| CrossReference | [MIL-010], [UC-008], [US-001], [ADR-0005], [ADR-0006] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | The report reaches the workflow as an artifact of the caller's run (input `coverage-artifact`), because a called workflow runs in its own job; reviewed (RC-073) | [0dc5132] |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Amendment: the default `tools-ref` is the current major tag (MIL-011) | [eaa0e30] |
Allowed Status values: `Proposed`, `Accepted`, `Rejected`, `Deprecated`, `Superseded by ADR-NNNN`.
---
## Context
MIL-010 adds a reusable workflow that shows the size of a repository's code
and its test coverage as badges (UC-008, US-001.18 to US-001.20). ADR-0005
defines the contract of the quality-check workflow: inputs with working
defaults, a pinned version per tool, a failure that names the cause, and a
script file of this repository, fetched at `tools-ref`, that the workflow runs.
Decisions the user took in chat on 2026-10-14 bound this one: the counter is a
Python script of this repository with no dependency outside the standard
library, the delivery is a reusable workflow, the badges are committed to a
`badges` branch, there are three badges (code files, lines of code, coverage),
and the coverage report is read in the Cobertura XML format.
Options for the counter:
1. **Wrap `cloc`, `tokei` or `scc`.** Many languages, mature rules, but a tool
to install and pin on every run and a download from outside the instance.
2. **A Python script of this repository.** No install, fully tested offline,
and the rules are ours; fewer languages and simple scanning rules.
Options for the delivery of the badges: a run artifact (disappears and has no
stable URL), a file on the default branch (a commit per change on the branch
that protects the code), or a dedicated branch (stable raw URL, no effect on
the default branch).
Facts: the job of a reusable workflow runs on `ubuntu-latest` with `python3`
3.12; a push made with the token of a run does not start another run; a
workflow checks the shared scripts out into the workspace (`shared-scripts`),
so the counter must not count them.
## Decision
A reusable workflow `code-metrics.yml` runs three script files of this
repository, fetched at its input `tools-ref` (default `v1`): `tools/count_loc.py`
counts the code, `tools/badges.py` reads the coverage report and writes the
badges, and `tools/code-metrics.sh` validates the inputs, calls both and
publishes the badge files to the `badges` branch of the calling repository
with the token of the run (`contents: write`, no other permission).
The rules that follow from it:
- **Code file.** A file under `working-directory` whose extension is in the
language table below, that is not excluded, and that contains no NUL byte
(it is text; it is read as UTF-8 and invalid bytes are replaced). Its
language comes from the extension. A file with a code extension but no
line is still a code file.
- **Languages and comments (first version).**
| Language | Extensions | Line comment | Block comment |
| --- | --- | --- | --- |
| Python | `.py` | `#` | none |
| Shell | `.sh`, `.bash` | `#` at the start of a word | none |
| PowerShell | `.ps1`, `.psm1` | `#` | `<#` ... `#>` |
| C | `.c`, `.h` | `//` | `/*` ... `*/` |
| C++ | `.cc`, `.cpp`, `.cxx`, `.hh`, `.hpp` | `//` | `/*` ... `*/` |
| C# | `.cs` | `//` | `/*` ... `*/` |
| Java | `.java` | `//` | `/*` ... `*/` |
| JavaScript | `.js`, `.mjs`, `.jsx` | `//` | `/*` ... `*/` |
| TypeScript | `.ts`, `.tsx` | `//` | `/*` ... `*/` |
| Go | `.go` | `//` | `/*` ... `*/` |
| Rust | `.rs` | `//` | `/*` ... `*/` |
| SQL | `.sql` | `--` | `/*` ... `*/` |
Markup, data and configuration files (Markdown, YAML, JSON, XML, HTML,
CSS) are not code files. A language is added by a minor release.
- **Line classes.** Every physical line is exactly one of: *blank* (only
white space, also inside a block comment), *comment* (not blank, and only
comment text and white space), or *code* (anything else, including a line
with code and a trailing comment). A comment marker inside a string literal
is not a comment. String literals are the quoted forms of the language that
end on the same line, plus the Python triple-quoted string and the backtick
string of JavaScript, TypeScript and Go, which may span lines; a Python
docstring is a string and so counts as code.
Raw-string and verbatim forms that differ from these (Rust `r#"..."#`, C#
`@"..."` with doubled quotes, C++ raw strings) are scanned as ordinary
strings and can be mis-counted; this is a stated limit.
- **Excluded by default.** Every directory whose name starts with `.`, and the
directories `node_modules`, `vendor`, `third_party`, `dist`, `build`, `out`,
`bin`, `obj`, `target`, `venv`, `__pycache__` and `shared-scripts`
(the checkout of the shared scripts); symbolic links are not followed. The
input `exclude` is a comma list of patterns that add to this: a pattern
without `/` matches a directory or file name anywhere, a pattern with `/`
matches the path relative to `working-directory` (`*` does not cross `/`).
The counter does not read `.gitignore` or generated-file markers; a caller
excludes generated code with `exclude`.
- **Totals.** `files` is the number of code files and `lines` is the sum of
their code lines (comment and blank lines are not in it); the result also
holds `comment` and `blank` totals and the same four numbers per language,
sorted by language name, in `code-metrics.json`.
- **Coverage report.** The input `coverage-report` is the path, relative to
the repository root, of a Cobertura XML file. The percentage is
`lines-covered / lines-valid` of the root `coverage` element, shown rounded
half up to a whole number; when a count is absent, `line-rate` is used.
A path that does not exist, a file that is not well-formed Cobertura XML,
and a report with no valid lines are failures with the category
`[configuration]` that names the file; no coverage badge is written. An
empty `coverage-report` means no coverage badge and a notice. The workflow
does not run tests. A called workflow runs in its own job, so it cannot see
the files of the caller's test job: the caller runs its tests in an earlier
job, uploads the report as an artifact and gives the artifact's name as the
input `coverage-artifact`. The workflow then downloads that artifact into
the directory `coverage-artifact` of its workspace and `coverage-report`
names the file inside the artifact. Without `coverage-artifact`,
`coverage-report` is a path in the checkout of the repository (a report the
repository commits). `coverage-artifact` without `coverage-report` is a
`[configuration]` failure.
- **Badges.** Three flat SVG files with a label and a value, written to the
root of the `badges` branch with fixed names: `code-files.svg` (label
`code files`), `code-lines.svg` (label `lines of code`) and `coverage.svg`
(label `coverage`); the values are the whole number with `,` between groups
of three digits and, for coverage, `%`. The value colour of the first two is
blue `#007ec6`; coverage is red `#e05d44` below the input `coverage-warn`
(default `60`), yellow `#dfb317` from there to below `coverage-good`
(default `80`) and green `#44cc11` from `coverage-good`. Each file has
`role="img"`, a `<title>` and an `aria-label` with the same text, a width
computed from the number of characters (no font is measured) and no
timestamp, script or external reference, so the same numbers give the same
bytes.
- **Publishing.** The `badges` branch holds only the three SVG files and
`code-metrics.json`; the script creates it as an orphan branch when it does
not exist. It writes the files, and when none differs from the branch it
commits nothing and says so; otherwise one commit, message
`Update code metrics badges [skip ci]`, changes only those files. The
commit is made with the token of the run, which does not start another run;
the guide tells a caller to start the workflow on pushes to its default
branch only.
- **Inputs.** `working-directory` (default `.`), `exclude` (default empty),
`coverage-report` (default empty), `coverage-artifact` (default empty),
`coverage-warn` (default `60`),
`coverage-good` (default `80`), `badges-branch` (default `badges`) and
`tools-ref` (default `v1`; pin it to the same exact tag as the workflow).
There is no tool version input: the tools are files of this repository and
Python 3 of the runner.
- **Pass, fail, empty.** The run passes when the badges were written or were
already current. It fails with a `[configuration]` message that names the
input and the value for an input that is invalid (a threshold that is not a
number from 0 to 100, `coverage-warn` above `coverage-good`, a
`working-directory` that is not a directory, a branch name that is not a
valid branch name) and for a coverage report as above. A repository with no
code file passes with a notice and badges that show `0`.
- **Not in the first version:** a badge per language (the JSON holds the
numbers), lcov and other report formats, branch or function coverage, and
counting only tracked files.
## Consequences
**Positive:**
- No tool is installed and nothing is downloaded: a run needs only the
checkout, Python 3 and the instance, so the counter and the renderer are
fully testable offline with fixtures.
- The same input gives the same bytes, so an unchanged repository produces no
commit and the `badges` branch history is the history of the numbers.
- The badges have stable URLs on the instance and on the mirror, and nothing
on the default branch changes.
- A broken or missing report is a failure that names the file, never a
misleading `0%`.
**Negative:**
- The counter knows only the listed languages and simple scanning rules; some
string forms are mis-counted (stated above), and results will differ a
little from `cloc` or `tokei`.
- The workflow needs `contents: write`, which is more than the
`contents: read` of the quality checks; a caller that grants less cannot use
it. The write is limited to the `badges` branch by the script, not by the
host.
- A caller must run its tests and produce a Cobertura XML report in an
earlier job and upload it as an artifact; other formats need a conversion
until a later release adds them. The download needs the artifact service
of the instance to serve a called workflow, which task 8 of MIL-010
verifies.
- A fixed set of thresholds and colours; a caller can move the two thresholds
only.
- Security: the script runs with a token that can write to the repository.
The files are ours and no code is downloaded (the artifact is a report that
is parsed as XML with entity declarations refused), but a caller that pins
`tools-ref` to a moving ref takes later changes of the script; the guide
says to pin the exact tag. The script writes only the four named files, and
the branch name input is validated so that it cannot name the default branch
(`main`, `master`) or a branch of the caller's code.
## Affected Artifacts
- [MIL-010] — decides its criterion 2 and unlocks tasks 4 to 6.
- [UC-008] — the use case this workflow serves.
- [US-001] — US-001.18 to US-001.20 state their acceptance criteria.
- [ADR-0005] — the contract style that this decision follows, unchanged.
- [ADR-0006] — adding a language, or changing a colour or a default, is a
release under its rules; raising a default threshold is breaking.
## Amendment (MIL-011)
The default of the input `tools-ref` in the code metrics contract is the current major tag, defined once in the file
`MAJOR_TAG` of this repository (`v2` from release 2.1.1), and no longer `v1`. A default must
name a tag that holds the script the workflow runs; a test checks it. Callers at `@v1` are
not affected: the `v1` tag keeps the `v1` workflow files.
---
[MIL-010]: ../milestones/mil-010-code-metrics-badges.md
[UC-008]: ../uc-008/uc.md
[US-001]: ../user-stories.md
[ADR-0005]: ./adr-0005-quality-check-contract.md
[ADR-0006]: ./adr-0006-release-process-and-version-pinning.md
[0dc5132]: https://git.tirsystem.com/TirSystem/github-action/commit/0dc5132a2ea419ba05035ee3594cec63335c240b
[eaa0e30]: https://git.tirsystem.com/TirSystem/github-action/commit/eaa0e30beaa097dfeb1c07c814a71d02a6987060
+4 -4
View File
@@ -10,13 +10,13 @@ each document lives in *this* project and the next version to use.
| BC | Business Case | docs/business-case.md | 002 | | BC | Business Case | docs/business-case.md | 002 |
| SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 | | SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 |
| PP | Project Plan | docs/project-plan.md | 002 | | PP | Project Plan | docs/project-plan.md | 002 |
| MIL | Milestone / Gateway | docs/milestones/*.md | 009 | | MIL | Milestone / Gateway | docs/milestones/*.md | 012 |
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 062 | | RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 079 |
| TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 | | TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 |
| ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0010 | | ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0011 |
| UCD | Use Case Diagram | docs/use-case-diagram.md | 002 | | UCD | Use Case Diagram | docs/use-case-diagram.md | 002 |
| US | User Story | docs/user-stories.md | 002 | | US | User Story | docs/user-stories.md | 002 |
| UC | Use Case | docs/uc-NNN/uc.md | 008 | | UC | Use Case | docs/uc-NNN/uc.md | 009 |
## Languages ## Languages
+8 -3
View File
@@ -9,8 +9,8 @@
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | A mirrored repository has at most one GitHub push mirror; repositories without one are skipped | [0c06789] | | 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Scope: wiki pages in English, Danish and Bahasa Malaysia | [08ef26a] |
| 2026-10-10 | Accepted | Jens Tirsvad Nielsen | S01 | Scope: wiki pages in English, Danish and Bahasa Malaysia | [08ef26a] | | 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Objective O5, scope item and success criterion 5: shared workflow for code metrics and coverage badges (MIL-010); reviewed (RC-067) | [5002450] |
--- ---
@@ -59,6 +59,9 @@ made once.
diagnosis for every workflow. diagnosis for every workflow.
- **O4:** Offer shared quality-check and release workflows, versioned so - **O4:** Offer shared quality-check and release workflows, versioned so
consumers can adopt changes deliberately. consumers can adopt changes deliberately.
- **O5:** Offer a shared workflow that counts the code files and the lines of
code (without comment and blank lines) of a repository, reads its coverage
report and publishes the three results as SVG badges.
## Scope ## Scope
@@ -68,6 +71,7 @@ made once.
- Documentation for DevOps professionals and software engineers. - Documentation for DevOps professionals and software engineers.
- A Gitea wiki with the same documentation in English, Danish and Bahasa Malaysia (MIL-005). - A Gitea wiki with the same documentation in English, Danish and Bahasa Malaysia (MIL-005).
- Validation of workflow files and their documentation. - Validation of workflow files and their documentation.
- A shared workflow for code metrics and coverage badges (MIL-010).
### Out of Scope ### Out of Scope
@@ -104,6 +108,7 @@ accepted plans.
| 2 | Canonical copies per workflow | 1 | Count of files per workflow name | | 2 | Canonical copies per workflow | 1 | Count of files per workflow name |
| 3 | Documented use cases that are implemented or marked planned | 100% | README capability table against workflows present | | 3 | Documented use cases that are implemented or marked planned | 100% | README capability table against workflows present |
| 4 | Repositories consuming a shared workflow | At least 1 besides this one by MIL-002 | Consumer list in README | | 4 | Repositories consuming a shared workflow | At least 1 besides this one by MIL-002 | Consumer list in README |
| 5 | Repositories that show the code metrics and coverage badges from the shared workflow | At least 1 besides this one by MIL-010 | README of the consuming repository |
## Risks ## Risks
@@ -149,5 +154,5 @@ Proceed — the first milestone fixes a known defect in the only existing workfl
--- ---
[SA-001]: ./stakeholder-analysis.md [SA-001]: ./stakeholder-analysis.md
[0c06789]: https://git.tirsystem.com/TirSystem/github-action/commit/0c06789a2779382672712cd483f4964b28a0ebe9
[08ef26a]: https://git.tirsystem.com/TirSystem/github-action/commit/08ef26a6d3eb98c066b45634c2271e578e6c0a0b [08ef26a]: https://git.tirsystem.com/TirSystem/github-action/commit/08ef26a6d3eb98c066b45634c2271e578e6c0a0b
[5002450]: https://git.tirsystem.com/TirSystem/github-action/commit/50024505fe788b1c5e3021c0d1fc3d079590070e
@@ -0,0 +1,109 @@
# MIL-009: Migrate the wiki callers and remove the scoped workflow
## Metadata
| Key | Value |
| --- | --- |
| ID | MIL-009 |
| CrossReference | [BC-001], [MIL-008], [ADR-0004], [ADR-0006], [ADR-0009] , [RC-066] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Deprecated | Jens Tirsvad Nielsen | AI as stand-in for S01 | Plan accepted in chat with the defaults: target date 2026-11-30 confirmed, `027-sandbox` and `028-pomodoro` do not publish, framework release 0.7.0; reviewed (RC-064) | [2f267df] |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Verification results recorded for tasks 1 to 8; outcome reviewed (RC-066) | [95abc18] |
---
## Purpose
Decide whether the scoped `publish-wiki.yml` can be removed: every repository
that publishes its wiki through it has moved to `docs/wiki/` and calls the
reusable workflow `publish-wiki-pages.yml`, and ADR-0004 is superseded by
ADR-0009. MIL-008 deprecated the scoped workflow and kept it because seven
repositories still depended on it (checked on 2026-10-13).
## Deliverable
A released framework with the caller template; each of the seven repositories
publishing its wiki from `docs/wiki/` through a caller, with its marker removed;
the scoped workflow, its marker code path, its tests and every mention of the
marker as an opt-in removed; ADR-0004 marked superseded; and the major release
2.0.0 with the tag `v2`.
## Go / No-Go Criteria
| # | Criterion (objectively checkable) | Go | No-Go |
| --- | --- | --- | --- |
| 1 | The framework is released as 0.7.0 with `templates/ci/publish-wiki.yml` and `process/wiki.md`, as a tag | The tag exists and each migrating repository pins it | No tag, or a repository pins an unmerged commit |
| 2 | Each of the seven repositories publishes from `docs/wiki/` through a caller of `publish-wiki-pages.yml`, and has no `wiki/.publish` | A scan of the instance lists the seven with a caller and no marker | Any marker or missing caller remains |
| 3 | The wiki of each of the seven equals its `docs/wiki/` after the first run | 0 differences read back through the API for each | A difference, or a failed run |
| 4 | A scan of every repository of the four organisations finds no `wiki/.publish` and no run of the scoped workflow that wrote | None found | Any found |
| 5 | The scoped `publish-wiki.yml`, the marker code path of `tools/publish_wiki.py`, their tests and the marker text of the guides, README and wiki pages are removed | Offline tests pass; a search finds no `wiki/.publish` outside the changelog and ADRs | A mention remains, or a test fails |
| 6 | ADR-0004 is `Superseded by ADR-0009` with a review record, and ADR-0009 links back | Both rows and RC present | Missing |
| 7 | Release 2.0.0 is published with a Breaking entry, `v2` points to it, and `v1` still points to 1.2.2 | Tags read back through the API | `v1` moved, or no Breaking entry |
## Dependencies
| Depends on | Reason |
| --- | --- |
| MIL-008 | Provides the reusable workflow, the deprecation and the list of repositories |
| `TirSystem/sqa-qc-framework` release | The caller template and `process/wiki.md` must be a tag before a repository pins them |
## Traceability
| Business Case objective / KPI / user story | Reference |
| --- | --- |
| O2, O3 | [BC-001] |
## Ownership
| Role | Stakeholder ID (SA) |
| --- | --- |
| Owner | S05 |
| Approving reviewer | S01 |
## Target Date
2026-11-30 — confirmed on 2026-10-14 by S01 in chat; the Business Case sets no deadline.
## Tasks
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
| --- | --- | --- | --- | --- |
| 1 | Release the framework | `TirSystem/sqa-qc-framework` has the caller template and `process/wiki.md` merged (pull request 45). Add the changelog entry, tag the release and record the tag. Needed before any repository pins the template. | No | |
| 2 | Migrate the three TirSystem projects | `sqa-and-qc`, `sqa-qc-framework` and `sqa-qc-checklists`: move `wiki/` to `docs/wiki/`, copy the caller from `templates/ci/publish-wiki.yml`, remove `wiki/.publish`, fix the paths in their generators and documents, move the framework pin to the released tag, one pull request each. Confirm the organisation secret `TOKEN_FOR_GITEA_WIKI` is present. | No | |
| 3 | Migrate `repo-foundry` | Same steps for `TirSystem-BashScript/repo-foundry` (21 wiki files); the organisation `TirSystem-BashScript` needs its own `TOKEN_FOR_GITEA_WIKI` secret (S03). | No | |
| 4 | Migrate the three Udemy repositories | Same steps for `021-snake-game`, `024-snake` and `025-weather` of `Tirsvad-Udemy-100-days-of-code` (5 wiki files each). `027-sandbox` and `028-pomodoro`, which have `docs/wiki/` and no marker, do not publish (decided by S01 on 2026-10-14). | No | |
| 5 | Verify the migration | After each first run read the wiki back and compare it with `docs/wiki/`; then scan the four organisations for `wiki/.publish` and for repositories still publishing through the scoped workflow. Record the results in this milestone. | No | |
| 6 | Remove the scoped workflow | Delete `.gitea/scoped_workflows/publish-wiki.yml`, the marker path of `tools/publish_wiki.py` (the `WIKI_PRUNE` input becomes required), the tests that cover it and the marker text in the guides, the README and the three wiki languages. Keep the drift test for the remaining scoped workflow. | No | |
| 7 | Supersede ADR-0004 | Mark ADR-0004 `Superseded by ADR-0009` for the delivery and marker parts (new version row, review record), and make ADR-0009 link back. | No | |
| 8 | Release 2.0.0 | Breaking entry (a removed workflow and marker); upgrade guide for callers; release through the release workflow; `v2` is created and `v1` stays at 1.2.2. Move the examples in the guides to `@v2` where the guide describes the new major. | No | |
---
## Verification results
Recorded on 2026-10-14 by the autonomous run.
| # | Criterion | Result |
| --- | --- | --- |
| 1 | The framework is released as 0.7.0 with the template and `process/wiki.md`, and each repository pins it | Go: tag `v0.7.0` on `70fc558`. `sqa-and-qc`, `repo-foundry`, `021-snake-game`, `024-snake` and `025-weather` pin it; `sqa-qc-framework` and `sqa-qc-checklists` have no `framework/` submodule to pin |
| 2 | Each of the seven repositories publishes from `docs/wiki/` through a caller and has no `wiki/.publish` | Go: `sqa-and-qc` #168, `sqa-qc-framework` #47, `sqa-qc-checklists` #17, `repo-foundry` #96, `021-snake-game` #29, `024-snake` #46, `025-weather` #31 |
| 3 | The wiki of each equals its `docs/wiki/` after the first run | Go: 0 differences read back through the API (10, 16, 13, 19, 4, 4 and 4 pages); each first run succeeded |
| 4 | A scan of every repository of the four organisations finds no `wiki/.publish` | Go: 48 repositories scanned, none found |
| 5 | The scoped workflow, the marker path, their tests and the marker text are removed | Go with a note: pull request #151; `wiki/.publish` remains only in the changelog, the ADRs, the milestone and review records and the sentence of the upgrading guide that explains the removal |
| 6 | ADR-0004 is `Superseded by ADR-0009` with a review record, and ADR-0009 links back | Go: RC-065 |
| 7 | Release 2.0.0 is published with a Breaking entry, `v2` points to it, and `v1` still points to 1.2.2 | Go: `v2.0.0` and `v2` on `6e8e548`, `v1` and `v1.2.2` on `9bf0a2b`; the release page shows the Breaking group |
Things that did not go as planned: the three Udemy pull requests were opened through a script that hit a network timeout once and was repeated; the `repo-foundry` test suite fails two tests on `main` and on the branch alike (pre-existing, not caused by this milestone).
---
[BC-001]: ../business-case.md
[RC-066]: ../sqa/reviews/rc-066-mil-009-outcome.md
[MIL-008]: ./mil-008-wiki-reusable-workflow.md
[ADR-0004]: ../adr/adr-0004-shared-wiki-publishing-opt-in.md
[ADR-0009]: ../adr/adr-0009-wiki-publishing-reusable-workflow.md
[ADR-0006]: ../adr/adr-0006-release-process-and-version-pinning.md
[2f267df]: https://git.tirsystem.com/TirSystem/github-action/commit/2f267df2a270087cb7dc482af4ce4f4341e97b03
[95abc18]: https://git.tirsystem.com/TirSystem/github-action/commit/95abc18a95d70c065b979123b8f8de22173af90c
@@ -0,0 +1,198 @@
# MIL-010: Code metrics and coverage badges
## Metadata
| Key | Value |
| --- | --- |
| ID | MIL-010 |
| CrossReference | [BC-001], [US-001], [MIL-003], [MIL-004], [ADR-0005], [ADR-0006] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Deprecated | Jens Tirsvad Nielsen | AI as stand-in for S01 | Results of tasks 3, 6 and 8 added: the report as an artifact of the caller (ADR-0010), adoption in a throwaway repository with seeded change and failure; reviewed (RC-074) | [5c5a1d1] |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Task 9 results added: released as 2.1.0; outcome reviewed (RC-075) | [aa20e56] |
---
## Purpose
Decide whether a repository can show, as SVG badges, how many code files and
how many lines of code (without comment and blank lines) it holds and how
much of that code its tests cover, produced by one shared workflow of this
repository, without a service outside the instance.
## Deliverable
A reusable workflow `code-metrics.yml` with a script file of this repository
behind it, which counts the code files and the lines of code, reads the
coverage report the caller supplies, writes the badges "code files", "lines
of code" and "coverage" as SVG files and commits them to a `badges` branch of
the calling repository. It comes with a documented set of inputs, a guide and
wiki pages in English, Danish and Bahasa Malaysia, a use in at least one other
repository, and a release that makes it available at the major tag. The
existing workflows keep their names and contracts.
Decisions taken by the user in chat on 2026-10-14, which the contract of task 2
records and does not reopen:
- The counter is a Python script of this repository with no dependency outside
the standard library (not `cloc`, `tokei` or `scc`).
- The delivery is a reusable workflow (`workflow_call`), as the quality-check
workflows are.
- The badges are committed to a `badges` branch, so a README can link to
them; they are not only a run artifact.
- Three badges: code files, lines of code and coverage. A badge per language
is optional and is decided in the ADR of task 2.
- The coverage report is read in the Cobertura XML format, which `coverage.py`,
`gcovr` and `coverlet` all write; the counter does not run tests itself, so a
caller that wants a coverage badge runs its tests first and passes the path
of the report.
## Go / No-Go Criteria
| # | Criterion (objectively checkable) | Go | No-Go |
| --- | --- | --- | --- |
| 1 | A job on the runner of the instance can push a commit to a `badges` branch of its own repository with the token the run provides, and the SVG renders as an image in a README on the instance and on the GitHub mirror, verified and recorded | Both render | The push needs a token with more than the contents of its own repository, or the image does not render |
| 2 | The contract (what a code file is, what a comment and a blank line are for each language, excluded paths, generated and vendored files, the coverage report format, the badge colours and text) is decided in an ADR | ADR accepted | Open |
| 3 | The counter gives the hand-counted numbers (files, code, comment, blank) for a fixture of each supported language, including a block comment, a trailing comment, a comment marker inside a string and a file with no final newline | Equal for every fixture | Any difference |
| 4 | The coverage reader gives the percentage of the fixture reports, and a missing or malformed report is a failure that names the file, never a badge showing 0% | Verified | A bad report produces a badge |
| 5 | The badges are valid SVG, carry a title and a text alternative, have a fixed width per text, and are byte-identical for the same input | Verified | Not valid or not stable |
| 6 | The workflow commits nothing when no badge changed, does not start itself again from its own push, and asks for the least permission that writes to its own repository | Verified in a run | A loop, or a wider permission |
| 7 | One other repository runs the workflow and its README shows the three badges, with a seeded change that moves the coverage badge to another colour | Shown | Does not run or does not change |
| 8 | The workflow embeds no script: it runs a file of this repository, and the offline tests exercise the file | Count of embedded scripts is 0 | Embedded script remains |
| 9 | A release (a minor version) makes it available, and the changelog, the README workflow table and the wiki name it | Released | Unreleased |
## Dependencies
| Depends on | Reason |
| --- | --- |
| MIL-003 | The reusable workflow mechanism, the `tools-ref` input and the guide for reading results |
| MIL-004 | The release process and the release workflow publish the result |
## Traceability
| Business Case objective / KPI / user story | Reference |
| --- | --- |
| O5 (added to the Business Case in the same change as this milestone) | [BC-001] |
| New stories of task 1, to be written in US-001 | [US-001] |
## Ownership
| Role | Stakeholder ID (SA) |
| --- | --- |
| Owner | S05 |
| Approving reviewer | S01 |
## Target Date
2027-01-30 — it follows the last decision of the plan, 2027-01-16, with two
weeks from 2027-01-18; proposed by the AI and accepted by the user in chat on
2026-10-14, recorded by the AI as stand-in for S05 (ADR-0002). The Business
Case sets no deadline.
## Tasks
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
| --- | --- | --- | --- | --- |
| 1 | Write the use case and stories for the metrics badges | Add a use case "Show code metrics and coverage badges" for the software engineer, add it to the use case diagram, and add stories to US-001: the badges appear after a push, a coverage report that is missing or malformed fails with the file named, and nothing is committed when the numbers are unchanged. Each story has a pass and a fail acceptance criterion. Review them with the checklists of the `artifact` skill. | Yes | US-001 |
| 2 | Decide the contract | Write an ADR with the definitions the counter needs (code file, comment, blank line, per language), the default includes and excludes, the languages of the first version, the Cobertura XML coverage input, the badge texts and colour thresholds, the inputs of the workflow, the name and content of the `badges` branch, and what a pass, a failure and a run without files mean, in the style of ADR-0005. Record the decisions of the Deliverable. | No | |
| 3 | Verify the delivery on the instance | On a throwaway branch, run a job that commits an SVG to a `badges` branch with the token of the run, then check that the raw URL serves it as an image on the instance, that a README shows it, and that it also shows on the GitHub mirror. Record the result in this milestone like MIL-007 task 2, together with the permission that was needed. | No | |
| 4 | Implement the counter | Add `tools/count_loc.py` and tests with a fixture per language under `tests/`: file and line counts split into code, comment and blank, an exclude list, and a machine-readable result on standard output. Standard library only, as the rules of the repository for tools say. | No | |
| 5 | Implement the coverage reader and the badge renderer | Add the reader of the Cobertura XML report and the SVG renderer, with the failure cases of Go/No-Go criterion 4 and a stable output (criterion 5), each with offline tests. | No | |
| 6 | Implement the workflow | Add the reusable workflow `code-metrics.yml` and its script file, which calls the counter, the reader and the renderer and commits to the `badges` branch as the contract of task 2 says, with least-privilege permissions and offline tests as `quality-checks.yml` has. | No | |
| 7 | Write the guides and the wiki pages | A guide in `guides/` with the call, the inputs, how to produce a coverage report for Python, C++ and C#, and the Markdown line that shows the badges; the wiki pages in `docs/wiki` in English, Danish and Bahasa Malaysia; the README table and diagram and the wiki Home workflow list (a test requires every workflow to be listed). | No | |
| 8 | Adopt the workflow in one other repository | Onboard a real repository, or a throwaway one when none fits, show the badges in its README and verify a seeded change that moves the coverage badge. Fix the gaps in the guide that appear. | No | |
| 9 | Release | Add the changelog entry (a new workflow is a minor change, ADR-0006) and run the Release workflow; record the results in this milestone and review it. | No | |
## Verification results
Task 3 was run on 2026-10-14 with a throwaway branch, `verify-badges-delivery`,
in `TirSystem/github-action` (run 1418, success). One job on `ubuntu-latest`
with `permissions: contents: write` checked the repository out, created an
orphan branch `badges-verify` with one SVG file and a commit message ending in
`[skip ci]`, and pushed it with the token of the run (the credential that
`actions/checkout` stores); it then requested the raw URL.
| Fact | Result |
| --- | --- |
| Push with the token of the run | Accepted: `git push origin HEAD:refs/heads/badges-verify` created the branch; no secret and no personal access token was needed |
| Raw URL on the instance | `https://git.tirsystem.com/TirSystem/github-action/raw/branch/badges-verify/code-files.svg` answers `200`, `Content-Type: image/svg+xml`, `Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox`, `Cache-Control: public, max-age=21600` (six hours) |
| The branch on the GitHub mirror | The push mirror (`sync_on_commit`, every 8 h otherwise) copied the branch within seconds; `https://raw.githubusercontent.com/TirSystem/github-action/badges-verify/code-files.svg` answers `200`, `Content-Type: image/svg+xml`, `Cache-Control: max-age=300` |
| Repository visibility | Public; a README image on GitHub reads the raw URL, which needs no token |
The SVG is served as an image on both hosts, so it renders in a README on the
instance and on the mirror; the content security policy rules out script and
external references inside the file, as ADR-0010 requires. The six-hour
cache on the instance means a changed badge can show the old number for up to
six hours there; the guide says so. Not covered by this task: a private
repository (the raw URL then needs a login, so a badge does not render for an
anonymous reader), and the rendering inside a Gitea README, which is the same
`<img>` request. The throwaway branches `verify-badges-delivery` and
`badges-verify` are left in place because deleting a branch is an action the
run stops on; they are listed in the summary for the user to delete.
Task 6 changed the contract once while it was implemented. A called workflow
runs in its own job, so it cannot read a report that the caller's test job
wrote in its workspace; a report the repository commits is the only file it can
see. ADR-0010 was amended (RC-073): the caller uploads the report as an
artifact and names it in the new input `coverage-artifact`; the workflow
downloads it with `actions/download-artifact` into the directory
`coverage-artifact` and `coverage-report` names the file inside it. The scope
and the three badges did not change.
Task 8 was run on 2026-10-14 in a throwaway private repository of the
organisation, `TirSystem/code-metrics-adoption` (no repository of a project
fits, and the user's plan allows a throwaway). It holds a two-file Python
module with tests and a workflow of two jobs: the tests with `pytest-cov`
upload `coverage.xml` as the artifact `coverage`, and the second job calls
`code-metrics.yml` and `tools-ref` of the branch `mil-010-implementation` of
this repository, before its merge.
| Step | Result |
| --- | --- |
| Baseline (run 1423) | All steps pass, including `Download the coverage report` with `actions/download-artifact@v4.1.8` on Gitea 1.27.3; the `badges` branch is created with one commit by `code-metrics` and the message `Update code metrics badges [skip ci]`; `code-files.svg` shows 2, `code-lines.svg` 28 (the hand count of the two files), `coverage.svg` 100% in green `#44cc11` |
| The push of the badges | No run was started by it: the runs of the repository are the two of the push to `main` (the metrics workflow and the scoped sync) |
| Seeded change (run 1425): two tests removed | The coverage badge reads 60% in yellow `#dfb317`; one new commit on `badges` that changes the badge files; the files and the lines badges changed with the tests |
| Seeded failure (run 1429): `coverage-report` names a file that does not exist | The job `code-metrics` fails: `::error::[configuration] coverage-report 'coverage-artifact/nope.xml' does not exist.`; `badges` is unchanged (two commits) |
| README | Its three Markdown images render as `<img>` of the raw URLs of the `badges` branch (checked with the markdown API of the instance); the raw URLs answer `image/svg+xml` as in task 3 |
Not covered: a run that changes nothing (the unchanged case is covered by the
offline tests, not by a run), two runs that write the branch at the same time
(covered by an offline test with a rejecting remote, not on the instance), the
rendering for a reader who is not signed in to a private repository, and a
repository of a project with a real coverage report. The throwaway repository
`TirSystem/code-metrics-adoption` is left in place because deleting a
repository is an action the run stops on; it is listed in the summary for the
user to delete.
Task 9 was run on 2026-10-14. The implementation was merged in pull request
164 after its checks were green; the user merged it, because the host refused
the merge through the API with a required check `Publish wiki / *` that the
branch protection API does not list and that nothing in this repository
reports. The Release workflow was run for 2.1.0 on the merge commit
`16faffa`: a dry run (run 1462) and then the release (run 1463), both green.
| Check | Result |
| --- | --- |
| Tag | `v2.1.0` and the moved major tag `v2` both point at `16faffa` |
| Release page | `v2.1.0`, not a draft, with the changelog entry as its text (`Added`: the workflow `code-metrics.yml`) |
| Callable at the major tag | `.gitea/workflows/code-metrics.yml` and `tools/count_loc.py` are served at `v2` and `v2.1.0` |
| Checks on `main` after the merge | validation, milestone publishing, wiki publishing and the metadata sync all green (runs 1458 to 1461) |
Go/No-Go criteria of this milestone at its close: 1 to 8 as in the results
above; 9 (a release makes it available, and the changelog, the README table and
the wiki name it) is met by the release of 2.1.0. Success criterion 5 of the
Business Case (a repository besides this one shows the badges) is met in a
throwaway repository only; a project repository has not adopted it yet.
---
[BC-001]: ../business-case.md
[US-001]: ../user-stories.md
[MIL-003]: ./mil-003-quality-checks.md
[MIL-004]: ./mil-004-versioned-release.md
[ADR-0005]: ../adr/adr-0005-quality-check-contract.md
[ADR-0006]: ../adr/adr-0006-release-process-and-version-pinning.md
[5002450]: https://git.tirsystem.com/TirSystem/github-action/commit/50024505fe788b1c5e3021c0d1fc3d079590070e
[5c5a1d1]: https://git.tirsystem.com/TirSystem/github-action/commit/5c5a1d19d96a6979b4f6141e736957174ba686a9
[aa20e56]: https://git.tirsystem.com/TirSystem/github-action/commit/aa20e56110f4c2fab91a8432ba008ee8300926a2
@@ -0,0 +1,119 @@
# MIL-011: Fix the defaults of the code metrics workflow
## Metadata
| Key | Value |
| --- | --- |
| ID | MIL-011 |
| CrossReference | [BC-001], [US-001], [MIL-010], [ADR-0010], [ADR-0006] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | S01 | Added the results of task 1 (reproduction and the defaults of the five workflows); reviewed (RC-077), accepted by the AI as stand-in for S01 in autonomous mode | [e11c43f] |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Added the results of tasks 2 to 5 (the fix, the test, the guides, the run on the instance); reviewed in RC-078, the release follows | [a6892c3] |
---
## Purpose
Decide whether the released code metrics workflow can be called with its documented defaults, and correct it if it cannot.
Release 2.1.0 ([MIL-010]) added `code-metrics.yml`. Its guide, its header comment and the default of its `tools-ref` input name `v1`, but the workflow and its scripts (`tools/code-metrics.sh`, `tools/count_loc.py`, `tools/badges.py`) exist only from `v2.1.0`. A caller who follows the guide (`@v1`) cannot resolve the workflow, and a caller at `@v2` that leaves `tools-ref` at its default fetches the scripts from `v1`, where they are absent, so the run fails. The offline tests of [MIL-010] did not see it, because they run the scripts from the checkout and never resolve a ref. The framework wiki page `Badges` works around it by telling callers to set `tools-ref: v2`.
The other four reusable workflows also default `tools-ref` to `v1`; their scripts exist at `v1`, but a default that follows an old major is the same kind of error, so this milestone checks them too.
## Deliverable
A patch release (`2.1.1`, [ADR-0006]) in which: the default `tools-ref` of every reusable workflow names a tag that holds the scripts it runs; the guide, the header comment of `code-metrics.yml`, the upgrading guide, the README and the wiki pages in English, Danish and Bahasa Malaysia call the workflow at `@v2`; a test fails when a default `tools-ref` names a tag without the script; and the changelog has a `Fixed` entry. In `TirSystem/sqa-qc-framework`: the `Badges` wiki page without the `tools-ref` workaround.
## Go / No-Go Criteria
| # | Criterion (objectively checkable) | Go | No-Go |
| --- | --- | --- | --- |
| 1 | The defect is reproduced before the fix: a call at the major tag with the defaults fails, and the failure names the missing script, recorded in this milestone | Reproduced and recorded | Not reproduced, or not recorded |
| 2 | Every reusable workflow's default `tools-ref` names a tag that contains the script file the workflow runs, listed per workflow in this milestone | All five checked and listed | A default names a tag without its script |
| 3 | The default is derived, not copied: one place gives the current major, and a test fails when a workflow default differs from it or names a tag without the script | Test fails on a seeded wrong default and passes on the fix | No such test |
| 4 | No guide, comment, README or wiki page tells a caller to use `@v1` for `code-metrics.yml`; a search of `guides/`, `README.md`, `docs/wiki/` and `.gitea/workflows/` finds none | Count is 0 | A page still says `@v1` for it |
| 5 | A call with the documented defaults runs on the instance and commits the badges to a `badges` branch, verified on a throwaway branch and recorded | Run succeeds | Fails or is not run |
| 6 | The release is a patch (`2.1.1`): the changelog has a `Fixed` entry, the major tag `v2` moves to it, and `v1` is not touched | Released | Released as another level, or `v1` moved |
| 7 | The framework `Badges` page no longer tells a caller to set `tools-ref`, in all three languages, and still calls the workflow at `@v2` | Page merged | The workaround remains |
| 8 | Reviewed | A review record (`RC-*`) for this milestone and the changed workflow, tests and guides, each with a verdict of Go | An instance without a record |
## Dependencies
| Depends on | Reason |
| --- | --- |
| [MIL-010] | The workflow and its guide are its deliverables; the defect is in release 2.1.0 |
| [ADR-0006] | The release process: a fix is a patch release, and a moving major tag follows it |
## Traceability
| Business Case objective / KPI / user story | Reference |
| --- | --- |
| Business Case objective O5: a shared workflow that counts the code files and lines of code, reads the coverage report and publishes the three results as SVG badges; the workflow cannot be called as documented until this milestone is done | [BC-001] |
| User stories | [US-001] (no new story: the tasks below are technical, and the story of [MIL-010] for the badges stays as written) |
## Ownership
| Role | Stakeholder ID (SA) |
| --- | --- |
| Owner | S05 |
| Approving reviewer | S01 |
## Target Date
2026-10-23 (Friday), one week of work: the fix is small and a caller cannot use the workflow until it is released. This precedes the planned decision date of [MIL-010] (2027-01-30) because that milestone was released on 2026-10-14, ahead of its date; the schedule row of [MIL-010] is not changed here. The Business Case sets no deadline.
## Tasks
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
| --- | --- | --- | --- | --- |
| 1 | Reproduce the defect and list the defaults | On a throwaway branch, call `code-metrics.yml` at `@v2` with the defaults and at `@v1`, and record both failures and the message. List, for each of the five reusable workflows, the default `tools-ref` and whether the script it runs exists at that tag. Record the result in this milestone. | No | [MIL-010] |
| 2 | Fix the defaults | Give the repository one definition of the current major (a file the workflows' tests and the release workflow read), set the default `tools-ref` of every reusable workflow from it, and change the header comment of `code-metrics.yml` to `@v2`. A workflow whose script is at the previous major keeps that tag only with a comment that says why. | No | [ADR-0006] |
| 3 | Add the test | An offline test that reads every workflow in `.gitea/workflows/`, takes the default `tools-ref` and the script it runs, and fails when the default differs from the current major or the script is not in that tag (checked with `git cat-file` against the tags of the checkout). Show it fails on a seeded wrong default and passes on the fix. | No | [MIL-010] |
| 4 | Correct the guides, README and wiki | Change `@v1` to `@v2` for `code-metrics.yml` in `guides/code-metrics.md`, `guides/upgrading.md`, `README.md` and `docs/wiki/CodeMetrics.md`, `.da.md` and `.ms.md`; say in the guide that `tools-ref` defaults to the current major. Search the repository for the remaining `@v1`. | No | |
| 5 | Verify on the instance | On a throwaway branch of a repository, call the fixed workflow at the branch with the defaults, and check that the `badges` branch gets the SVG files. Record the run. | No | [MIL-010] |
| 6 | Release 2.1.1 | Add the `Fixed` entry to the changelog (ADR-0006: a patch), run the Release workflow, and check that `v2` points at `v2.1.1` and `v1` at `v1.2.2`. | No | [ADR-0006] |
| 7 | Remove the workaround from the framework page | In `TirSystem/sqa-qc-framework`, remove the `tools-ref: v2` line and the two bullets about it from `docs/wiki/Badges.md`, `Badges-da.md` and `Badges-ms.md`, and add a changelog line. This is a change in another repository, made after release 2.1.1 and in its own pull request. | No | |
| 8 | Add MIL-011 to the Project Plan | Add the schedule row, the Gantt bar, the scope entry and the dependency to [PP-001], and its review to the traceability matrix. | No | |
| 9 | Review | Record `RC-*` for this milestone, the workflow and tests, and the guides, each with a verdict. | No | |
## Verification results
Task 1 was run on 2026-10-14 with the throwaway branch `verify-code-metrics-defaults` of `TirSystem/github-action`. It calls `code-metrics.yml` at the two refs a caller could use, with every input at its default.
| Call | Result | Evidence |
| --- | --- | --- |
| `...code-metrics.yml@v2`, defaults | Fails in the step "Validate the inputs": `bash: shared-scripts/tools/code-metrics.sh: No such file or directory`, exit code 127. The input `tools-ref` is `v1`, so the scripts are fetched from `v1`. | run 1499, job 1638 |
| `...code-metrics.yml@v1`, defaults | No run is created at all, and no error is shown: two pushes of a workflow that calls it (once with the `@v2` job beside it, once alone) made no run in over a minute, while the push of the `@v2` call alone made one | commits `5654905` and `46e752d` (no run), `9a17868` (run 1499) |
The defaults of the five reusable workflows at `v2.1.0` (`v1` is `1.2.2`, `v2` is `2.1.0`):
| Workflow | Default `tools-ref` | Script it runs | At the default | At `v2` |
| --- | --- | --- | --- | --- |
| `code-metrics.yml` | `v1` | `tools/code-metrics.sh` | **absent** | present |
| `quality-checks.yml` | `v1` | `tools/quality-checks.sh` | present | present |
| `quality-checks-cpp.yml` | `v1` | `tools/quality-checks-cpp.sh` | present | present |
| `quality-checks-csharp.yml` | `v1` | `tools/quality-checks-csharp.sh` | present | present |
| `publish-wiki-pages.yml` | `v1` | `tools/publish_wiki.py` | present | present |
Only `code-metrics.yml` is broken. The other four resolve, but a caller at `@v2` runs their scripts from `1.2.2` and not from `2.1.0`; `tools/publish_wiki.py` changed in `2.0.0` (it requires `WIKI_PRUNE` and no longer reads a marker). Whether that is a defect is decided in task 2.
Tasks 2 to 5 were done on 2026-10-14 on the branch `mil-011-fix`:
- **Fix (task 2):** the file `MAJOR_TAG` holds the current major (`v2`); the default `tools-ref` of the five reusable workflows is `v2`, and the header comment of `code-metrics.yml` calls it at `@v2`. The four workflows other than `code-metrics.yml` followed the older major only by default and changed no behaviour for a caller at `@v1`; for a caller at `@v2` the scripts now come from the same major as the workflow.
- **Test (task 3):** `tests/test_tools_ref.py` ties `MAJOR_TAG` to the highest major of the changelog and checks every reusable workflow's default and script. With `default: "v1"` seeded in `code-metrics.yml` three tests failed; restored, they pass. The suite passes (540 tests).
- **Guides (task 4):** `guides/code-metrics.md`, `guides/upgrading.md`, the three quality-check guides, `README.md` and the wiki pages in English, Danish and Bahasa Malaysia; the amendments of ADR-0005, ADR-0008, ADR-0009 and ADR-0010. A search for `code-metrics.yml@v1` finds none.
- **Instance (task 5):** the workflow at `@mil-011-fix` with every input at its default except `badges-branch` ran as run 1509 (job 1649): `tools-ref` resolved to `v2`, the scripts were fetched, and the badges were committed to `badges-verify` (commit `041d991`).
---
[BC-001]: ../business-case.md
[US-001]: ../user-stories.md
[MIL-010]: ./mil-010-code-metrics-badges.md
[ADR-0010]: ../adr/adr-0010-code-metrics-badges-contract.md
[ADR-0006]: ../adr/adr-0006-release-process-and-version-pinning.md
[PP-001]: ../project-plan.md
[e11c43f]: https://git.tirsystem.com/TirSystem/github-action/commit/e11c43f0a41e7dd9647f7804947d6e464407a597
[a6892c3]: https://git.tirsystem.com/TirSystem/github-action/commit/a6892c372aca9f2e12826a4c3b260290a0656ecb
+33 -7
View File
@@ -4,25 +4,25 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | PP-001 | | ID | PP-001 |
| CrossReference | [BC-001], [SA-001], [ADR-0002], [US-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007] | | CrossReference | [BC-001], [SA-001], [ADR-0002], [US-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007], [MIL-008], [MIL-009], [MIL-010], [MIL-011] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Dates confirmed by S01 (stand-in for S05); the confirmation item is removed from Open Issues | [ea06eaa] | | 2026-10-14 | Deprecated | Jens Tirsvad Nielsen | AI as stand-in for S01 | Added MIL-010 (code metrics and coverage badges); reviewed (RC-068) | [5002450] |
| 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | Added MIL-007 (quality checks for C++ and C#); reviewed (RC-053) | [e3ad1fa] | | 2026-10-14 | Accepted | Jens Tirsvad Nielsen | S01 | Added MIL-011 (fix the defaults of the code metrics workflow); reviewed (RC-076), accepted by the author in chat as stand-in for S01 | [02e3794] |
--- ---
## Purpose ## Purpose
This plan schedules seven milestones that move the repository from one This plan schedules eleven milestones that move the repository from one
workflow with known defects to a documented, versioned collection of shared workflow with known defects to a documented, versioned collection of shared
workflows. The Business Case sets no deadline, so the dates are the plan's own; they were confirmed on 2026-10-10 by S01, standing in for S05 (ADR-0002). workflows. The Business Case sets no deadline, so the dates are the plan's own; they were confirmed on 2026-10-10 by S01, standing in for S05 (ADR-0002).
## Planning Assumptions ## Planning Assumptions
- Week 1 starts 2026-10-05; phases are two weeks long; the last decision is 2026-12-26; MIL-007 follows in January 2027 (2027-01-04 to 2027-01-16, confirmed on 2026-10-11 by S01). - Week 1 starts 2026-10-05; phases are two weeks long; the last decision is 2026-12-26; MIL-007 follows in January 2027 (2027-01-04 to 2027-01-16, confirmed on 2026-10-11 by S01). MIL-008 amends the shared wiki publishing of MIL-006 and runs in parallel with the October and November windows: its work started on 2026-10-13 and its decision date is its own Target Date, 2026-11-15. MIL-009 follows MIL-008 and runs from 2026-11-16 to its proposed Target Date, 2026-11-30, confirmed by S01 in chat on 2026-10-14. MIL-010 (code metrics and coverage badges) follows MIL-007 in January 2027, from 2027-01-18 to its Target Date, 2027-01-30, accepted by the user in chat on 2026-10-14.
- Work on a milestone starts only after its `MIL-*` document is `Accepted`. - Work on a milestone starts only after its `MIL-*` document is `Accepted`.
- Dates were confirmed on 2026-10-10 by S01, standing in for S05 (ADR-0002). - Dates were confirmed on 2026-10-10 by S01, standing in for S05 (ADR-0002).
@@ -37,6 +37,10 @@ workflows. The Business Case sets no deadline, so the dates are the plan's own;
| Wiki and translations | [MIL-005] | 2026-11-30 to 2026-12-12 | 2026-12-12 | S05 | None yet | Wiki pages in English, Danish and Bahasa Malaysia, kept current by every pull request | [Milestone MIL-005] | | Wiki and translations | [MIL-005] | 2026-11-30 to 2026-12-12 | 2026-12-12 | S05 | None yet | Wiki pages in English, Danish and Bahasa Malaysia, kept current by every pull request | [Milestone MIL-005] |
| Shared wiki publishing | [MIL-006] | 2026-12-14 to 2026-12-26 | 2026-12-26 | S05 | None yet | Scoped publish-wiki workflow with opt-in, piloted in one other repository | [Milestone MIL-006] | | Shared wiki publishing | [MIL-006] | 2026-12-14 to 2026-12-26 | 2026-12-26 | S05 | None yet | Scoped publish-wiki workflow with opt-in, piloted in one other repository | [Milestone MIL-006] |
| Quality checks for C++ and C# | [MIL-007] | 2027-01-04 to 2027-01-16 | 2027-01-16 | S05 | US-001.09, US-001.10 (to extend) | Reusable quality-check workflows for C++ and C#, released | [Milestone MIL-007] | | Quality checks for C++ and C# | [MIL-007] | 2027-01-04 to 2027-01-16 | 2027-01-16 | S05 | US-001.09, US-001.10 (to extend) | Reusable quality-check workflows for C++ and C#, released | [Milestone MIL-007] |
| Wiki publishing as a reusable workflow | [MIL-008] | 2026-10-13 to 2026-11-15 | 2026-11-15 | S05 | None yet | Reusable publish-wiki-pages workflow, wiki in docs/wiki, scoped workflow deprecated, released as 1.2.2 | [Milestone MIL-008] |
| Migrate the wiki callers and remove the scoped workflow | [MIL-009] | 2026-11-16 to 2026-11-30 | 2026-11-30 | S05 | None yet | Seven repositories publish through a caller, scoped workflow removed, ADR-0004 superseded, released as 2.0.0 | Not created yet (the sync creates it when MIL-009 is Accepted) |
| Code metrics and coverage badges | [MIL-010] | 2027-01-18 to 2027-01-30 | 2027-01-30 | S05 | None yet (task 1 writes them) | Reusable workflow that counts code files and lines of code, reads coverage and commits SVG badges, released | Not created yet (the sync creates it when MIL-010 is Accepted) |
| Fix the defaults of the code metrics workflow | [MIL-011] | 2026-10-14 to 2026-10-23 | 2026-10-23 | S05 | None (technical tasks) | Patch release 2.1.1: the default `tools-ref` of every reusable workflow names a tag that holds its scripts, a test for it, guides and wiki at `@v2`, the framework Badges page without the workaround | Not created yet (the sync creates it when MIL-011 is Accepted) |
```plantuml ```plantuml
@startgantt @startgantt
@@ -55,6 +59,14 @@ Project starts 2026-10-05
[MIL-006 Go/No-Go] happens 2026-12-26 [MIL-006 Go/No-Go] happens 2026-12-26
[MIL-007 C++ and C#] starts 2027-01-04 and ends 2027-01-16 [MIL-007 C++ and C#] starts 2027-01-04 and ends 2027-01-16
[MIL-007 Go/No-Go] happens 2027-01-16 [MIL-007 Go/No-Go] happens 2027-01-16
[MIL-008 Reusable wiki workflow] starts 2026-10-13 and ends 2026-11-15
[MIL-008 Go/No-Go] happens 2026-11-15
[MIL-009 Migrate and remove] starts 2026-11-16 and ends 2026-11-30
[MIL-009 Go/No-Go] happens 2026-11-30
[MIL-010 Badges] starts 2027-01-18 and ends 2027-01-30
[MIL-010 Go/No-Go] happens 2027-01-30
[MIL-011 Defaults fix] starts 2026-10-14 and ends 2026-10-23
[MIL-011 Go/No-Go] happens 2026-10-23
@endgantt @endgantt
``` ```
@@ -69,6 +81,9 @@ Project starts 2026-10-05
| Wiki pages in English, Danish and Bahasa Malaysia | [MIL-005] | | Wiki pages in English, Danish and Bahasa Malaysia | [MIL-005] |
| The wiki publisher shared with other repositories through scoped delivery | [MIL-006] | | The wiki publisher shared with other repositories through scoped delivery | [MIL-006] |
| Gitea Actions workflows for software engineers (quality checks for C++ and C#) | [MIL-007] | | Gitea Actions workflows for software engineers (quality checks for C++ and C#) | [MIL-007] |
| The wiki publisher as a workflow that repositories call, from docs/wiki | [MIL-008] |
| Moving every publishing repository to the called workflow and removing the scoped one | [MIL-009] |
| A shared workflow for code metrics and coverage badges | [MIL-010], [MIL-011] |
## Dependencies ## Dependencies
@@ -76,6 +91,8 @@ Project starts 2026-10-05
MIL-001 → MIL-002 → MIL-003 → MIL-004 MIL-001 → MIL-002 → MIL-003 → MIL-004
MIL-002 → MIL-005 → MIL-006 MIL-002 → MIL-005 → MIL-006
MIL-003 + MIL-004 → MIL-007 MIL-003 + MIL-004 → MIL-007
MIL-006 → MIL-008 → MIL-009
MIL-003 + MIL-004 → MIL-010 → MIL-011
``` ```
A No-Go moves every later window by the rework time of the failed milestone. A No-Go moves every later window by the rework time of the failed milestone.
@@ -86,6 +103,9 @@ A No-Go moves every later window by the rework time of the failed milestone.
| --- | --- | --- | | --- | --- | --- |
| The runner cannot provide the C++ or C# tools (MIL-007) | The workflows need a custom runner image or a longer install | MIL-007 task 2 verifies it first; the ADR of task 3 says what a build-dependent check needs from the caller. | | The runner cannot provide the C++ or C# tools (MIL-007) | The workflows need a custom runner image or a longer install | MIL-007 task 2 verifies it first; the ADR of task 3 says what a build-dependent check needs from the caller. |
| Reusable workflow support is missing on the instance | MIL-003 and MIL-004 change shape | Verify first in each milestone (MIL-002 task 2, MIL-003 task 1); fall back to copied templates. | | Reusable workflow support is missing on the instance | MIL-003 and MIL-004 change shape | Verify first in each milestone (MIL-002 task 2, MIL-003 task 1); fall back to copied templates. |
| Eight repositories still publish through the scoped workflow that MIL-008 deprecates (MIL-008 task 5) | Removing it would stop their wikis | It is deprecated and kept; a follow-up milestone migrates them and removes it in a major release (RC-061). |
| An organisation has no `TOKEN_FOR_GITEA_WIKI` secret, or a repository fails its first run (MIL-009 tasks 3 and 4) | The wiki of that repository stops updating | MIL-009 task 5 reads each wiki back after the first run; the scoped workflow is removed only after every repository passes. |
| The token of a run cannot push to a `badges` branch, or the SVG does not render on the mirror (MIL-010) | The delivery of the badges changes shape | MIL-010 task 3 verifies it first; fall back to a badge file in a path of the default branch or to a run artifact. |
| Security review by S05 is a bottleneck | Milestone decisions slip | Keep milestones small and plan review time before each decision date. | | Security review by S05 is a bottleneck | Milestone decisions slip | Keep milestones small and plan review time before each decision date. |
## Open Issues ## Open Issues
@@ -258,6 +278,10 @@ no tests, no release process.
[MIL-005]: ./milestones/mil-005-wiki-and-translations.md [MIL-005]: ./milestones/mil-005-wiki-and-translations.md
[MIL-006]: ./milestones/mil-006-shared-wiki-publishing.md [MIL-006]: ./milestones/mil-006-shared-wiki-publishing.md
[MIL-007]: ./milestones/mil-007-cpp-csharp-quality-checks.md [MIL-007]: ./milestones/mil-007-cpp-csharp-quality-checks.md
[MIL-008]: ./milestones/mil-008-wiki-reusable-workflow.md
[MIL-009]: ./milestones/mil-009-migrate-wiki-callers-and-remove-scoped-workflow.md
[MIL-010]: ./milestones/mil-010-code-metrics-badges.md
[MIL-011]: ./milestones/mil-011-code-metrics-default-tools-ref.md
[Milestone MIL-001]: https://git.tirsystem.com/TirSystem/github-action/milestone/18 [Milestone MIL-001]: https://git.tirsystem.com/TirSystem/github-action/milestone/18
[Milestone MIL-002]: https://git.tirsystem.com/TirSystem/github-action/milestone/19 [Milestone MIL-002]: https://git.tirsystem.com/TirSystem/github-action/milestone/19
[Milestone MIL-003]: https://git.tirsystem.com/TirSystem/github-action/milestone/20 [Milestone MIL-003]: https://git.tirsystem.com/TirSystem/github-action/milestone/20
@@ -265,6 +289,8 @@ no tests, no release process.
[Milestone MIL-005]: https://git.tirsystem.com/TirSystem/github-action/milestone/93 [Milestone MIL-005]: https://git.tirsystem.com/TirSystem/github-action/milestone/93
[Milestone MIL-006]: https://git.tirsystem.com/TirSystem/github-action/milestone/94 [Milestone MIL-006]: https://git.tirsystem.com/TirSystem/github-action/milestone/94
[Milestone MIL-007]: https://git.tirsystem.com/TirSystem/github-action/milestone/95 [Milestone MIL-007]: https://git.tirsystem.com/TirSystem/github-action/milestone/95
[ea06eaa]: https://git.tirsystem.com/TirSystem/github-action/commit/ea06eaaa698247d20e4a8e2694d7acbb1de58b63 [Milestone MIL-008]: https://git.tirsystem.com/TirSystem/github-action/milestone/152
[b74ee0e]: https://git.tirsystem.com/TirSystem/github-action/commit/b74ee0e5cfd04f25ba5f2c1addc80699147c479a [b74ee0e]: https://git.tirsystem.com/TirSystem/github-action/commit/b74ee0e5cfd04f25ba5f2c1addc80699147c479a
[e3ad1fa]: https://git.tirsystem.com/TirSystem/github-action/commit/e3ad1fa7e7eef57a6793a479edb41ac6fd2db688 [2f267df]: https://git.tirsystem.com/TirSystem/github-action/commit/2f267df2a270087cb7dc482af4ce4f4341e97b03
[5002450]: https://git.tirsystem.com/TirSystem/github-action/commit/50024505fe788b1c5e3021c0d1fc3d079590070e
[02e3794]: https://git.tirsystem.com/TirSystem/github-action/commit/02e3794d7b05799af2544ca303c99271da788e82
+54
View File
@@ -0,0 +1,54 @@
# Review Record: PP-001 Project Plan (MIL-008)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-062 |
| CrossReference | [PP-001], [BC-001], [MIL-008] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version | [9aeb74e] |
---
## Artifact Under Review
- Instance reviewed: [PP-001]
- Checklist used: none: the Project Plan has no QC checklist. Validated against the Business Case [BC-001] and the Go / No-Go criteria of each listed milestone, as `PP.md` prescribes.
- Scope: delta re-review for the added MIL-008 row, Gantt entries, Scope Coverage, Dependencies, one Plan Risk and the counts; the earlier record is RC-053
- Language and domain: n/a (technical type)
- Mode: supervised (the AI prepared the record; S01, the user, gave the Go in chat on 2026-10-13)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Every milestone in the plan has a `MIL-*` document and the plan's dates equal that document's target date | Pass | MIL-001 to MIL-008 exist; the MIL-008 decision date 2026-11-15 equals its Target Date. |
| 2 | Every Business Case scope item is covered by a gateway | Pass | The wiki publisher shared with other repositories is covered by MIL-006 and MIL-008 (O2, O3). |
| 3 | The schedule respects the Business Case constraints | Pass | The Business Case sets no deadline; the MIL-008 window overlaps the October and November windows and says so under Planning Assumptions. |
| 4 | Dependencies between milestones are stated | Pass | MIL-006 to MIL-008 is in the Dependencies diagram and in MIL-008's own document. |
| 5 | Every gateway has an owner who is a stakeholder ID | Pass | MIL-008 is owned by S05. |
| 6 | Plan content is internally consistent | Pass | "Eight milestones", the Planning Assumptions, the Gantt entries, the Gateway Schedule and the Scope Coverage agree. |
| 7 | Open Issues are current | Pass | Unchanged items remain open; a plan risk was added for the repositories that still use the scoped workflow. |
## Overall Verdict
Go - all seven criteria pass; no findings. S01 gave the Go in chat on 2026-10-13, after the change was merged as pull request 137 with the plan row `Proposed`; this record and the plan row are set to `Accepted` in the follow-up.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Set PP-001 and this record to `Accepted` (done in the follow-up that follows pull request 137) | S05 | 2026-10-13 |
| Review ADR-0009 (still without a review record) | S01 | after the plan |
---
---
[PP-001]: ../../project-plan.md
[BC-001]: ../../business-case.md
[MIL-008]: ../../milestones/mil-008-wiki-reusable-workflow.md
[9aeb74e]: https://git.tirsystem.com/TirSystem/github-action/commit/9aeb74e8b09bb7882847e9bd5d569dbc9856fc03
+56
View File
@@ -0,0 +1,56 @@
# Review Record: ADR-0009 Wiki publishing as a reusable workflow
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-063 |
| CrossReference | [ADR-0009], [QC-ADR-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version | [8c2c52e] |
---
## Artifact Under Review
- Instance reviewed: [ADR-0009]
- Checklist used: [QC-ADR-001]
- Scope: full review
- Language and domain: n/a (technical type)
- Mode: supervised (the AI prepared the record; S01, the user, gave the Go in chat on 2026-10-13)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The ID (`ADR-NNNN`, 4-digit) matches the filename number and is unique and sequential | Pass | ADR-0009 in `adr-0009-wiki-publishing-reusable-workflow.md`; follows ADR-0008. |
| 2 | Context states the problem, the forces (cost, risk, constraints) and the options evaluated | Pass | Names the scoped delivery, its gate, the fixed trigger path and version, and the new folder rule. |
| 3 | At least two options were considered, or the absence of alternatives is justified | Pass | Two options: keep the scoped workflow and read both folders, or a reusable workflow. |
| 4 | Decision is stated in one or two unhedged sentences and matches one of the evaluated options | Pass | Two sentences; matches option 2. The rules below it add detail only. |
| 5 | Consequences list both Positive and Negative outcomes | Pass | Finding fixed during this review: the consequence "passing a declared secret is not yet verified" was out of date, because run 316 verified it on 2026-10-13. It now says so. Four positive and four negative outcomes. |
| 6 | Quality-attribute impacts (performance, security, portability, etc.) are named where the decision affects them | Pass | Finding fixed during this review: the security impact was implicit. A positive bullet (explicit secret, no fallback) and a negative bullet (whoever changes the caller changes the folder and `prune`) were added. |
| 7 | Affected Artifacts are listed as links, and each is also in CrossReference | Pass | MIL-008 and ADR-0004 are linked and cited. |
| 8 | Status changes are recorded as new Version History rows with a Change summary and Commit link; retained rows are never rewritten | Pass | The findings fix is a new row; the first row is kept unchanged. |
| 9 | A superseded or deprecated ADR names its successor, and the successor links back | N-A | ADR-0004 is superseded only in part and stays in force until the scoped workflow is removed; see the action item. |
| 10 | Written in business or technical language of the domain, with no unexplained abbreviations | Pass | Finding fixed during this review: "PO language" is now "the product owner's language". |
| 11 | Status is one of `Proposed`, `Accepted`, `Rejected`, `Deprecated` or `Superseded by ADR-NNNN`, and every Version History row uses only these | Pass | `Proposed` only. |
## Overall Verdict
Go - all applicable criteria pass; the three findings (criteria 5, 6 and 10) were fixed during the review. S01 gave the Go in chat on 2026-10-13; there is no independent reader.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| When the scoped workflow is removed, mark ADR-0004 superseded by ADR-0009 for the delivery and marker parts (new version row and review record) | S01 | the follow-up milestone |
---
---
[ADR-0009]: ../../adr/adr-0009-wiki-publishing-reusable-workflow.md
[QC-ADR-001]: ../../../framework/qc/artifacts/qc-adr.md
[8c2c52e]: https://git.tirsystem.com/TirSystem/github-action/commit/8c2c52ebd2a27e4d0edb4008c31c002718d280fb
+63
View File
@@ -0,0 +1,63 @@
# Review Record: MIL-009 and PP-001 (MIL-009)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-064 |
| CrossReference | [MIL-009], [PP-001], [BC-001], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [86e69ce] |
---
## Artifact Under Review
- Instance reviewed: [MIL-009]; delta of [PP-001] for the added milestone
- Checklist used: [QC-MIL-001] for the milestone; for the plan, the criteria of `PP.md` (no QC checklist exists for PP-001)
- Scope: full review of MIL-009; delta re-review of PP-001, earlier record RC-062
- Language and domain: n/a (technical type)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14 with the defaults)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | MIL-009 lists the released framework, seven callers, the removals, the superseded ADR and 2.0.0. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Seven criteria with checkable Go and No-Go (tag, callers, read-backs, scan, removal, ADR rows, tags). |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | MIL-008 and the framework release; in the plan's Dependencies diagram (`MIL-008 -> MIL-009`). |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O2, O3 of [BC-001]. |
| 5 | Milestone owner and approving reviewer are identified | Pass | Owner S05, approving reviewer S01. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | 2026-11-30 is proposed and equals the plan's decision date; the Business Case sets no deadline. S01 has not confirmed it, as MIL-009 and the plan say; this is an action item. |
## Plan delta (PP-001)
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Every milestone has a `MIL-*` document and the plan's dates equal that document's target date | Pass | MIL-001 to MIL-009 exist; the MIL-009 decision date equals its Target Date. |
| 2 | Every Business Case scope item is covered by a gateway | Pass | Scope Coverage names MIL-009 for the removal of the scoped publisher. |
| 3 | The schedule respects the Business Case constraints | Pass | No deadline in the Business Case; the window follows MIL-008. |
| 4 | Dependencies between milestones are stated | Pass | `MIL-006 -> MIL-008 -> MIL-009`. |
| 5 | Every gateway has an owner who is a stakeholder ID | Pass | S05. |
| 6 | Plan content is internally consistent | Pass | "Nine milestones", the assumptions, the Gantt, the schedule and the coverage agree. |
| 7 | Open Issues are current | Pass | A plan risk was added for missing organisation secrets and failed first runs. |
## Overall Verdict
Go - all criteria pass. The user switched to autonomous mode and accepted the plan in chat on 2026-10-14 with the defaults (target date 2026-11-30, no publishing for `027-sandbox` and `028-pomodoro`, framework release 0.7.0); the AI records the acceptance as stand-in for S01. There is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Check that `TirSystem-BashScript` has its own `TOKEN_FOR_GITEA_WIKI` (S03); stop and report if it does not | S03 | MIL-009 task 3 |
---
[MIL-009]: ../../milestones/mil-009-migrate-wiki-callers-and-remove-scoped-workflow.md
[PP-001]: ../../project-plan.md
[BC-001]: ../../business-case.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[86e69ce]: https://git.tirsystem.com/TirSystem/github-action/commit/86e69ce85df72ea3caed40253e08231c73187fde
@@ -0,0 +1,56 @@
# Review Record: ADR-0004 superseded by ADR-0009
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-065 |
| CrossReference | [ADR-0004], [ADR-0009], [QC-ADR-001], [MIL-009] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version | [22fc323] |
---
## Artifact Under Review
- Instance reviewed: [ADR-0004] after the status change to `Superseded by ADR-0009` on 2026-10-14
- Checklist used: [QC-ADR-001]
- Scope: delta re-review of the criteria the status change touches (7, 8, 9, 11); the earlier record is RC-018
- Language and domain: n/a (technical type)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan [MIL-009] in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The ID matches the filename number and is unique and sequential | Pass | Unchanged. |
| 2 | Context states the problem, the forces and the options evaluated | Pass | Unchanged. |
| 3 | At least two options were considered | Pass | Unchanged. |
| 4 | Decision is stated in one or two unhedged sentences and matches an evaluated option | Pass | Unchanged. |
| 5 | Consequences list both Positive and Negative outcomes | Pass | Unchanged. |
| 6 | Quality-attribute impacts are named where the decision affects them | Pass | Unchanged. |
| 7 | Affected Artifacts are listed as links, and each is also in CrossReference | Pass | ADR-0009 is added to both. |
| 8 | Status changes are recorded as new Version History rows with a Change summary and Commit link; retained rows are never rewritten | Pass | The change is a new row; the earlier `Accepted` row became `Deprecated` and its content is unchanged. |
| 9 | A superseded or deprecated ADR names its successor, and the successor links back | Pass | The status names ADR-0009; ADR-0009 lists ADR-0004 under Affected Artifacts and in CrossReference. This closes the N-A of RC-018. |
| 10 | Written in the language of the domain, with no unexplained abbreviations | Pass | Unchanged. |
| 11 | Status is one of the allowed values and every row uses only these | Pass | `Deprecated` and `Superseded by ADR-0009`. |
## Overall Verdict
Go - all criteria pass. The scoped delivery and the marker are replaced and removed (MIL-009 tasks 2 to 6); the token and empty-folder rules of this ADR stand and are carried by ADR-0009. The AI records the acceptance as stand-in for S01; there is no independent reader, and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None open | - | - |
---
[ADR-0004]: ../../adr/adr-0004-shared-wiki-publishing-opt-in.md
[ADR-0009]: ../../adr/adr-0009-wiki-publishing-reusable-workflow.md
[QC-ADR-001]: ../../../framework/qc/artifacts/qc-adr.md
[MIL-009]: ../../milestones/mil-009-migrate-wiki-callers-and-remove-scoped-workflow.md
[22fc323]: https://git.tirsystem.com/TirSystem/github-action/commit/22fc323b41074ee0029ea2f07445a8e329e15d15
@@ -0,0 +1,52 @@
# Review Record: MIL-009 outcome
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-066 |
| CrossReference | [MIL-009], [QC-MIL-001], [RC-064], [ADR-0004] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version | [95abc18] |
---
## Artifact Under Review
- Instance reviewed: [MIL-009] after the verification results were recorded on 2026-10-14
- Checklist used: [QC-MIL-001]
- Scope: delta re-review of the Go / No-Go outcome; the earlier record is [RC-064]
- Language and domain: n/a (technical type)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | Delivered: framework 0.7.0, seven callers, removals, ADR-0004 superseded, 2.0.0. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | All seven criteria have a recorded result, each with evidence. |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | MIL-008 and the framework release were met first. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O2, O3, unchanged. |
| 5 | Milestone owner and approving reviewer are identified | Pass | S05 and S01. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target 2026-11-30; the gate was met on 2026-10-14. |
## Overall Verdict
Go - the gate is met: all seven criteria are Go (criterion 5 with a recorded note that the marker text remains in history records and the upgrade note). The AI records the outcome as stand-in for S01; there is no independent reader, and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Fix the two failing tests of `repo-foundry` on `main` (the checklist layout of its test fixture); not part of this milestone | S05 | not planned |
| Move the `framework` pin of `github-action` itself from `v0.6.2` to `v0.7.0` | S05 | not planned |
---
[MIL-009]: ../../milestones/mil-009-migrate-wiki-callers-and-remove-scoped-workflow.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[RC-064]: ./rc-064-mil-009-plan.md
[ADR-0004]: ../../adr/adr-0004-shared-wiki-publishing-opt-in.md
[95abc18]: https://git.tirsystem.com/TirSystem/github-action/commit/95abc18a95d70c065b979123b8f8de22173af90c
+52
View File
@@ -0,0 +1,52 @@
# Review Record: BC-001 (objective O5, code metrics and coverage badges)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-067 |
| CrossReference | [BC-001], [QC-BC-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [5002450] |
---
## Artifact Under Review
- Instance reviewed: [BC-001]
- Checklist used: [QC-BC-001]
- Scope: delta re-review of criteria 3, 4 and 7 (the change adds objective O5, an In Scope bullet and success criterion 5); criteria 1, 2, 5, 6 and 8 are re-read and unchanged. Earlier record: RC-008
- Language and domain: n/a for this delta (see the action item about the Language and Domain rows)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | ROI/Cost-Benefit analysis is quantitative, or where qualitative, is explicitly justified | Pass | Unchanged; the Cost-Benefit Assessment labels its qualitative form. |
| 2 | Risks are identified with documented impact and mitigation | Pass | Unchanged. The delivery risk of the badges is a plan risk in PP-001, with a mitigation. |
| 3 | Success criteria are measurable, stating explicit targets rather than vague aspirations | Pass | Criterion 5: "At least 1 besides this one by MIL-010", measured in the README of the consuming repository. |
| 4 | Scope explicitly separates In Scope vs Out of Scope | Pass | "A shared workflow for code metrics and coverage badges (MIL-010)" is a new In Scope bullet; Out of Scope is unchanged and does not contradict it ("application code of consuming repositories" is not read or changed by the counter). |
| 5 | Stakeholders are cross-referenced to Stakeholder Analysis IDs rather than re-described inline | Pass | Unchanged; the stakeholders table uses S-IDs. |
| 6 | Methodology and quality-standard foundation are stated explicitly (e.g. ISO/IEC 25010, Larman) | Pass | Unchanged. |
| 7 | Assumptions and constraints are explicit and clearly distinguished from one another | Pass | Unchanged. The constraint "tools available on the runner" still holds: the counter uses the Python standard library. |
| 8 | Document supports executive decision-making with a clear, unambiguous recommendation | Pass | Unchanged: Proceed. |
## Overall Verdict
Go - all eight criteria pass for the revision that adds objective O5, its scope item and success criterion 5. The user accepted the plan in chat on 2026-10-14; the AI records the acceptance as stand-in for S01. There is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| The Metadata table of BC-001 has no `Language` and `Domain` rows (QC-LANG-001 criterion 1); this predates this change, and no earlier record applies QC-LANG-001 to it. Add the rows or record in an ADR why they are not needed | S01 | Before the next material change to BC-001 |
---
[BC-001]: ../../business-case.md
[QC-BC-001]: ../../../framework/qc/artifacts/qc-business-case.md
[5002450]: https://git.tirsystem.com/TirSystem/github-action/commit/50024505fe788b1c5e3021c0d1fc3d079590070e
+63
View File
@@ -0,0 +1,63 @@
# Review Record: MIL-010 and PP-001 (MIL-010)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-068 |
| CrossReference | [MIL-010], [PP-001], [BC-001], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [5002450] |
---
## Artifact Under Review
- Instance reviewed: [MIL-010]; delta of [PP-001] for the added milestone
- Checklist used: [QC-MIL-001] for the milestone; for the plan, the criteria of `PP.md` (no QC checklist exists for PP-001)
- Scope: full review of MIL-010; delta re-review of PP-001, earlier record RC-064
- Language and domain: n/a (technical type)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | MIL-010 names the reusable workflow `code-metrics.yml`, the three SVG badges on a `badges` branch, the guide, three wiki languages, one adopter and a release. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Nine criteria, each with a checkable Go and No-Go (push and render, ADR, fixture counts, bad report, valid stable SVG, no loop, adopter, no embedded script, release). |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | MIL-003 and MIL-004; in the plan's Dependencies diagram (`MIL-003 + MIL-004 -> MIL-010`). |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O5 of [BC-001], reviewed in RC-067. |
| 5 | Milestone owner and approving reviewer are identified | Pass | Owner S05, approving reviewer S01. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | 2027-01-30 follows MIL-007 (2027-01-16); the Business Case sets no deadline; the user accepted it in chat. |
## Plan delta (PP-001)
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Every milestone has a `MIL-*` document and the plan's dates equal that document's target date | Pass | MIL-001 to MIL-010 exist; the MIL-010 decision date equals its Target Date. |
| 2 | Every Business Case scope item is covered by a gateway | Pass | Scope Coverage names MIL-010 for the new In Scope bullet. |
| 3 | The schedule respects the Business Case constraints | Pass | No deadline in the Business Case; the window follows MIL-007. |
| 4 | Dependencies between milestones are stated | Pass | `MIL-003 + MIL-004 -> MIL-010`. |
| 5 | Every gateway has an owner who is a stakeholder ID | Pass | S05. |
| 6 | Plan content is internally consistent | Pass | "Ten milestones", the assumptions, the Gantt, the schedule and the coverage agree. |
| 7 | Open Issues are current | Pass | A plan risk was added for the push to the `badges` branch and the rendering on the mirror, with the fallback. |
## Overall Verdict
Go - all criteria pass. The user switched to autonomous mode and accepted the plan in chat on 2026-10-14 (Cobertura XML coverage input, target date 2027-01-30, three badges); the AI records the acceptance as stand-in for S01. There is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[MIL-010]: ../../milestones/mil-010-code-metrics-badges.md
[PP-001]: ../../project-plan.md
[BC-001]: ../../business-case.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[5002450]: https://git.tirsystem.com/TirSystem/github-action/commit/50024505fe788b1c5e3021c0d1fc3d079590070e
+56
View File
@@ -0,0 +1,56 @@
# Review Record: UC-008 (Show Code Metrics and Coverage Badges)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-069 |
| CrossReference | [UC-008], [QC-UC-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [9ca9673] |
---
## Artifact Under Review
- Instance reviewed: [UC-008]
- Checklist used: [QC-UC-001]
- Scope: full review (Brief format; MIL-010 task 1)
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Consists of a single, concise paragraph summarizing only the primary success scenario | Pass | One paragraph: push, count, read the report, publish three badges, README shows them. |
| 2 | Written as an informal multi-paragraph narrative; may mention some alternate flows without formal structure | N-A | Format is Brief. |
| 3 | All standard sections are present: actors, preconditions, postconditions, main success scenario, alternative/exception flows | N-A | Format is Brief; actor, stakeholders, pre- and postconditions and the paragraph are present. |
| 4 | Preconditions and postconditions are explicitly defined | Pass | Both are stated; the postcondition says that only the badges change. |
| 5 | Primary actor is explicitly stated | Pass | Software Engineer. |
| 6 | Stakeholders and their interests are stated | Pass | S02 and S05 with an interest each. |
| 7 | Main success scenario is written as clear, numbered steps | N-A | Format is Brief. |
| 8 | Alternative/exception flows correctly reference `<<include>>`/`<<extend>>` use cases where relevant, per UML 2.5.1 | N-A | None in a Brief. |
| 9 | Explicit business rules are captured per step where applicable, rather than embedded loosely in narrative text | N-A | No steps in a Brief. |
| 10 | Naming of actors and use case title is consistent with the corresponding Use Case Diagram and User Stories | Pass | Title and actor equal UCD-001 (RC-071); the Stories line lists US-001.18 to US-001.20, which exist (RC-070). |
| 11 | Scope/level (e.g. summary, user-goal, subfunction) is explicitly stated | Pass | Scope Reusable Workflow Collection, user-goal level. |
| 12 | Use case is written from the actor's goal perspective, free of UI or implementation detail | Pass | Goal wording; no tool, file name or format of a report is named. |
## Overall Verdict
Go - all applicable criteria pass. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[UC-008]: ../../uc-008/uc.md
[QC-UC-001]: ../../../framework/qc/artifacts/qc-use-case.md
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
+51
View File
@@ -0,0 +1,51 @@
# Review Record: US-001 (stories US-001.18 to US-001.20)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-070 |
| CrossReference | [US-001], [QC-US-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [9ca9673] |
---
## Artifact Under Review
- Instance reviewed: [US-001]
- Checklist used: [QC-US-001]
- Scope: delta re-review of the added stories US-001.18 to US-001.20 and the Purpose and Scope and INVEST sections; earlier record RC-057 (US-001.01 to US-001.17 unchanged)
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Follows INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable) | Pass | US-001.18 to US-001.20 are independent of each other, each states one value and has checkable criteria; the INVEST section of US-001 now counts twenty stories. |
| 2 | Written in "As a / I want / So that" form | Pass | All three stories. |
| 3 | Clear, testable acceptance criteria are included | Pass | Each has Given/When/Then criteria with a pass and a fail case (a missing report, no files, unchanged numbers). |
| 4 | Traceable to a use case or epic | Pass | Each traces to [UC-008] and [MIL-010]. |
| 5 | Story is sized to fit within a single iteration | Pass | Each says: fits one iteration. |
| 6 | Story statement avoids technical implementation detail | Pass | The statements name badges, files, lines and coverage; format and branch names are left to the contract. |
| 7 | Role named in the story matches an actor defined in the Use Case Diagram | Pass | Software Engineer, an actor of UCD-001. |
## Overall Verdict
Go - all criteria pass. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[US-001]: ../../user-stories.md
[QC-US-001]: ../../../framework/qc/artifacts/qc-user-story.md
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
@@ -0,0 +1,52 @@
# Review Record: UCD-001 (Show Code Metrics and Coverage Badges)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-071 |
| CrossReference | [UCD-001], [QC-UCD-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [9ca9673] |
---
## Artifact Under Review
- Instance reviewed: [UCD-001]
- Checklist used: [QC-UCD-001]
- Scope: delta re-review of the added use case UC8, the actor and use case tables; earlier record RC-045
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Actors are defined with correct UML stereotypes (e.g. `<<System>>`, `<<Actor>>`) | Pass | Unchanged; no new actor. |
| 2 | System boundary is clearly drawn and labeled | Pass | The new use case is inside the Reusable Workflow Collection rectangle. |
| 3 | Include/extend relationships are used correctly per UML 2.5.1, not as generic "uses" arrows | Pass | The new use case has no include or extend; the existing two are unchanged. |
| 4 | Every actor participates in at least one use case (no orphan actors) | Pass | Software Engineer is linked to UC5, UC7 and UC8. |
| 5 | Diagram is traceable to a documented stakeholder need | Pass | S02 and S05 interests are in UC-008; the actor table lists S02. |
| 6 | Use case names are verb phrases describing actor goals, not internal system operations | Pass | Show Code Metrics and Coverage Badges. |
| 7 | Diagram is free of implementation detail (e.g. UI widgets, database tables) | Pass | None added. |
| 8 | Actor and use case naming is consistent with corresponding Use Case and User Story documents | Pass | Equals the title of UC-008 and the role of US-001.18 to US-001.20. |
## Overall Verdict
Go - all criteria pass. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[UCD-001]: ../../use-case-diagram.md
[QC-UCD-001]: ../../../framework/qc/artifacts/qc-use-case-diagram.md
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
+55
View File
@@ -0,0 +1,55 @@
# Review Record: ADR-0010 (contract of the code metrics and coverage badges workflow)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-072 |
| CrossReference | [ADR-0010], [QC-ADR-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [aa4ca0f] |
---
## Artifact Under Review
- Instance reviewed: [ADR-0010]
- Checklist used: [QC-ADR-001]
- Scope: full review (MIL-010 task 2)
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The ID (`ADR-NNNN`, 4-digit) matches the filename number and is unique and sequential | Pass | ADR-0010 in `adr-0010-code-metrics-badges-contract.md`; the previous ADR is ADR-0009. |
| 2 | Context states the problem, the forces (cost, risk, constraints) and the options evaluated | Pass | Problem, the decisions of the user, facts about the runner and the checkout directory, two counter options and three delivery options. |
| 3 | At least two options were considered, or the absence of alternatives is justified | Pass | Wrap an existing counter or write one; run artifact, default branch or a branch. |
| 4 | Decision is stated in one or two unhedged sentences and matches one of the evaluated options | Pass | A reusable workflow with three script files and a `badges` branch; the rules follow as a list. |
| 5 | Consequences list both Positive and Negative outcomes | Pass | Four positive, five negative. |
| 6 | Quality-attribute impacts (performance, security, portability, etc.) are named where the decision affects them | Pass | Security (a write token, a moving `tools-ref`, branch name validation), compatibility (report formats), maintainability (language table). |
| 7 | Affected Artifacts are listed as links, and each is also in CrossReference | Pass | MIL-010, UC-008, US-001, ADR-0005, ADR-0006 in both. |
| 8 | Status changes are recorded as new Version History rows with a Change summary and Commit link; retained rows are never rewritten | Pass | One row, Accepted, commit `pending` until the commit exists. |
| 9 | A superseded or deprecated ADR names its successor, and the successor links back | N-A | Neither superseded nor deprecated. |
| 10 | Written in business or technical language of the domain, with no unexplained abbreviations | Pass | SVG, XML and NUL are standard; Cobertura is named as a format. |
| 11 | Status is one of `Proposed`, `Accepted`, `Rejected`, `Deprecated` or `Superseded by ADR-NNNN`, and every Version History row uses only these | Pass | Accepted. |
## Overall Verdict
Go - all applicable criteria pass; the decisions of the user of 2026-10-14 are recorded and not reopened. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[ADR-0010]: ../../adr/adr-0010-code-metrics-badges-contract.md
[QC-ADR-001]: ../../../framework/qc/artifacts/qc-adr.md
[aa4ca0f]: https://git.tirsystem.com/TirSystem/github-action/commit/aa4ca0f897b7ea20d90745aa4b7d7a215df123a8
@@ -0,0 +1,55 @@
# Review Record: ADR-0010 (the coverage report as an artifact of the caller)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-073 |
| CrossReference | [ADR-0010], [QC-ADR-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [0dc5132] |
---
## Artifact Under Review
- Instance reviewed: [ADR-0010]
- Checklist used: [QC-ADR-001]
- Scope: delta re-review of the Coverage report and Inputs rules, the Consequences and the Version History after the implementation of MIL-010 task 6 showed that a called workflow cannot see the files of the caller's test job; earlier record RC-072
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The ID (`ADR-NNNN`, 4-digit) matches the filename number and is unique and sequential | Pass | Unchanged. |
| 2 | Context states the problem, the forces (cost, risk, constraints) and the options evaluated | Pass | Unchanged; the new force (a called workflow runs in its own job) is stated in the Decision rule that it explains. |
| 3 | At least two options were considered, or the absence of alternatives is justified | Pass | Unchanged. For the report: an artifact of the caller's run, or a file committed to the repository; both are supported. |
| 4 | Decision is stated in one or two unhedged sentences and matches one of the evaluated options | Pass | The Decision sentence is unchanged; the coverage rule is a refinement of it. |
| 5 | Consequences list both Positive and Negative outcomes | Pass | The negative consequence about the report now names the earlier job, the upload and the dependency on the artifact service, which task 8 verifies. |
| 6 | Quality-attribute impacts (performance, security, portability, etc.) are named where the decision affects them | Pass | The security bullet says the artifact is parsed as XML with entity declarations refused. |
| 7 | Affected Artifacts are listed as links, and each is also in CrossReference | Pass | Unchanged. |
| 8 | Status changes are recorded as new Version History rows with a Change summary and Commit link; retained rows are never rewritten | Pass | A new row; the earlier Accepted row became Deprecated and was not rewritten otherwise. |
| 9 | A superseded or deprecated ADR names its successor, and the successor links back | N-A | The ADR is amended, not superseded. |
| 10 | Written in business or technical language of the domain, with no unexplained abbreviations | Pass | Artifact is the term of the Actions runtime. |
| 11 | Status is one of `Proposed`, `Accepted`, `Rejected`, `Deprecated` or `Superseded by ADR-NNNN`, and every Version History row uses only these | Pass | Deprecated and Accepted. |
## Overall Verdict
Go - all applicable criteria pass; the amendment keeps the decisions of the user of 2026-10-14 and corrects a mechanism that cannot work as first written. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[ADR-0010]: ../../adr/adr-0010-code-metrics-badges-contract.md
[QC-ADR-001]: ../../../framework/qc/artifacts/qc-adr.md
[0dc5132]: https://git.tirsystem.com/TirSystem/github-action/commit/0dc5132a2ea419ba05035ee3594cec63335c240b
@@ -0,0 +1,51 @@
# Review Record: MIL-010 (results of tasks 3, 6 and 8)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-074 |
| CrossReference | [MIL-010], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [5c5a1d1] |
---
## Artifact Under Review
- Instance reviewed: [MIL-010]
- Checklist used: [QC-MIL-001]
- Scope: delta re-review of the Verification results section (tasks 3, 6 and 8) and the Version History; the Go/No-Go criteria, deliverable and tasks are unchanged since RC-068
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | Unchanged; the results show the workflow, the three badges and a use in another repository. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Unchanged. Evidence so far: criterion 1 (task 3: push with the token of the run, SVG served as image on the instance and the mirror), 2 (ADR-0010, RC-072, RC-073), 3 and 4 (offline fixtures and reports), 5 (valid, stable SVG, offline tests), 6 (no run from the badge push, no commit when unchanged in offline tests, `contents: write` only), 7 (throwaway repository: badges, colour change, named failure), 8 (the workflow runs three script files, no embedded script). Criterion 9 (release) follows in task 9. |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | Unchanged: MIL-003 and MIL-004. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O5 and success criterion 5; criterion 5 is met in the throwaway repository and still wants a project repository. |
| 5 | Milestone owner and approving reviewer are identified | Pass | Unchanged: S05 and S01. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Unchanged: 2027-01-30. |
## Overall Verdict
Go - the recorded results support the criteria 1 to 8; criterion 9 is decided after the release (task 9). The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Delete the throwaway repository `TirSystem/code-metrics-adoption` and the branches `verify-badges-delivery` and `badges-verify` of `TirSystem/github-action` (and their copies on the GitHub mirror); the run does not delete repositories or branches | S01 | after the review of the summary |
| Adopt the workflow in a project repository so that success criterion 5 of the Business Case is met by a real project | S01 | next project that has tests |
---
[MIL-010]: ../../milestones/mil-010-code-metrics-badges.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[5c5a1d1]: https://git.tirsystem.com/TirSystem/github-action/commit/5c5a1d19d96a6979b4f6141e736957174ba686a9
@@ -0,0 +1,52 @@
# Review Record: MIL-010 (outcome: release 2.1.0)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-075 |
| CrossReference | [MIL-010], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [aa20e56] |
---
## Artifact Under Review
- Instance reviewed: [MIL-010]
- Checklist used: [QC-MIL-001]
- Scope: delta re-review of the results of task 9 and the closing statement of the milestone; earlier records RC-068 and RC-074
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user accepted the plan in chat on 2026-10-14)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | Delivered: `code-metrics.yml` with its three script files, the guide, the wiki pages in three languages and the release 2.1.0 (tag `v2.1.0`, major tag `v2`, release page). |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | All nine criteria are met: 1 to 8 in the results of RC-074, 9 by the release of 2.1.0 (runs 1462 and 1463, the tag and the release page read back through the API). |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | MIL-003 and MIL-004 were used: the reusable workflow mechanism, `tools-ref` and the release workflow. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O5. Success criterion 5 is met only in a throwaway repository; a project repository still has to adopt it, recorded as an action item. |
| 5 | Milestone owner and approving reviewer are identified | Pass | S05 and S01. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target date 2027-01-30; the work was done on 2026-10-14, ahead of it. |
## Overall Verdict
Go - the milestone is complete: every Go/No-Go criterion is met and the workflow is released as 2.1.0. The AI records the decision as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Adopt `code-metrics.yml` in a project repository, so that success criterion 5 is met by a real project | S01 | next project that has tests |
| Delete the throwaway repository `TirSystem/code-metrics-adoption` and the branches `verify-badges-delivery` and `badges-verify` (and their copies on the GitHub mirror) | S01 | after the review of the summary |
| Find where the required check `TirSystem/github-action: Publish wiki / *` comes from; it blocked the merge of pull request 164 through the API and is not in the branch protection of the repository | S03 | before the next pull request |
---
[MIL-010]: ../../milestones/mil-010-code-metrics-badges.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[aa20e56]: https://git.tirsystem.com/TirSystem/github-action/commit/aa20e56110f4c2fab91a8432ba008ee8300926a2
+67
View File
@@ -0,0 +1,67 @@
# Review Record: MIL-011 and PP-001 (MIL-011)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-076 |
| CrossReference | [MIL-011], [PP-001], [BC-001], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version; accepted by the author in chat as stand-in for S01, after three corrections found in the first read | [3d7a9df] |
---
## Artifact Under Review
- Instance reviewed: [MIL-011]; delta of [PP-001] for the added milestone
- Checklist used: [QC-MIL-001] for the milestone; for the plan, the criteria of `PP.md` (no QC checklist exists for PP-001)
- Scope: full review of MIL-011; delta re-review of PP-001, earlier record [RC-068]
- Language and domain: n/a (technical type)
- Mode: supervised, not independent (the author, Jens Tirsvad Nielsen, asked in chat on 2026-10-14 for the review and the acceptance and stands in for S01; the AI prepared the evidence)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | `## Deliverable` names the patch release 2.1.1: the defaults, the test, the guides, README and three wiki languages at `@v2`, the changelog entry, and the framework `Badges` page without the workaround. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Eight criteria, each with a checkable Go and No-Go: reproduction, a list per workflow, a test that fails on a seeded default, a search that finds no `@v1`, a run on the instance, the release level and tags, the framework page, the review record. |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | [MIL-010] (the workflow and its guide) and [ADR-0006] (the release process); in the plan's dependency diagram (`MIL-010 -> MIL-011`). |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O5 of [BC-001]; the first read found its wording paraphrased wrongly, now quoted from the Business Case. |
| 5 | Milestone owner and approving reviewer are identified | Pass | Owner S05, approving reviewer S01; both are in [SA-001]. |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | 2026-10-23; the Business Case sets no deadline. The date precedes the planned decision date of [MIL-010] (2027-01-30) because that milestone was released on 2026-10-14; the milestone says so and does not change the MIL-010 row. |
## Plan delta (PP-001)
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Every milestone has a `MIL-*` document and the plan's dates equal that document's target date | Pass | MIL-001 to MIL-011 exist; the MIL-011 decision date (2026-10-23) equals its Target Date. |
| 2 | Every Business Case scope item is covered by a gateway | Pass | The first read found a scope row that is not a Business Case item; it is removed and MIL-011 is listed beside MIL-010 for the badges item. |
| 3 | The schedule respects the Business Case constraints | Pass | No deadline in the Business Case; the window is one week. |
| 4 | Dependencies between milestones are stated | Pass | `MIL-003 + MIL-004 -> MIL-010 -> MIL-011`. |
| 5 | Every gateway has an owner who is a stakeholder ID | Pass | S05. |
| 6 | Plan content is internally consistent | Pass | The first read found "ten milestones" in the Purpose; it is now "eleven", and the Gantt, the schedule and the dependencies agree. |
| 7 | Open Issues are current | Pass | No plan risk was added for a default that names an old major; the release process and the test of task 3 carry the rule. Observation, not a failure. |
## Overall Verdict
Go - all criteria pass after three corrections found in the first read (the O5 wording, "ten milestones", and a scope row that was not a Business Case item). The author confirmed the acceptance in chat on 2026-10-14 as stand-in for S01; this is not an independent review.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Confirm this record by S01 when an independent reading is possible | S01 | 2026-10-30 |
| Task 1: reproduce the failure and list the defaults before any change to the workflows | S05 | 2026-10-16 |
---
[MIL-011]: ../../milestones/mil-011-code-metrics-default-tools-ref.md
[PP-001]: ../../project-plan.md
[BC-001]: ../../business-case.md
[SA-001]: ../../stakeholder-analysis.md
[ADR-0006]: ../../adr/adr-0006-release-process-and-version-pinning.md
[RC-068]: ./rc-068-mil-010-plan.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[3d7a9df]: https://git.tirsystem.com/TirSystem/github-action/commit/3d7a9df3a3a4712dcc5214a71b0569d90122bf4e
@@ -0,0 +1,50 @@
# Review Record: MIL-011 task 1 results (delta)
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-077 |
| CrossReference | [MIL-011], [RC-076], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; accepted | [eaa0e30] |
---
## Artifact Under Review
- Instance reviewed: [MIL-011], the Version History row and the section "Verification results" added in project pull request 177 (the results of task 1)
- Checklist used: [QC-MIL-001] (criteria 1, 2 and 4 re-scored; 3, 5 and 6 not affected)
- Scope: delta re-review, reason: the milestone changed in content after [RC-076]
- Language and domain: n/a (technical type)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the user chose autonomous mode in chat on 2026-10-14 and the accepted plan is [MIL-011])
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | `## Deliverable` is unchanged and task 1 has its record: the results name the run (1499, job 1638), the commits and the five workflows. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Criterion 1 ("reproduced and recorded") and criterion 2 ("all five checked and listed") are met by the section; the evidence was read from the run's log (`bash: shared-scripts/tools/code-metrics.sh: No such file or directory`, exit code 127) and from `git cat-file` per tag. |
| 3 | Dependencies on other milestones are explicitly mapped | N-A | Not affected. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | Unchanged (O5). |
| 5 | Milestone owner and approving reviewer are identified | N-A | Not affected. |
| 6 | Milestone has a defined target date consistent with project constraints | N-A | Not affected (2026-10-23). |
## Overall Verdict
Go - the results are true to the evidence: the failure at `@v2` is in the log of job 1638, and the absence of a run at `@v1` was observed on two pushes (`5654905`, `46e752d`) against a run for the `@v2` call alone (`9a17868`). The finding that the other four workflows resolve but follow the older major is stated as a question for task 2, not as a defect. The AI accepts the row as stand-in for S01; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | - | - |
---
[MIL-011]: ../../milestones/mil-011-code-metrics-default-tools-ref.md
[RC-076]: ./rc-076-mil-011-plan.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[eaa0e30]: https://git.tirsystem.com/TirSystem/github-action/commit/eaa0e30beaa097dfeb1c07c814a71d02a6987060
+56
View File
@@ -0,0 +1,56 @@
# Review Record: MIL-011 fix of the tools-ref defaults
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-078 |
| CrossReference | [MIL-011], [RC-077] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version: Go for tasks 2 to 5, criteria 6 to 8 open until the release | [a6892c3] |
---
## Artifact Under Review
- Instance reviewed: the deliverables of tasks 2 to 5 of [MIL-011], branch `mil-011-fix` at `eaa0e30` (the five workflows, `MAJOR_TAG`, `tests/test_tools_ref.py` and the three changed tests, the guides, README and wiki pages in three languages, the amended ADR-0005, ADR-0008, ADR-0009 and ADR-0010, the changelog)
- Checklist used: the eight Go/No-Go criteria of [MIL-011]; for the workflow files and the tests, the review is the pass of the repository's own test suite and the validation workflow
- Scope: full review of the deliverables before the release (task 6); the milestone itself was reviewed in [RC-076] and [RC-077]
- Language and domain: n/a (technical deliverables)
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
## Checklist Results
Go/No-Go criteria of [MIL-011]:
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The defect is reproduced before the fix | Pass | Run 1499 (job 1638): `bash: shared-scripts/tools/code-metrics.sh: No such file or directory`, exit code 127; a call at `@v1` creates no run. Recorded in [MIL-011], "Verification results". |
| 2 | Every default `tools-ref` names a tag that holds the script | Pass | Listed per workflow in [MIL-011]. After the fix all five name `v2` (`MAJOR_TAG`), and the script of each is in `v2`; `test_default_tools_ref_is_the_current_major_and_holds_the_script` checks the tag with `git cat-file`. |
| 3 | The default is derived and a test fails on a seeded wrong default | Pass | `MAJOR_TAG` is the one definition, and a test ties it to the highest major of the changelog. With `default: "v1"` seeded in `code-metrics.yml` three tests failed ("default tools-ref is 'v1', the current major is 'v2'"); restored, 13 passed. The full suite passes: 540 tests. |
| 4 | No guide, comment, README or wiki page tells a caller to use `@v1` for `code-metrics.yml` | Pass | `grep -rn 'code-metrics.yml@v1' guides README.md docs/wiki .gitea` finds 0; no `default: "v1"` is left in `.gitea/workflows`. The accepted ADRs keep their original text and have an amendment; the body of ADR-0010 still reads "default `v1`" above the amendment, which is how amendments are read. |
| 5 | A call with the documented defaults runs on the instance and commits the badges | Pass | Run 1509 (job 1649) of the throwaway branch `verify-code-metrics-defaults`: the workflow at `@mil-011-fix`, `tools-ref` resolved to `v2` (scripts fetched at `16faffa`), "Validate", "Count" and "Publish the badges" succeeded, branch `badges-verify` has the commit `041d991` "Update code metrics badges [skip ci]", and the raw SVG answers `200 image/svg+xml`. Only `badges-branch` was set, to keep the verification away from `badges`. |
| 6 | The release is a patch (2.1.1); `v2` moves to it, `v1` is untouched | Open | Not released: task 6. Re-scored in the record after the release. |
| 7 | The framework `Badges` page no longer tells a caller to set `tools-ref` | Open | Task 7, after the release. |
| 8 | Reviewed | Open | This record covers criteria 1 to 5; the record after the release closes 6 to 8. |
## Overall Verdict
Go for the deliverables of tasks 2 to 5: criteria 1 to 5 pass on the evidence above. Criteria 6 to 8 are open only because the steps that satisfy them (the release and the framework page) come after this review; nothing in the deliverables is missing. The AI accepts the record as stand-in for S01 in autonomous mode; there is no independent reader and the decision stays open to challenge in the run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| Release 2.1.1 and re-score criteria 6 and 8 | S05 | 2026-10-23 |
| Remove the `tools-ref` workaround from the framework `Badges` page and re-score criterion 7 | S05 | 2026-10-23 |
| Delete the throwaway branch `verify-code-metrics-defaults` after the results are merged | S05 | 2026-10-23 |
---
[MIL-011]: ../../milestones/mil-011-code-metrics-default-tools-ref.md
[RC-076]: ./rc-076-mil-011-plan.md
[RC-077]: ./rc-077-mil-011-task-1-results.md
[a6892c3]: https://git.tirsystem.com/TirSystem/github-action/commit/a6892c372aca9f2e12826a4c3b260290a0656ecb
+57 -13
View File
@@ -4,13 +4,13 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | TM-001 | | ID | TM-001 |
| CrossReference | [BC-001], [SA-001], [PP-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007], [MIL-008], [RC-001], [RC-002], [RC-003], [RC-004], [RC-005], [RC-006], [RC-007], [RC-008], [RC-009], [RC-010], [RC-011], [RC-012], [RC-013], [RC-014], [RC-015], [RC-016], [RC-017], [RC-018], [RC-019], [RC-020], [RC-021], [RC-022], [RC-023], [RC-024], [RC-025], [RC-026], [RC-027], [RC-028], [RC-029], [RC-030], [RC-031], [RC-032], [RC-033], [RC-034], [RC-035], [RC-036], [RC-037], [RC-038], [RC-039], [RC-040], [RC-041], [RC-042], [RC-043], [RC-044], [RC-045], [RC-046], [RC-047], [RC-048], [RC-049], [RC-050], [RC-051], [RC-052], [RC-053], [RC-054], [RC-055], [RC-056], [RC-057], [RC-058], [RC-059], [RC-060], [ADR-0007], [ADR-0008], [UC-007], [UC-006], [ADR-0006], [UC-005], [ADR-0005], [UCD-001], [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [ADR-0001], [ADR-0002], [ADR-0003], [ADR-0004] | | CrossReference | [BC-001], [SA-001], [PP-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007], [MIL-008], [MIL-009], [MIL-010], [MIL-011], [UC-008], [RC-001], [RC-002], [RC-003], [RC-004], [RC-005], [RC-006], [RC-007], [RC-008], [RC-009], [RC-010], [RC-011], [RC-012], [RC-013], [RC-014], [RC-015], [RC-016], [RC-017], [RC-018], [RC-019], [RC-020], [RC-021], [RC-022], [RC-023], [RC-024], [RC-025], [RC-026], [RC-027], [RC-028], [RC-029], [RC-030], [RC-031], [RC-032], [RC-033], [RC-034], [RC-035], [RC-036], [RC-037], [RC-038], [RC-039], [RC-040], [RC-041], [RC-042], [RC-043], [RC-044], [RC-045], [RC-046], [RC-047], [RC-048], [RC-049], [RC-050], [RC-051], [RC-052], [RC-053], [RC-054], [RC-055], [RC-056], [RC-057], [RC-058], [RC-059], [RC-060], [RC-061], [RC-062], [RC-063], [RC-064], [RC-065], [RC-066], [RC-067], [RC-068], [RC-069], [RC-070], [RC-071], [RC-072], [RC-073], [RC-074], [RC-075], [ADR-0007], [ADR-0008], [ADR-0009], [ADR-0010], [UC-007], [UC-006], [ADR-0006], [UC-005], [ADR-0005], [UCD-001], [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [ADR-0001], [ADR-0002], [ADR-0003], [ADR-0004] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-059 (MIL-007 task 7 results) | [2481c26] | | 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Added MIL-011 and RC-076 (fix the defaults of the code metrics workflow) | [3d7a9df] |
| 2026-10-13 | Proposed | Jens Tirsvad Nielsen | S01 | Added MIL-008, RC-060 and RC-061 | [01b9c29] | | 2026-10-14 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-077 and RC-078 (MIL-011 task 1 results, and the fix of the defaults) | [a6892c3] |
--- ---
@@ -25,12 +25,13 @@ updated whenever an artifact instance is created or reviewed.
| Artifact Instance | Type | Upstream (Backward Link) | Downstream (Forward Link) | Last Reviewed (RC-ID) | | Artifact Instance | Type | Upstream (Backward Link) | Downstream (Forward Link) | Last Reviewed (RC-ID) |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| [SA-001] | SA | - | [BC-001], [UCD-001] | [RC-004] | | [SA-001] | SA | - | [BC-001], [UCD-001] | [RC-004] |
| [BC-001] | BC | [SA-001] | [PP-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006] | [RC-001], [RC-008] | | [BC-001] | BC | [SA-001] | [PP-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006] | [RC-001], [RC-008], [RC-067] |
| [PP-001] | PP | [BC-001], [SA-001] | [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007], [US-001] | [RC-002], [RC-009], [RC-015], [RC-017], [RC-025], [RC-032], [RC-053] | | [PP-001] | PP | [BC-001], [SA-001] | [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-005], [MIL-006], [MIL-007], [MIL-008], [MIL-009], [MIL-010], [US-001] | [RC-002], [RC-009], [RC-015], [RC-017], [RC-025], [RC-032], [RC-053], [RC-062], [RC-064], [RC-068] |
| [MIL-001] | MIL | [BC-001], [PP-001] | [MIL-002] | [RC-003], [RC-026] | | [MIL-001] | MIL | [BC-001], [PP-001] | [MIL-002] | [RC-003], [RC-026] |
| [MIL-002] | MIL | [BC-001], [PP-001], [MIL-001] | [MIL-003], [MIL-005] | [RC-005], [RC-027] | | [MIL-002] | MIL | [BC-001], [PP-001], [MIL-001] | [MIL-003], [MIL-005] | [RC-005], [RC-027] |
| [MIL-003] | MIL | [BC-001], [PP-001], [MIL-002] | [MIL-004] | [RC-006], [RC-028], [RC-033], [RC-039] | | [MIL-003] | MIL | [BC-001], [PP-001], [MIL-002] | [MIL-004] | [RC-006], [RC-028], [RC-033], [RC-039] |
| [MIL-004] | MIL | [BC-001], [PP-001], [MIL-003] | - | [RC-007], [RC-029], [RC-034], [RC-048] | | [MIL-004] | MIL | [BC-001], [PP-001], [MIL-003] | - | [RC-007], [RC-029], [RC-034], [RC-048] |
| [ADR-0010] | ADR | [MIL-010], [UC-008], [US-001], [ADR-0005], [ADR-0006] | - | [RC-072], [RC-073] |
| [RC-001] | RC | [BC-001] | - | - | | [RC-001] | RC | [BC-001] | - | - |
| [RC-002] | RC | [PP-001] | - | - | | [RC-002] | RC | [PP-001] | - | - |
| [RC-003] | RC | [MIL-001] | - | - | | [RC-003] | RC | [MIL-001] | - | - |
@@ -40,7 +41,10 @@ updated whenever an artifact instance is created or reviewed.
| [MIL-005] | MIL | [BC-001], [PP-001], [MIL-002] | [MIL-006] | [RC-010], [RC-011], [RC-030], [RC-050] | | [MIL-005] | MIL | [BC-001], [PP-001], [MIL-002] | [MIL-006] | [RC-010], [RC-011], [RC-030], [RC-050] |
| [MIL-006] | MIL | [BC-001], [PP-001], [MIL-002], [MIL-005] | - | [RC-016], [RC-031], [RC-049], [RC-058] | | [MIL-006] | MIL | [BC-001], [PP-001], [MIL-002], [MIL-005] | - | [RC-016], [RC-031], [RC-049], [RC-058] |
| [MIL-007] | MIL | [BC-001], [PP-001], [MIL-003], [MIL-004], [ADR-0008] | - | [RC-052], [RC-055], [RC-059] | | [MIL-007] | MIL | [BC-001], [PP-001], [MIL-003], [MIL-004], [ADR-0008] | - | [RC-052], [RC-055], [RC-059] |
| [MIL-008] | MIL | [BC-001], [MIL-006], [ADR-0004] | - | [RC-060], [RC-061] | | [MIL-008] | MIL | [BC-001], [PP-001], [MIL-006], [ADR-0004] | [MIL-009] | [RC-060], [RC-061] |
| [MIL-009] | MIL | [BC-001], [PP-001], [MIL-008], [ADR-0004], [ADR-0006], [ADR-0009] | - | [RC-064], [RC-066] |
| [MIL-010] | MIL | [BC-001], [PP-001], [MIL-003], [MIL-004] | [MIL-011] | [RC-068], [RC-074], [RC-075] |
| [MIL-011] | MIL | [BC-001], [PP-001], [MIL-010], [ADR-0006], [ADR-0010] | - | [RC-076], [RC-077], [RC-078] |
| [RC-007] | RC | [MIL-004] | - | - | | [RC-007] | RC | [MIL-004] | - | - |
| [RC-008] | RC | [BC-001] | - | - | | [RC-008] | RC | [BC-001] | - | - |
| [RC-009] | RC | [PP-001] | - | - | | [RC-009] | RC | [PP-001] | - | - |
@@ -48,7 +52,7 @@ updated whenever an artifact instance is created or reviewed.
| [ADR-0001] | ADR | [BC-001], [MIL-005] | [ADR-0003] | [RC-012] | | [ADR-0001] | ADR | [BC-001], [MIL-005] | [ADR-0003] | [RC-012] |
| [ADR-0002] | ADR | [SA-001], [RC-001] | - | [RC-013] | | [ADR-0002] | ADR | [SA-001], [RC-001] | - | [RC-013] |
| [ADR-0003] | ADR | [MIL-005], [ADR-0001], [RC-011] | [ADR-0004] | [RC-014] | | [ADR-0003] | ADR | [MIL-005], [ADR-0001], [RC-011] | [ADR-0004] | [RC-014] |
| [ADR-0004] | ADR | [MIL-006], [ADR-0003], [ADR-0002] | - | [RC-018] | | [ADR-0004] | ADR | [MIL-006], [ADR-0003], [ADR-0002] | [ADR-0009] | [RC-018], [RC-065] |
| [RC-011] | RC | [MIL-005] | - | - | | [RC-011] | RC | [MIL-005] | - | - |
| [RC-012] | RC | [ADR-0001] | - | - | | [RC-012] | RC | [ADR-0001] | - | - |
| [RC-013] | RC | [ADR-0002] | - | - | | [RC-013] | RC | [ADR-0002] | - | - |
@@ -57,8 +61,8 @@ updated whenever an artifact instance is created or reviewed.
| [RC-016] | RC | [MIL-006] | - | - | | [RC-016] | RC | [MIL-006] | - | - |
| [RC-017] | RC | [PP-001] | - | - | | [RC-017] | RC | [PP-001] | - | - |
| [RC-018] | RC | [ADR-0004] | - | - | | [RC-018] | RC | [ADR-0004] | - | - |
| [UCD-001] | UCD | [SA-001], [BC-001] | [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007] | [RC-019], [RC-035], [RC-040], [RC-045] | | [UCD-001] | UCD | [SA-001], [BC-001] | [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007], [UC-008] | [RC-019], [RC-035], [RC-040], [RC-045], [RC-071] |
| [US-001] | US | [UCD-001], [BC-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-007] | [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007] | [RC-020], [RC-036], [RC-041], [RC-046], [RC-057] | | [US-001] | US | [UCD-001], [BC-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [MIL-007] | [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007], [UC-008] | [RC-020], [RC-036], [RC-041], [RC-046], [RC-057], [RC-070] |
| [UC-001] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-021] | | [UC-001] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-021] |
| [UC-002] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-022] | | [UC-002] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-022] |
| [UC-003] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-023] | | [UC-003] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-023] |
@@ -69,7 +73,9 @@ updated whenever an artifact instance is created or reviewed.
| [ADR-0006] | ADR | [MIL-004], [UC-006], [US-001], [ADR-0004], [ADR-0005] | - | [RC-043] | | [ADR-0006] | ADR | [MIL-004], [UC-006], [US-001], [ADR-0004], [ADR-0005] | - | [RC-043] |
| [ADR-0007] | ADR | [MIL-004], [UC-006], [ADR-0006] | - | [RC-047] | | [ADR-0007] | ADR | [MIL-004], [UC-006], [ADR-0006] | - | [RC-047] |
| [ADR-0008] | ADR | [MIL-007], [UC-005], [US-001], [ADR-0005], [ADR-0006] | - | [RC-054] | | [ADR-0008] | ADR | [MIL-007], [UC-005], [US-001], [ADR-0005], [ADR-0006] | - | [RC-054] |
| [ADR-0009] | ADR | [MIL-008], [ADR-0003], [ADR-0004], [ADR-0005], [ADR-0006] | - | [RC-063] |
| [UC-007] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-044] | | [UC-007] | UC | [UCD-001], [US-001], [SA-001] | - | [RC-044] |
| [UC-008] | UC | [UCD-001], [US-001], [SA-001], [MIL-010] | - | [RC-069] |
| [RC-019] | RC | [UCD-001] | - | - | | [RC-019] | RC | [UCD-001] | - | - |
| [RC-020] | RC | [US-001] | - | - | | [RC-020] | RC | [US-001] | - | - |
| [RC-021] | RC | [UC-001] | - | - | | [RC-021] | RC | [UC-001] | - | - |
@@ -113,6 +119,23 @@ updated whenever an artifact instance is created or reviewed.
| [RC-059] | RC | [MIL-007] | - | - | | [RC-059] | RC | [MIL-007] | - | - |
| [RC-060] | RC | [MIL-008] | - | - | | [RC-060] | RC | [MIL-008] | - | - |
| [RC-061] | RC | [MIL-008] | - | - | | [RC-061] | RC | [MIL-008] | - | - |
| [RC-062] | RC | [PP-001] | - | - |
| [RC-063] | RC | [ADR-0009] | - | - |
| [RC-064] | RC | [MIL-009], [PP-001] | - | - |
| [RC-065] | RC | [ADR-0004] | - | - |
| [RC-066] | RC | [MIL-009] | - | - |
| [RC-067] | RC | [BC-001] | - | - |
| [RC-068] | RC | [MIL-010], [PP-001] | - | - |
| [RC-069] | RC | [UC-008] | - | - |
| [RC-070] | RC | [US-001] | - | - |
| [RC-071] | RC | [UCD-001] | - | - |
| [RC-072] | RC | [ADR-0010] | - | - |
| [RC-073] | RC | [ADR-0010] | - | - |
| [RC-074] | RC | [MIL-010] | - | - |
| [RC-075] | RC | [MIL-010] | - | - |
| [RC-076] | RC | [MIL-011], [PP-001] | - | - |
| [RC-077] | RC | [MIL-011] | - | - |
| [RC-078] | RC | [MIL-011] | - | - |
## Coverage Notes ## Coverage Notes
@@ -134,6 +157,10 @@ updated whenever an artifact instance is created or reviewed.
[MIL-006]: ../milestones/mil-006-shared-wiki-publishing.md [MIL-006]: ../milestones/mil-006-shared-wiki-publishing.md
[MIL-007]: ../milestones/mil-007-cpp-csharp-quality-checks.md [MIL-007]: ../milestones/mil-007-cpp-csharp-quality-checks.md
[MIL-008]: ../milestones/mil-008-wiki-reusable-workflow.md [MIL-008]: ../milestones/mil-008-wiki-reusable-workflow.md
[MIL-010]: ../milestones/mil-010-code-metrics-badges.md
[MIL-011]: ../milestones/mil-011-code-metrics-default-tools-ref.md
[MIL-009]: ../milestones/mil-009-migrate-wiki-callers-and-remove-scoped-workflow.md
[ADR-0010]: ../adr/adr-0010-code-metrics-badges-contract.md
[RC-001]: ./reviews/rc-001-business-case.md [RC-001]: ./reviews/rc-001-business-case.md
[RC-002]: ./reviews/rc-002-project-plan.md [RC-002]: ./reviews/rc-002-project-plan.md
[RC-003]: ./reviews/rc-003-mil-001.md [RC-003]: ./reviews/rc-003-mil-001.md
@@ -205,14 +232,31 @@ updated whenever an artifact instance is created or reviewed.
[RC-059]: ./reviews/rc-059-mil-007-adoption.md [RC-059]: ./reviews/rc-059-mil-007-adoption.md
[RC-060]: ./reviews/rc-060-mil-008-plan.md [RC-060]: ./reviews/rc-060-mil-008-plan.md
[RC-061]: ./reviews/rc-061-mil-008-task-5-deferred.md [RC-061]: ./reviews/rc-061-mil-008-task-5-deferred.md
[RC-062]: ./reviews/rc-062-pp-001-mil-008.md
[RC-063]: ./reviews/rc-063-adr-0009.md
[RC-064]: ./reviews/rc-064-mil-009-plan.md
[RC-065]: ./reviews/rc-065-adr-0004-superseded.md
[RC-066]: ./reviews/rc-066-mil-009-outcome.md
[RC-067]: ./reviews/rc-067-bc-001-o5.md
[RC-068]: ./reviews/rc-068-mil-010-plan.md
[RC-069]: ./reviews/rc-069-uc-008.md
[RC-070]: ./reviews/rc-070-us-001-metrics.md
[RC-071]: ./reviews/rc-071-ucd-001-metrics.md
[RC-072]: ./reviews/rc-072-adr-0010.md
[RC-073]: ./reviews/rc-073-adr-0010-artifact.md
[RC-074]: ./reviews/rc-074-mil-010-results.md
[RC-075]: ./reviews/rc-075-mil-010-outcome.md
[RC-076]: ./reviews/rc-076-mil-011-plan.md
[RC-077]: ./reviews/rc-077-mil-011-task-1-results.md
[RC-078]: ./reviews/rc-078-mil-011-fix.md
[ADR-0008]: ../adr/adr-0008-cpp-csharp-quality-check-contract.md [ADR-0008]: ../adr/adr-0008-cpp-csharp-quality-check-contract.md
[ADR-0009]: ../adr/adr-0009-wiki-publishing-reusable-workflow.md
[ADR-0007]: ../adr/adr-0007-release-publish-destination.md [ADR-0007]: ../adr/adr-0007-release-publish-destination.md
[UC-007]: ../uc-007/uc.md [UC-007]: ../uc-007/uc.md
[UC-008]: ../uc-008/uc.md
[UC-006]: ../uc-006/uc.md [UC-006]: ../uc-006/uc.md
[ADR-0006]: ../adr/adr-0006-release-process-and-version-pinning.md [ADR-0006]: ../adr/adr-0006-release-process-and-version-pinning.md
[UC-005]: ../uc-005/uc.md [UC-005]: ../uc-005/uc.md
[ADR-0005]: ../adr/adr-0005-quality-check-contract.md [ADR-0005]: ../adr/adr-0005-quality-check-contract.md
[faf13b2]: https://git.tirsystem.com/TirSystem/github-action/commit/faf13b2c2a4901c0171977de1ffc2841023f537a [3d7a9df]: https://git.tirsystem.com/TirSystem/github-action/commit/3d7a9df3a3a4712dcc5214a71b0569d90122bf4e
[1bc56f8]: https://git.tirsystem.com/TirSystem/github-action/commit/1bc56f8b771531f221f218fc00b147ecc73c051e [a6892c3]: https://git.tirsystem.com/TirSystem/github-action/commit/a6892c372aca9f2e12826a4c3b260290a0656ecb
[2481c26]: https://git.tirsystem.com/TirSystem/github-action/commit/2481c26d802464decd51d75539157093b60e08e8
[01b9c29]: https://git.tirsystem.com/TirSystem/github-action/commit/01b9c2972b4317bcc590540010aea0eaf7f30014
+44
View File
@@ -0,0 +1,44 @@
# UC-008: Show Code Metrics and Coverage Badges
## Metadata
| Key | Value |
| --- | --- |
| ID | UC-008 |
| CrossReference | [UCD-001], [US-001], [SA-001], [MIL-010] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version; reviewed (RC-069) | [9ca9673] |
---
**Format:** Brief
**Title:** Show Code Metrics and Coverage Badges
**Scope:** Reusable Workflow Collection
**Level:** user-goal
**Primary Actor:** Software Engineer
**Stakeholders:** S02, S05 (interests below)
**Stories:** US-001.18, US-001.19, US-001.20
## Brief
A Software Engineer pushes a change to a repository that calls the shared code-metrics workflow. The workflow counts the code files and the lines of code (without comment and blank lines), reads the coverage report the repository supplies, and publishes three badges: the number of code files, the number of lines of code and the coverage. The repository's README shows the badges, and they show the numbers of the latest push.
**Stakeholder interests**
- S02 — the size and the coverage of the code are visible at a glance, without a service outside the instance, and a wrong or missing report is reported instead of shown as a number
- S05 — the counting rules and the badge contract are defined once and change through a reviewed release
**Preconditions:** The repository is onboarded and the shared workflow is available through reusable workflow delivery; a coverage badge needs a coverage report that the repository's own tests have produced.
**Postconditions (success guarantee):** The three badges show the numbers of the pushed revision, nothing but the badges is changed in the repository, and a run whose numbers are unchanged changes nothing.
---
[UCD-001]: ../use-case-diagram.md
[US-001]: ../user-stories.md
[SA-001]: ../stakeholder-analysis.md
[MIL-010]: ../milestones/mil-010-code-metrics-badges.md
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
+9 -5
View File
@@ -4,13 +4,13 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | UCD-001 | | ID | UCD-001 |
| CrossReference | [SA-001], [BC-001], [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007] | | CrossReference | [SA-001], [BC-001], [US-001], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007], [UC-008] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Added the use case Release a Reusable Workflow (UC-006) | [044d8ba] | | 2026-10-10 | Deprecated | Jens Tirsvad Nielsen | S01 | Added the use case Consume a Workflow Update (UC-007) (RC-045) | [4cf52af] |
| 2026-10-10 | Accepted | Jens Tirsvad Nielsen | S01 | Added the use case Consume a Workflow Update (UC-007) (RC-045) | [4cf52af] | | 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Added the use case Show Code Metrics and Coverage Badges (UC-008); reviewed (RC-071) | [9ca9673] |
--- ---
@@ -46,6 +46,7 @@ rectangle "Reusable Workflow Collection" <<System>> {
usecase "Run Project Quality Checks" as UC5 usecase "Run Project Quality Checks" as UC5
usecase "Release a Reusable Workflow" as UC6 usecase "Release a Reusable Workflow" as UC6
usecase "Consume a Workflow Update" as UC7 usecase "Consume a Workflow Update" as UC7
usecase "Show Code Metrics and Coverage Badges" as UC8
} }
DevOps --> UC1 DevOps --> UC1
@@ -57,6 +58,7 @@ Operator --> UC2
Operator --> UC4 Operator --> UC4
Engineer --> UC5 Engineer --> UC5
Engineer --> UC7 Engineer --> UC7
Engineer --> UC8
UC1 --> Gitea UC1 --> Gitea
UC1 --> GitHub UC1 --> GitHub
UC3 ..> UC2 : <<include>> UC3 ..> UC2 : <<include>>
@@ -70,7 +72,7 @@ UC4 ..> UC1 : <<extend>>
| --- | --- | --- | --- | | --- | --- | --- | --- |
| DevOps Professional | `<<Actor>>` | S05 | Synchronize Repository Metadata, Configure Workflow Credentials, Onboard a Repository, Diagnose a Failed Workflow, Release a Reusable Workflow | | DevOps Professional | `<<Actor>>` | S05 | Synchronize Repository Metadata, Configure Workflow Credentials, Onboard a Repository, Diagnose a Failed Workflow, Release a Reusable Workflow |
| Platform Operator | `<<Actor>>` | S03 | Configure Workflow Credentials, Diagnose a Failed Workflow | | Platform Operator | `<<Actor>>` | S03 | Configure Workflow Credentials, Diagnose a Failed Workflow |
| Software Engineer | `<<Actor>>` | S02 | Run Project Quality Checks, Consume a Workflow Update | | Software Engineer | `<<Actor>>` | S02 | Run Project Quality Checks, Consume a Workflow Update, Show Code Metrics and Coverage Badges |
| Gitea Instance | `<<System>>` | - | Synchronize Repository Metadata (source of description and topics) | | Gitea Instance | `<<System>>` | - | Synchronize Repository Metadata (source of description and topics) |
| GitHub | `<<System>>` | S04 (audience of the mirror) | Synchronize Repository Metadata (target) | | GitHub | `<<System>>` | S04 (audience of the mirror) | Synchronize Repository Metadata (target) |
@@ -85,6 +87,7 @@ UC4 ..> UC1 : <<extend>>
| Run Project Quality Checks | Software Engineer | Lint, format and type checks run on every change and report a pass or a fail | | Run Project Quality Checks | Software Engineer | Lint, format and type checks run on every change and report a pass or a fail |
| Release a Reusable Workflow | DevOps Professional | A validated, versioned update that consumers can pin | | Release a Reusable Workflow | DevOps Professional | A validated, versioned update that consumers can pin |
| Consume a Workflow Update | Software Engineer | A new version is adopted safely, one repository first | | Consume a Workflow Update | Software Engineer | A new version is adopted safely, one repository first |
| Show Code Metrics and Coverage Badges | Software Engineer | The size and the coverage of the code are visible as badges that follow every push |
## Relationships ## Relationships
@@ -104,6 +107,7 @@ UC4 ..> UC1 : <<extend>>
[UC-004]: ./uc-004/uc.md [UC-004]: ./uc-004/uc.md
[UC-005]: ./uc-005/uc.md [UC-005]: ./uc-005/uc.md
[UC-006]: ./uc-006/uc.md [UC-006]: ./uc-006/uc.md
[044d8ba]: https://git.tirsystem.com/TirSystem/github-action/commit/044d8ba21f96f4aceb807d62addc35cdcbb56051
[UC-007]: ./uc-007/uc.md [UC-007]: ./uc-007/uc.md
[UC-008]: ./uc-008/uc.md
[4cf52af]: https://git.tirsystem.com/TirSystem/github-action/commit/4cf52afe00f546c6b20424fb8dfc12796ffd9296 [4cf52af]: https://git.tirsystem.com/TirSystem/github-action/commit/4cf52afe00f546c6b20424fb8dfc12796ffd9296
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
+50 -6
View File
@@ -4,13 +4,13 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | US-001 | | ID | US-001 |
| CrossReference | [UCD-001], [BC-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007], [MIL-007] | | CrossReference | [UCD-001], [BC-001], [MIL-001], [MIL-002], [MIL-003], [MIL-004], [UC-001], [UC-002], [UC-003], [UC-004], [UC-005], [UC-006], [UC-007], [MIL-007], [UC-008], [MIL-010] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-11 | Deprecated | Jens Tirsvad Nielsen | S01 | Added US-001.16 and US-001.17 (C++ and C# checks, MIL-007 task 1) | [32b5ab6] | | 2026-10-11 | Deprecated | Jens Tirsvad Nielsen | S01 | US-001.16 and US-001.17 reviewed (RC-057) and accepted; the Purpose and Scope names the later stories | [1bc56f8] |
| 2026-10-11 | Accepted | Jens Tirsvad Nielsen | S01 | US-001.16 and US-001.17 reviewed (RC-057) and accepted; the Purpose and Scope names the later stories | [1bc56f8] | | 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Added US-001.18 to US-001.20 (code metrics and coverage badges, MIL-010 task 1); reviewed (RC-070) | [9ca9673] |
--- ---
@@ -21,7 +21,8 @@ These stories cover the P1 use cases of the Project Plan that MIL-002 delivers
credentials, onboarding a repository and diagnosing a failed run. Roles are the credentials, onboarding a repository and diagnosing a failed run. Roles are the
actors of [UCD-001]. Later stories cover quality checks (US-001.09, US-001.10 and, for actors of [UCD-001]. Later stories cover quality checks (US-001.09, US-001.10 and, for
C++ and C#, US-001.16 and US-001.17), releases and updates (US-001.11 to C++ and C#, US-001.16 and US-001.17), releases and updates (US-001.11 to
US-001.15). Stories for the wiki (MIL-005, MIL-006) are not written yet. US-001.15) and the code metrics and coverage badges (US-001.18 to
US-001.20). Stories for the wiki (MIL-005, MIL-006) are not written yet.
## Story List ## Story List
@@ -248,9 +249,50 @@ US-001.15). Stories for the wiki (MIL-005, MIL-006) are not written yet.
| --- | --- | --- | | --- | --- | --- |
| [UC-005], [MIL-007] | fits one iteration | none | | [UC-005], [MIL-007] | fits one iteration | none |
### US-001.18 — The size of the code is visible as badges
**As a** Software Engineer, **I want** badges that show the number of code files and the number of lines of code without comment and blank lines, **so that** the size of the project is visible in its README without a service outside the instance.
**Acceptance Criteria**
- Given a repository that calls the shared code-metrics workflow, when a change is pushed, then a badge for the code files and a badge for the lines of code show the numbers of that revision.
- Given a file with a comment line, a blank line and a code line, when the lines are counted, then only the code line is counted as a line of code.
- Given a repository without a file of a supported language, when the workflow runs, then it passes with a notice and the badges show zero.
| Traces to | Size | INVEST exceptions |
| --- | --- | --- |
| [UC-008], [MIL-010] | fits one iteration | none |
### US-001.19 — The coverage is visible as a badge
**As a** Software Engineer, **I want** a badge that shows how much of the code my tests cover, **so that** a drop in coverage is seen as soon as it is pushed.
**Acceptance Criteria**
- Given a repository that supplies a coverage report, when a change is pushed, then a coverage badge shows the percentage of the report, and its colour follows the thresholds of the contract.
- Given a coverage report that is missing or that cannot be read, when the workflow runs, then it fails with a `[configuration]` message that names the report file and no coverage badge is changed.
- Given a repository that supplies no coverage report, when the workflow runs, then it passes with a notice and publishes no coverage badge.
| Traces to | Size | INVEST exceptions |
| --- | --- | --- |
| [UC-008], [MIL-010] | fits one iteration | none |
### US-001.20 — A run with unchanged numbers changes nothing
**As a** Software Engineer, **I want** the workflow to commit nothing when the numbers did not change, **so that** the history of the repository is not filled with badge commits.
**Acceptance Criteria**
- Given a push after which none of the three badges would differ, when the workflow runs, then no commit is made.
- Given a push after which a number changed, when the workflow runs, then one commit changes only the badge files, and the workflow does not start again from that commit.
| Traces to | Size | INVEST exceptions |
| --- | --- | --- |
| [UC-008], [MIL-010] | fits one iteration | none |
## INVEST Check ## INVEST Check
All seventeen stories are independent of each other except that US-001.05 and All twenty stories are independent of each other except that US-001.05 and
US-001.06 build on US-001.04 (the secrets must exist before a repository can US-001.06 build on US-001.04 (the secrets must exist before a repository can
run the workflow). Each states one goal and can be negotiated, delivers value run the workflow). Each states one goal and can be negotiated, delivers value
to the named role, is small enough for one iteration, and has acceptance to the named role, is small enough for one iteration, and has acceptance
@@ -274,5 +316,7 @@ behaviour is tested rather than built.
[UC-005]: ./uc-005/uc.md [UC-005]: ./uc-005/uc.md
[UC-006]: ./uc-006/uc.md [UC-006]: ./uc-006/uc.md
[UC-007]: ./uc-007/uc.md [UC-007]: ./uc-007/uc.md
[32b5ab6]: https://git.tirsystem.com/TirSystem/github-action/commit/32b5ab62ab5a82638b71b8fcfb43a819e92ab346 [UC-008]: ./uc-008/uc.md
[MIL-010]: ./milestones/mil-010-code-metrics-badges.md
[1bc56f8]: https://git.tirsystem.com/TirSystem/github-action/commit/1bc56f8b771531f221f218fc00b147ecc73c051e [1bc56f8]: https://git.tirsystem.com/TirSystem/github-action/commit/1bc56f8b771531f221f218fc00b147ecc73c051e
[9ca9673]: https://git.tirsystem.com/TirSystem/github-action/commit/9ca9673b00351cf913966f347c4da09890ed3f1f
+3 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Capabilities.md, source sha256 c60d434988dc --> <!-- translation of Capabilities.md, source sha256 3e3bcd9498f7 -->
> Dette er en oversættelse af [`Capabilities`](Capabilities). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`Capabilities`](Capabilities). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -13,8 +13,8 @@ Rækker, der siger Implementeret eller Vejledninger er skrevet, findes i dag. Re
| Synkronisering af repositorymetadata (Gitea til GitHub-spejl) | Implementeret i `.gitea/scoped_workflows/`, med offline-tests og et valideringsworkflow | | Synkronisering af repositorymetadata (Gitea til GitHub-spejl) | Implementeret i `.gitea/scoped_workflows/`, med offline-tests og et valideringsworkflow |
| Konfiguration og validering af workflow-credentials | Implementeret for synkroniseringsworkflowet: en forhåndskontrol tjekker begge tokens før enhver ændring ([vejledning](Credentials.da)) | | Konfiguration og validering af workflow-credentials | Implementeret for synkroniseringsworkflowet: en forhåndskontrol tjekker begge tokens før enhver ændring ([vejledning](Credentials.da)) |
| Tilslutning af et repository, administration af runners, fejlfinding | Vejledninger er skrevet ([tilslutning](Onboarding.da), [fejlfinding](Troubleshooting.da)); scoped levering til alle fire organisationers repositories er verificeret (MIL-002) | | Tilslutning af et repository, administration af runners, fejlfinding | Vejledninger er skrevet ([tilslutning](Onboarding.da), [fejlfinding](Troubleshooting.da)); scoped levering til alle fire organisationers repositories er verificeret (MIL-002) |
| Publicering af et repositorys wiki fra `wiki/` (tilmelding, leveres til alle organisationer) | Implementeret i `.gitea/scoped_workflows/publish-wiki.yml`, med offline-tests; et pilotforsøg i et andet repository publicerer sin wiki (MIL-006); afløses af det genbrugelige workflow nedenfor (ADR-0009) | | Publicering af et repositorys wiki fra `docs/wiki/` gennem et kaldt workflow | Implementeret som det genbrugelige workflow `.gitea/workflows/publish-wiki-pages.yml`, med offline-tests; kaldt af hvert repository, der publicerer en wiki, og dette repositorys egen wiki er i `docs/wiki/` (MIL-008, MIL-009) |
| Publicering af et repositorys wiki fra `docs/wiki/` gennem et kaldt workflow | Implementeret som det genbrugelige workflow `.gitea/workflows/publish-wiki-pages.yml`, med offline-tests; dette repositorys egen wiki er i `docs/wiki/` og publiceres af det gennem `publish-own-wiki.yml`; endnu ikke kaldt fra et andet repository (MIL-008) |
| Fælles kvalitetskontrol (Python og shell) | Implementeret som det genbrugelige workflow `.gitea/workflows/quality-checks.yml`, med offline-tests og et forsøg i en anden organisation; taget i brug i RepoFoundry ([vejledning](QualityChecksPythonShell.da)) | | Fælles kvalitetskontrol (Python og shell) | Implementeret som det genbrugelige workflow `.gitea/workflows/quality-checks.yml`, med offline-tests og et forsøg i en anden organisation; taget i brug i RepoFoundry ([vejledning](QualityChecksPythonShell.da)) |
| Fælles kvalitetskontrol (C og C++, C#) | Implementeret som de genbrugelige workflows `.gitea/workflows/quality-checks-cpp.yml` og `.gitea/workflows/quality-checks-csharp.yml` med præcise værktøjsversioner og offline-tests; endnu ikke brugt i et andet repository (MIL-007) ([vejledning til C og C++](QualityChecksCpp.da), [vejledning til C#](QualityChecksCSharp.da)) | | Fælles kvalitetskontrol (C og C++, C#) | Implementeret som de genbrugelige workflows `.gitea/workflows/quality-checks-cpp.yml` og `.gitea/workflows/quality-checks-csharp.yml` med præcise værktøjsversioner og offline-tests; endnu ikke brugt i et andet repository (MIL-007) ([vejledning til C og C++](QualityChecksCpp.da), [vejledning til C#](QualityChecksCSharp.da)) |
| Kodemålinger og dækningsbadges | Implementeret og udgivet i 2.1.0 som det genbrugelige workflow `.gitea/workflows/code-metrics.yml` med en tæller, en Cobertura-læser, en SVG-renderer og offline-tests; afprøvet i et kasserepository, endnu ikke brugt i et projektrepository (MIL-010) ([vejledning](CodeMetrics.da)) |
| Versioneret udgivelse og publicering | Udgivelsesproces, changelog og opgraderingsvejledning er defineret; udgivelsesworkflowet findes, og `v1.0.0` er udgivet (MIL-004) ([vejledning](Upgrading.da)) | | Versioneret udgivelse og publicering | Udgivelsesproces, changelog og opgraderingsvejledning er defineret; udgivelsesworkflowet findes, og `v1.0.0` er udgivet (MIL-004) ([vejledning](Upgrading.da)) |
+2 -2
View File
@@ -13,8 +13,8 @@ Rows that say Implemented or Guides written exist today. The rest is planned and
| Synchronize repository metadata (Gitea to GitHub mirror) | Implemented in `.gitea/scoped_workflows/`, with offline tests and a validation workflow | | Synchronize repository metadata (Gitea to GitHub mirror) | Implemented in `.gitea/scoped_workflows/`, with offline tests and a validation workflow |
| Configure and validate workflow credentials | Implemented for the sync workflow: preflight checks both tokens before any change ([guide](Credentials)) | | Configure and validate workflow credentials | Implemented for the sync workflow: preflight checks both tokens before any change ([guide](Credentials)) |
| Onboard a repository, manage runners, diagnose failures | Guides written ([onboarding](Onboarding), [troubleshooting](Troubleshooting)); scoped delivery to the repositories of all four organizations verified (MIL-002) | | Onboard a repository, manage runners, diagnose failures | Guides written ([onboarding](Onboarding), [troubleshooting](Troubleshooting)); scoped delivery to the repositories of all four organizations verified (MIL-002) |
| Publish a repository wiki from `wiki/` (opt-in, delivered to every organization) | Implemented in `.gitea/scoped_workflows/publish-wiki.yml`, with offline tests; a pilot in a second repository publishes its wiki (MIL-006); being replaced by the reusable workflow below (ADR-0009) | | Publish a repository wiki from `docs/wiki/` through a called workflow | Implemented as the reusable workflow `.gitea/workflows/publish-wiki-pages.yml`, with offline tests; called by every repository that publishes a wiki, and this repository's own wiki is in `docs/wiki/` (MIL-008, MIL-009) |
| Publish a repository wiki from `docs/wiki/` through a called workflow | Implemented as the reusable workflow `.gitea/workflows/publish-wiki-pages.yml`, with offline tests; this repository's own wiki is in `docs/wiki/` and published by it through `publish-own-wiki.yml`; not yet called from another repository (MIL-008) |
| Shared quality checks (Python and shell) | Implemented as the reusable workflow `.gitea/workflows/quality-checks.yml`, with offline tests and a trial in a second organization; adopted in RepoFoundry ([guide](QualityChecksPythonShell)) | | Shared quality checks (Python and shell) | Implemented as the reusable workflow `.gitea/workflows/quality-checks.yml`, with offline tests and a trial in a second organization; adopted in RepoFoundry ([guide](QualityChecksPythonShell)) |
| Shared quality checks (C and C++, C#) | Implemented as the reusable workflows `.gitea/workflows/quality-checks-cpp.yml` and `.gitea/workflows/quality-checks-csharp.yml` with exact tool versions and offline tests; not yet used in another repository (MIL-007) ([C and C++ guide](QualityChecksCpp), [C# guide](QualityChecksCSharp)) | | Shared quality checks (C and C++, C#) | Implemented as the reusable workflows `.gitea/workflows/quality-checks-cpp.yml` and `.gitea/workflows/quality-checks-csharp.yml` with exact tool versions and offline tests; not yet used in another repository (MIL-007) ([C and C++ guide](QualityChecksCpp), [C# guide](QualityChecksCSharp)) |
| Code metrics and coverage badges | Implemented and released in 2.1.0 as the reusable workflow `.gitea/workflows/code-metrics.yml` with a counter, a Cobertura reader, an SVG renderer and offline tests; tried in a throwaway repository, not yet used in a project repository (MIL-010) ([guide](CodeMetrics)) |
| Versioned release and publishing | Release process, changelog and upgrade guide defined; the release workflow exists and `v1.0.0` is released (MIL-004) ([guide](Upgrading)) | | Versioned release and publishing | Release process, changelog and upgrade guide defined; the release workflow exists and `v1.0.0` is released (MIL-004) ([guide](Upgrading)) |
+3 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Capabilities.md, source sha256 c60d434988dc --> <!-- translation of Capabilities.md, source sha256 3e3bcd9498f7 -->
> Ini ialah terjemahan [`Capabilities`](Capabilities). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`Capabilities`](Capabilities). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -13,8 +13,8 @@ Baris yang menyatakan Dilaksanakan atau Panduan telah ditulis wujud hari ini. Se
| Menyegerakkan metadata repositori (Gitea ke cermin GitHub) | Dilaksanakan dalam `.gitea/scoped_workflows/`, dengan ujian luar talian dan aliran kerja pengesahan | | Menyegerakkan metadata repositori (Gitea ke cermin GitHub) | Dilaksanakan dalam `.gitea/scoped_workflows/`, dengan ujian luar talian dan aliran kerja pengesahan |
| Mengkonfigur dan mengesahkan kelayakan (credentials) aliran kerja | Dilaksanakan untuk aliran kerja penyegerakan: semakan awal (preflight) memeriksa kedua-dua token sebelum sebarang perubahan ([panduan](Credentials.ms)) | | Mengkonfigur dan mengesahkan kelayakan (credentials) aliran kerja | Dilaksanakan untuk aliran kerja penyegerakan: semakan awal (preflight) memeriksa kedua-dua token sebelum sebarang perubahan ([panduan](Credentials.ms)) |
| Menyertakan repositori, mengurus runner, mendiagnosis kegagalan | Panduan telah ditulis ([menyertakan repositori](Onboarding.ms), [diagnosis](Troubleshooting.ms)); penghantaran scoped ke repositori keempat-empat organisasi telah disahkan (MIL-002) | | Menyertakan repositori, mengurus runner, mendiagnosis kegagalan | Panduan telah ditulis ([menyertakan repositori](Onboarding.ms), [diagnosis](Troubleshooting.ms)); penghantaran scoped ke repositori keempat-empat organisasi telah disahkan (MIL-002) |
| Menerbitkan wiki repositori daripada `wiki/` (pilih menyertai, dihantar ke setiap organisasi) | Dilaksanakan dalam `.gitea/scoped_workflows/publish-wiki.yml`, dengan ujian luar talian; satu juruterbang dalam repositori kedua menerbitkan wikinya (MIL-006); sedang diganti oleh aliran kerja boleh guna semula di bawah (ADR-0009) | | Menerbitkan wiki repositori daripada `docs/wiki/` melalui aliran kerja yang dipanggil | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/publish-wiki-pages.yml`, dengan ujian luar talian; dipanggil oleh setiap repositori yang menerbitkan wiki, dan wiki repositori ini sendiri ada dalam `docs/wiki/` (MIL-008, MIL-009) |
| Menerbitkan wiki repositori daripada `docs/wiki/` melalui aliran kerja yang dipanggil | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/publish-wiki-pages.yml`, dengan ujian luar talian; wiki repositori ini sendiri ada dalam `docs/wiki/` dan diterbitkan olehnya melalui `publish-own-wiki.yml`; belum dipanggil daripada repositori lain (MIL-008) |
| Semakan kualiti bersama (Python dan shell) | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/quality-checks.yml`, dengan ujian luar talian dan percubaan dalam organisasi kedua; digunakan dalam RepoFoundry ([panduan](QualityChecksPythonShell.ms)) | | Semakan kualiti bersama (Python dan shell) | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/quality-checks.yml`, dengan ujian luar talian dan percubaan dalam organisasi kedua; digunakan dalam RepoFoundry ([panduan](QualityChecksPythonShell.ms)) |
| Semakan kualiti bersama (C dan C++, C#) | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/quality-checks-cpp.yml` dan `.gitea/workflows/quality-checks-csharp.yml` dengan versi alat yang tepat dan ujian luar talian; belum digunakan dalam repositori lain (MIL-007) ([panduan C dan C++](QualityChecksCpp.ms), [panduan C#](QualityChecksCSharp.ms)) | | Semakan kualiti bersama (C dan C++, C#) | Dilaksanakan sebagai aliran kerja boleh guna semula `.gitea/workflows/quality-checks-cpp.yml` dan `.gitea/workflows/quality-checks-csharp.yml` dengan versi alat yang tepat dan ujian luar talian; belum digunakan dalam repositori lain (MIL-007) ([panduan C dan C++](QualityChecksCpp.ms), [panduan C#](QualityChecksCSharp.ms)) |
| Metrik kod dan lencana liputan | Dilaksanakan dan diterbitkan dalam 2.1.0 sebagai aliran kerja boleh guna semula `.gitea/workflows/code-metrics.yml` dengan pengira, pembaca Cobertura, pemaparan SVG dan ujian luar talian; dicuba dalam repositori sekali pakai, belum digunakan dalam repositori projek (MIL-010) ([panduan](CodeMetrics.ms)) |
| Keluaran berversi dan penerbitan | Proses keluaran, changelog dan panduan naik taraf telah ditakrifkan; aliran kerja keluaran sudah ada dan `v1.0.0` telah dikeluarkan (MIL-004) ([panduan](Upgrading.ms)) | | Keluaran berversi dan penerbitan | Proses keluaran, changelog dan panduan naik taraf telah ditakrifkan; aliran kerja keluaran sudah ada dan `v1.0.0` telah dikeluarkan (MIL-004) ([panduan](Upgrading.ms)) |
+92
View File
@@ -0,0 +1,92 @@
<!-- translation of CodeMetrics.md, source sha256 03134e97a78a -->
> Dette er en oversættelse af [`CodeMetrics`](CodeMetrics). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
[English](CodeMetrics) | Dansk | [Bahasa Melayu](CodeMetrics.ms)
# Visning af kodemålinger og dækningsbadges
Sådan kalder en softwareudvikler det fælles kodemålings-workflow og viser dets tre badges (kodefiler, kodelinjer og dækning) i en README. Workflowet tæller repositoryets kode, læser en dækningsrapport, som kalderen leverer, og committer tre SVG-filer til en `badges`-gren. Det kører ingen test og kræver ingen secret. Dets kontrakt er ADR-0010 i dette repository.
## Kald af workflowet
Workflowet kan ikke se filerne fra dit testjob, så testene kører i et job, du selv ejer, uploader Cobertura XML-rapporten som artefakt, og målingsjobbet kører bagefter:
```yaml
name: Code metrics
on:
push:
branches: [ main ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- run: python3 -m pip install pytest pytest-cov && python3 -m pytest --cov --cov-report=xml
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage
path: coverage.xml
metrics:
needs: tests
permissions:
contents: write
uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2
with:
coverage-artifact: coverage
coverage-report: coverage.xml
```
| Input | Standard | Betydning |
| --- | --- | --- |
| `working-directory` | `.` | Mappe, relativt til repositoryets rod, hvis kode tælles |
| `exclude` | tom | Kommasepareret liste af mønstre for filer og mapper, der ikke tælles, ud over standardudeladelserne; et mønster uden `/` matcher et navn overalt, et mønster med `/` matcher stien under `working-directory` |
| `coverage-report` | tom | Cobertura XML-rapport: filen i artefaktet, når `coverage-artifact` er sat, ellers en sti i repositoryet; tom giver intet dækningsbadge |
| `coverage-artifact` | tom | Navn på et artefakt, uploadet af et tidligere job i samme kørsel, der indeholder rapporten |
| `coverage-warn` | `60` | Dækning i procent, under hvilken badget er rødt |
| `coverage-good` | `80` | Dækning i procent, fra hvilken badget er grønt; derimellem er det gult |
| `badges-branch` | `badges` | Gren, der indeholder badge-filerne; den oprettes, hvis den ikke findes |
| `tools-ref` | `v2` | Tag eller gren i `TirSystem/github-action`, hvorfra scripts i `tools/` hentes |
Reference workflowet ved major-tagget (`@v1`) eller ved et præcist tag, aldrig ved `main`. Et kald ved et præcist tag er kun fuldt fastlåst, når `tools-ref` navngiver samme tag. Se opgraderingsvejledningen. Start workflowet kun ved push til din standardgren: badge-committet har `[skip ci]` og laves med kørslens token, som ikke starter en ny kørsel, men en trigger på alle grene ville skrive ét commit pr. gren.
## Hvad der tælles
- En kodefil er en tekstfil med filendelsen for et understøttet sprog: Python, shell, PowerShell, C, C++, C#, Java, JavaScript, TypeScript, Go, Rust og SQL. Markdown, YAML, JSON, XML, HTML og CSS er ikke kodefiler.
- Hver linje er præcis én af: tom (kun blanktegn), kommentar (kun kommentartekst) eller kode (alt andet, også en linje med kode og en afsluttende kommentar). Badget viser kun kodelinjerne.
- En kommentarmarkør i en streng er ikke en kommentar, og en Python-docstring er en streng og tæller derfor som kode.
- Mapper, der starter med punktum, og `node_modules`, `vendor`, `third_party`, `dist`, `build`, `out`, `bin`, `obj`, `target`, `venv`, `__pycache__` og `shared-scripts` tælles ikke. Genereret kode udelades med `exclude`.
- Rå og ordrette strenge, der afviger fra en almindelig streng (Rust `r#"..."#`, C# `@"..."`, C++-rå strenge), kan tælles forkert. Tallene afviger lidt fra andre værktøjer; reglerne er de samme ved hver kørsel.
## Dækningsbadget
Rapporten er en Cobertura XML-fil, som `coverage.py` (`coverage xml`), `gcovr` (`--cobertura`) og `coverlet` (formatet `cobertura`) skriver. Badget viser `lines-covered` over `lines-valid`, afrundet til hele procent, og farven følger de to grænser. En rapport, der ikke findes, ikke er velformet Cobertura XML eller ikke har gyldige linjer, får kørslen til at fejle med filen nævnt; dækningsbadget skrives aldrig som `0%` for en dårlig rapport. Uden `coverage-report` består kørslen med en note og uden dækningsbadge.
## Visning af badges
Tilføj billederne til README med grenens rå URL'er:
```markdown
![code files](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-files.svg)
![lines of code](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-lines.svg)
![coverage](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/coverage.svg)
```
På GitHub-spejlet bruges `https://raw.githubusercontent.com/OWNER/REPO/badges/code-files.svg`; push-spejlet kopierer grenen. `badges`-grenen indeholder også `code-metrics.json` med tallene pr. sprog. Instansen cacher en rå fil i op til seks timer, så et ændret badge kan vise det gamle tal et stykke tid dér; spejlet cacher i fem minutter. Et privat repository viser ikke badges for en læser, der ikke er logget ind.
## Når workflowet fejler
| Meddelelse | Årsag | Løsning |
| --- | --- | --- |
| `[configuration] working-directory must be a relative path inside the repository.` | En absolut sti eller `..` | Brug en sti inde i repositoryet |
| `[configuration] coverage-report '<x>' does not exist.` | Rapporten blev ikke frembragt, eller artefaktnavnet eller stien er forkert | Tjek testjobbet og artefaktnavnet; stien er inde i artefaktet |
| `[configuration] coverage-report '<x>' is not well-formed XML` eller `is not a Cobertura report` | Filen har et andet format | Skriv Cobertura XML (`coverage xml`, `gcovr --cobertura`) |
| `[configuration] coverage-report '<x>' has no valid lines.` | Testene kørte ingen målt kode | Tjek dækningskonfigurationen |
| `[configuration] coverage-artifact '<x>' needs coverage-report` | Artefaktet er navngivet, men ikke filen i det | Sæt `coverage-report` |
| `[configuration] coverage-warn ... is above coverage-good` eller `is not a number from 0 to 100` | En grænse er ugyldig | Ret inputtet |
| `[configuration] badges-branch '<x>' must not be a default branch` eller `holds files that are not badge files` | Grenen hedder `main`, `master` eller har andet indhold | Brug en gren, der kun indeholder badges |
| `the push to '<x>' failed twice` | En anden kørsel skrev grenen samtidig, eller tokenet kan ikke skrive | Kør igen; tjek at jobbet har `contents: write` |
| Download-trinnet fejler | Artefaktet findes ikke i denne kørsel, eller jobbet kører ikke efter testjobbet | Tilføj `needs:` og tjek artefaktnavnet |
+123
View File
@@ -0,0 +1,123 @@
<!-- Generated from guides/code-metrics.md by tools/build_wiki.py. Edit the source, not this page. -->
> This page is generated from [`guides/code-metrics.md`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/code-metrics.md). Changes made here are overwritten the next time the wiki is published.
English | [Dansk](CodeMetrics.da) | [Bahasa Melayu](CodeMetrics.ms)
# Showing code metrics and coverage badges
How a software engineer calls the shared code-metrics workflow and shows its
three badges (code files, lines of code and coverage) in a README. The workflow
counts the code of the repository, reads a coverage report that the caller
supplies and commits three SVG files to a `badges` branch. It runs no test and
needs no secret. Its contract is ADR-0010 in this repository.
## Calling the workflow
The workflow cannot see the files of your test job, so the tests run in a job of
your own, upload the Cobertura XML report as an artifact, and the metrics job
runs after it:
```yaml
name: Code metrics
on:
push:
branches: [ main ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- run: python3 -m pip install pytest pytest-cov && python3 -m pytest --cov --cov-report=xml
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage
path: coverage.xml
metrics:
needs: tests
permissions:
contents: write
uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2
with:
coverage-artifact: coverage
coverage-report: coverage.xml
```
| Input | Default | Meaning |
| --- | --- | --- |
| `working-directory` | `.` | Directory, relative to the repository root, whose code is counted |
| `exclude` | empty | Comma list of patterns of files and directories that are not counted, in addition to the defaults; a pattern without `/` matches a name anywhere, a pattern with `/` matches the path below `working-directory` |
| `coverage-report` | empty | Cobertura XML report: the file inside the artifact when `coverage-artifact` is set, otherwise a path in the repository; empty writes no coverage badge |
| `coverage-artifact` | empty | Name of an artifact, uploaded by an earlier job of the same run, that holds the report |
| `coverage-warn` | `60` | Coverage in percent below which the badge is red |
| `coverage-good` | `80` | Coverage in percent from which the badge is green; in between it is yellow |
| `badges-branch` | `badges` | Branch that holds the badge files; it is created when it does not exist |
| `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the scripts in `tools/` are fetched |
Reference the workflow at the major tag (`@v2`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names
the same tag. See the upgrade guide. Start the workflow on pushes to your
default branch only: the badge commit carries `[skip ci]` and is made with the
token of the run, which does not start another run, but a trigger on every
branch would write one commit per branch.
## What is counted
- A code file is a text file with the extension of a supported language:
Python, shell, PowerShell, C, C++, C#, Java, JavaScript, TypeScript, Go, Rust
and SQL. Markdown, YAML, JSON, XML, HTML and CSS are not code files.
- Every line is exactly one of blank (only white space), comment (only comment
text) or code (everything else, including a line with code and a trailing
comment). The badge shows the lines of code only.
- A comment marker inside a string is not a comment, and a Python docstring is a
string, so it counts as code.
- Directories that start with a dot and `node_modules`, `vendor`, `third_party`,
`dist`, `build`, `out`, `bin`, `obj`, `target`, `venv`, `__pycache__` and
`shared-scripts` are not counted. Generated code is excluded with `exclude`.
- Raw and verbatim strings that differ from an ordinary string (Rust `r#"..."#`,
C# `@"..."`, C++ raw strings) can be counted wrongly. The counts will differ
a little from other tools; the rules are the same on every run.
## The coverage badge
The report is a Cobertura XML file, which `coverage.py` (`coverage xml`),
`gcovr` (`--cobertura`) and `coverlet` (`cobertura` format) write. The badge
shows `lines-covered` over `lines-valid`, rounded to a whole percent, and its
colour follows the two thresholds. A report that does not exist, is not
well-formed Cobertura XML or has no valid lines fails the run with the file
named; the coverage badge is never written as `0%` for a bad report. Without
`coverage-report` the run passes with a notice and no coverage badge.
## Showing the badges
Add the images to the README with the raw URLs of the branch:
```markdown
![code files](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-files.svg)
![lines of code](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-lines.svg)
![coverage](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/coverage.svg)
```
On the GitHub mirror use `https://raw.githubusercontent.com/OWNER/REPO/badges/code-files.svg`;
the push mirror copies the branch. The `badges` branch also holds
`code-metrics.json` with the numbers per language. The instance caches a raw
file for up to six hours, so a changed badge can show the old number for a
while there; the mirror caches for five minutes. A private repository does not
show the badges to a reader who is not signed in.
## When the workflow fails
| Message | Cause | Fix |
| --- | --- | --- |
| `[configuration] working-directory must be a relative path inside the repository.` | An absolute path or `..` | Use a path inside the repository |
| `[configuration] coverage-report '<x>' does not exist.` | The report was not produced, or the artifact name or path is wrong | Check the test job and the artifact name; the path is inside the artifact |
| `[configuration] coverage-report '<x>' is not well-formed XML` or `is not a Cobertura report` | The file is another format | Write Cobertura XML (`coverage xml`, `gcovr --cobertura`) |
| `[configuration] coverage-report '<x>' has no valid lines.` | The tests ran no measured code | Check the coverage configuration |
| `[configuration] coverage-artifact '<x>' needs coverage-report` | The artifact is named but not the file in it | Set `coverage-report` |
| `[configuration] coverage-warn ... is above coverage-good` or `is not a number from 0 to 100` | A threshold is invalid | Correct the input |
| `[configuration] badges-branch '<x>' must not be a default branch` or `holds files that are not badge files` | The branch name is `main`, `master` or a branch with other content | Use a branch that holds only the badges |
| `the push to '<x>' failed twice` | Another run wrote the branch at the same time, or the token cannot write | Re-run; check that the job has `contents: write` |
| The download step fails | The artifact does not exist in this run, or the job does not run after the test job | Add `needs:` and check the artifact name |
+92
View File
@@ -0,0 +1,92 @@
<!-- translation of CodeMetrics.md, source sha256 03134e97a78a -->
> Ini ialah terjemahan [`CodeMetrics`](CodeMetrics). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
[English](CodeMetrics) | [Dansk](CodeMetrics.da) | Bahasa Melayu
# Menunjukkan metrik kod dan lencana liputan
Cara seorang jurutera perisian memanggil aliran kerja metrik kod bersama dan menunjukkan tiga lencananya (fail kod, baris kod dan liputan) dalam README. Aliran kerja ini mengira kod repositori, membaca laporan liputan yang dibekalkan oleh pemanggil dan melakukan commit tiga fail SVG ke cabang `badges`. Ia tidak menjalankan sebarang ujian dan tidak memerlukan secret. Kontraknya ialah ADR-0010 dalam repositori ini.
## Memanggil aliran kerja
Aliran kerja tidak dapat melihat fail daripada kerja ujian anda, jadi ujian dijalankan dalam kerja anda sendiri, memuat naik laporan Cobertura XML sebagai artifak, dan kerja metrik dijalankan selepasnya:
```yaml
name: Code metrics
on:
push:
branches: [ main ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- run: python3 -m pip install pytest pytest-cov && python3 -m pytest --cov --cov-report=xml
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage
path: coverage.xml
metrics:
needs: tests
permissions:
contents: write
uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2
with:
coverage-artifact: coverage
coverage-report: coverage.xml
```
| Input | Lalai | Maksud |
| --- | --- | --- |
| `working-directory` | `.` | Direktori, relatif kepada akar repositori, yang kodnya dikira |
| `exclude` | kosong | Senarai corak fail dan direktori yang tidak dikira, dipisahkan koma, sebagai tambahan kepada pengecualian lalai; corak tanpa `/` sepadan dengan nama di mana-mana, corak dengan `/` sepadan dengan laluan di bawah `working-directory` |
| `coverage-report` | kosong | Laporan Cobertura XML: fail dalam artifak apabila `coverage-artifact` ditetapkan, jika tidak laluan dalam repositori; kosong bermakna tiada lencana liputan |
| `coverage-artifact` | kosong | Nama artifak, dimuat naik oleh kerja yang lebih awal dalam larian yang sama, yang memegang laporan |
| `coverage-warn` | `60` | Liputan dalam peratus di bawahnya lencana berwarna merah |
| `coverage-good` | `80` | Liputan dalam peratus yang bermulanya lencana berwarna hijau; di antaranya kuning |
| `badges-branch` | `badges` | Cabang yang memegang fail lencana; ia dicipta jika tidak wujud |
| `tools-ref` | `v2` | Tag atau cabang `TirSystem/github-action` tempat skrip dalam `tools/` diambil |
Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat, jangan sekali-kali pada `main`. Panggilan pada tag tepat hanya tersemat sepenuhnya apabila `tools-ref` menamakan tag yang sama. Lihat panduan menaik taraf. Mulakan aliran kerja pada push ke cabang lalai anda sahaja: commit lencana membawa `[skip ci]` dan dibuat dengan token larian, yang tidak memulakan larian lain, tetapi pencetus pada setiap cabang akan menulis satu commit bagi setiap cabang.
## Apa yang dikira
- Fail kod ialah fail teks dengan sambungan bagi bahasa yang disokong: Python, shell, PowerShell, C, C++, C#, Java, JavaScript, TypeScript, Go, Rust dan SQL. Markdown, YAML, JSON, XML, HTML dan CSS bukan fail kod.
- Setiap baris tepat satu daripada: kosong (hanya ruang putih), komen (hanya teks komen) atau kod (selebihnya, termasuk baris dengan kod dan komen di hujung). Lencana hanya menunjukkan baris kod.
- Penanda komen dalam rentetan bukan komen, dan docstring Python ialah rentetan jadi dikira sebagai kod.
- Direktori yang bermula dengan titik, serta `node_modules`, `vendor`, `third_party`, `dist`, `build`, `out`, `bin`, `obj`, `target`, `venv`, `__pycache__` dan `shared-scripts` tidak dikira. Kod yang dijana dikecualikan dengan `exclude`.
- Rentetan mentah dan verbatim yang berbeza daripada rentetan biasa (Rust `r#"..."#`, C# `@"..."`, rentetan mentah C++) boleh dikira dengan salah. Angka sedikit berbeza daripada alat lain; peraturannya sama pada setiap larian.
## Lencana liputan
Laporan ialah fail Cobertura XML, yang ditulis oleh `coverage.py` (`coverage xml`), `gcovr` (`--cobertura`) dan `coverlet` (format `cobertura`). Lencana menunjukkan `lines-covered` berbanding `lines-valid`, dibundarkan kepada peratus penuh, dan warnanya mengikut dua ambang. Laporan yang tidak wujud, bukan Cobertura XML yang terbentuk dengan baik atau tidak mempunyai baris sah menyebabkan larian gagal dengan nama fail disebut; lencana liputan tidak pernah ditulis sebagai `0%` bagi laporan yang rosak. Tanpa `coverage-report` larian lulus dengan notis dan tanpa lencana liputan.
## Menunjukkan lencana
Tambahkan imej ke README dengan URL mentah cabang:
```markdown
![code files](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-files.svg)
![lines of code](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-lines.svg)
![coverage](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/coverage.svg)
```
Pada cermin GitHub gunakan `https://raw.githubusercontent.com/OWNER/REPO/badges/code-files.svg`; cermin push menyalin cabang itu. Cabang `badges` juga memegang `code-metrics.json` dengan angka bagi setiap bahasa. Instans menyimpan fail mentah dalam cache sehingga enam jam, jadi lencana yang berubah mungkin menunjukkan angka lama seketika di sana; cermin menyimpannya lima minit. Repositori persendirian tidak menunjukkan lencana kepada pembaca yang belum log masuk.
## Apabila aliran kerja gagal
| Mesej | Punca | Pembetulan |
| --- | --- | --- |
| `[configuration] working-directory must be a relative path inside the repository.` | Laluan mutlak atau `..` | Gunakan laluan di dalam repositori |
| `[configuration] coverage-report '<x>' does not exist.` | Laporan tidak dihasilkan, atau nama artifak atau laluan salah | Semak kerja ujian dan nama artifak; laluan berada di dalam artifak |
| `[configuration] coverage-report '<x>' is not well-formed XML` atau `is not a Cobertura report` | Fail itu berformat lain | Tulis Cobertura XML (`coverage xml`, `gcovr --cobertura`) |
| `[configuration] coverage-report '<x>' has no valid lines.` | Ujian tidak menjalankan kod yang diukur | Semak konfigurasi liputan |
| `[configuration] coverage-artifact '<x>' needs coverage-report` | Artifak dinamakan tetapi bukan fail di dalamnya | Tetapkan `coverage-report` |
| `[configuration] coverage-warn ... is above coverage-good` atau `is not a number from 0 to 100` | Ambang tidak sah | Betulkan input |
| `[configuration] badges-branch '<x>' must not be a default branch` atau `holds files that are not badge files` | Nama cabang ialah `main`, `master` atau cabang dengan kandungan lain | Gunakan cabang yang hanya memegang lencana |
| `the push to '<x>' failed twice` | Larian lain menulis cabang pada masa yang sama, atau token tidak boleh menulis | Jalankan semula; semak bahawa kerja mempunyai `contents: write` |
| Langkah muat turun gagal | Artifak tidak wujud dalam larian ini, atau kerja tidak berjalan selepas kerja ujian | Tambah `needs:` dan semak nama artifak |
+47 -47
View File
@@ -1,4 +1,4 @@
<!-- translation of Home.md, source sha256 b6796554f4eb --> <!-- translation of Home.md, source sha256 9b967f9e1aff -->
> Dette er en oversættelse af [`Home`](Home). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`Home`](Home). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -13,7 +13,7 @@ En samling af genbrugelige Gitea Actions-workflows til DevOps-professionelle og
Dette repository er den centrale samling af genbrugelig automatisering til TirSystems repositories. Det primære repository ligger på `git.tirsystem.com` (Gitea) og spejles med push til GitHub. Dette repository er den centrale samling af genbrugelig automatisering til TirSystems repositories. Det primære repository ligger på `git.tirsystem.com` (Gitea) og spejles med push til GitHub.
Det indeholder ti workflows: synkronisering af metadata til GitHub-spejlet, publicering af wiki (scoped og genbrugeligt for repositories, der kalder det), fælles kvalitetskontrol for Python og shell, for C og C++ og for C#, et udgivelsesworkflow, publicering af accepterede milepæle og repositoryets egen validering. De er listet med formål og diagram under [Workflows](#workflows). Det indeholder ti workflows: synkronisering af metadata til GitHub-spejlet, publicering af wiki (kaldt af hvert repository), fælles kvalitetskontrol for Python og shell, for C og C++ og for C#, kodemålinger og dækningsbadges, et udgivelsesworkflow, publicering af accepterede milepæle og repositoryets egen validering. De er listet med formål og diagram under [Workflows](#workflows).
## Workflows ## Workflows
@@ -23,11 +23,11 @@ Der er ti workflows i dette repository. Et **scoped** workflow leveres af instan
| Workflow | Fil | Type | Starter ved | Formål | | Workflow | Fil | Type | Starter ved | Formål |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push til `main`, manuelt, dagligt kl. 03:17 UTC | Kopierer beskrivelsen og emnerne for et Gitea-repository til dets GitHub push-spejl | | Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push til `main`, manuelt, dagligt kl. 03:17 UTC | Kopierer beskrivelsen og emnerne for et Gitea-repository til dets GitHub push-spejl |
| Publish wiki | [`publish-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/publish-wiki.yml) | Scoped, tilmelding med `wiki/.publish`; forældet, afløses af det genbrugelige workflow nedenfor (ADR-0009) | push til `main`, der ændrer `wiki/**`, manuelt | Publicerer siderne i `wiki/` til repositoryets wiki |
| Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Publicerer siderne i `docs/wiki/` (eller den mappe, `wiki_dir` angiver) til wikien i det kaldende repository | | Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Publicerer siderne i `docs/wiki/` (eller den mappe, `wiki_dir` angiver) til wikien i det kaldende repository |
| Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører ruff, mypy, shellcheck og shfmt på de sporede filer og ændrer intet | | Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører ruff, mypy, shellcheck og shfmt på de sporede filer og ændrer intet |
| Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører clang-format og clang-tidy i præcise versioner på de sporede C- og C++-filer og ændrer intet | | Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører clang-format og clang-tidy i præcise versioner på de sporede C- og C++-filer og ændrer intet |
| Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører `dotnet format` og `dotnet build` på et præcist .NET SDK 10 eller nyere og ændrer intet | | Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Kører `dotnet format` og `dotnet build` på et præcist .NET SDK 10 eller nyere og ændrer intet |
| Code metrics | [`code-metrics.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/code-metrics.yml) | Genbrugeligt (`workflow_call`) | et kald fra et andet repository | Tæller kodefilerne og kodelinjerne (uden kommentar- og tomme linjer), læser en Cobertura-dækningsrapport og committer tre SVG-badges til en `badges`-gren |
| Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | Kun dette repository | push til `main`, der ændrer `docs/wiki/**`, manuelt | Kalder det genbrugelige workflow Publish wiki pages for dette repositorys wiki | | Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | Kun dette repository | push til `main`, der ændrer `docs/wiki/**`, manuelt | Kalder det genbrugelige workflow Publish wiki pages for dette repositorys wiki |
| Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | Kun dette repository | manuelt | Opretter versionstagget, udgivelsessiden og major-tagget efter kontrollerne | | Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | Kun dette repository | manuelt | Opretter versionstagget, udgivelsessiden og major-tagget efter kontrollerne |
| Publicering af accepterede milepæle | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | Kun dette repository | push til `main`, der ændrer `docs/milestones/**` eller `docs/sqa/reviews/**`, manuelt (tørkørsel som standard) | Opretter eller opdaterer Gitea-milepælen og issues for hver milepæl, der er Accepted med en Go-gennemgang | | Publicering af accepterede milepæle | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | Kun dette repository | push til `main`, der ændrer `docs/milestones/**` eller `docs/sqa/reviews/**`, manuelt (tørkørsel som standard) | Opretter eller opdaterer Gitea-milepælen og issues for hver milepæl, der er Accepted med en Go-gennemgang |
@@ -99,50 +99,6 @@ deactivate Workflow
@enduml @enduml
``` ```
### Publicering af wiki (scoped, forældet)
Publicerer `wiki/` til repositoryets wiki, kun i et repository, der har tilmeldt sig med `wiki/.publish`. Ordet `prune` i den fil sletter også sider, som ikke findes i `wiki/`.
#### Workflow
```plantuml
@startuml
title Publish wiki/ to the repository wiki
autonumber
actor "Push to main that changes wiki/**,\nor manual trigger" as Trigger
participant "Gitea Actions\npublish-wiki" as Workflow
participant "shared-scripts\n(tools/publish_wiki.py at v1)" as Script
participant "Gitea wiki API" as Wiki
Trigger -> Workflow: Start workflow
activate Workflow
Workflow -> Script: Check out the repository and the script, run it
activate Script
alt wiki/.publish does not exist
Script --> Workflow: Log that publishing is not enabled and succeed\n(nothing is written)
else wiki/ has no Markdown pages
Script --> Workflow: Fail with [configuration]\n(an empty wiki/ never deletes pages)
else
Script -> Script: Read the marker (empty, or the word prune)\nand TOKEN_FOR_GITEA_WIKI
Script -> Wiki: GET repository (preflight)
Wiki --> Script: Wiki is enabled, token accepted
Script -> Wiki: GET pages
Wiki --> Script: Existing pages
Script -> Wiki: Create new pages, update changed pages
opt marker says prune
Script -> Wiki: Delete pages that are not in wiki/
end
Script --> Workflow: Log created, updated and deleted counts
end
deactivate Script
Workflow --> Trigger: Workflow result
deactivate Workflow
@enduml
```
### Kvalitetskontrol ### Kvalitetskontrol
Et genbrugeligt workflow til Python og shell, kaldt med `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (se [vejledningen](QualityChecksPythonShell)). Et genbrugeligt workflow til Python og shell, kaldt med `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (se [vejledningen](QualityChecksPythonShell)).
@@ -279,6 +235,50 @@ deactivate Workflow
@enduml @enduml
``` ```
### Kodemålinger og dækningsbadges
Et genbrugeligt workflow, der tæller kodefilerne og kodelinjerne (uden kommentar- og tomme linjer) i et repository og udgiver dem sammen med testdækningen som tre SVG-badges på en `badges`-gren, kaldt med `uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2` (ADR-0010). Det kræver `contents: write` og kører ingen test: et tidligere job hos kalderen frembringer en dækningsrapport i Cobertura XML-format og uploader den som artefakt ([vejledning](CodeMetrics.da)).
#### Workflow
```plantuml
@startuml
title Code metrics and coverage badges (reusable workflow)
autonumber
actor "Calling repository\nuses: ...code-metrics.yml@v2" as Caller
participant "Gitea Actions\ncode-metrics" as Workflow
participant "Branch badges\nof the caller" as Branch
Caller -> Workflow: workflow_call with working-directory, exclude,\ncoverage-report and thresholds
activate Workflow
Workflow -> Workflow: Check out the caller and the shared scripts
Workflow -> Workflow: Validate the inputs
alt an input is invalid
Workflow --> Caller: Fail with [configuration]
end
Workflow -> Workflow: Download the coverage artifact (when given)
Workflow -> Workflow: Count code files and lines of code
alt a coverage report is given but missing or malformed
Workflow --> Caller: Fail with [configuration] that names the file
else
Workflow -> Workflow: Write code-files.svg, code-lines.svg\nand coverage.svg
end
Workflow -> Branch: Compare with the files of the branch
alt no badge changed
Workflow --> Caller: Notice: nothing to commit, pass
else
Workflow -> Branch: One commit with [skip ci]
Workflow --> Caller: Badges published
end
deactivate Workflow
@enduml
```
### Udgivelse ### Udgivelse
Startes manuelt af en vedligeholder; med `dry_run` `true` (standard) kontrollerer det kun (se [udgivelsesprocessen](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)). Startes manuelt af en vedligeholder; med `dry_run` `true` (standard) kontrollerer det kun (se [udgivelsesprocessen](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)).
+46 -46
View File
@@ -13,7 +13,7 @@ A collection of reusable Gitea Actions workflows for DevOps professionals and so
This repository is the central collection of reusable automation for TirSystem repositories. The primary repository lives at `git.tirsystem.com` (Gitea) and is push-mirrored to GitHub. This repository is the central collection of reusable automation for TirSystem repositories. The primary repository lives at `git.tirsystem.com` (Gitea) and is push-mirrored to GitHub.
It contains ten workflows: metadata sync to the GitHub mirror, wiki publishing (scoped, and reusable for repositories that call it), shared quality checks for Python and shell, for C and C++ and for C#, a release workflow, the publishing of accepted milestones and the repository's own validation. They are listed with their purpose and a diagram under [Workflows](#workflows). It contains ten workflows: metadata sync to the GitHub mirror, wiki publishing (called by each repository), shared quality checks for Python and shell, for C and C++ and for C#, code metrics and coverage badges, a release workflow, the publishing of accepted milestones and the repository's own validation. They are listed with their purpose and a diagram under [Workflows](#workflows).
## Workflows ## Workflows
@@ -23,11 +23,11 @@ Ten workflows live in this repository. A **scoped** workflow is delivered by the
| Workflow | File | Kind | Starts on | Purpose | | Workflow | File | Kind | Starts on | Purpose |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push to `main`, manual, daily 03:17 UTC | Copies the description and topics of a Gitea repository to its GitHub push mirror | | Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push to `main`, manual, daily 03:17 UTC | Copies the description and topics of a Gitea repository to its GitHub push mirror |
| Publish wiki | [`publish-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/publish-wiki.yml) | Scoped, opt-in with `wiki/.publish`; deprecated, replaced by the reusable workflow below (ADR-0009) | push to `main` that changes `wiki/**`, manual | Publishes the pages in `wiki/` to the repository wiki |
| Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Reusable (`workflow_call`) | a call from another repository | Publishes the pages in `docs/wiki/` (or the folder named by `wiki_dir`) to the wiki of the calling repository | | Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Reusable (`workflow_call`) | a call from another repository | Publishes the pages in `docs/wiki/` (or the folder named by `wiki_dir`) to the wiki of the calling repository |
| Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Reusable (`workflow_call`) | a call from another repository | Runs ruff, mypy, shellcheck and shfmt on the tracked files and changes nothing | | Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Reusable (`workflow_call`) | a call from another repository | Runs ruff, mypy, shellcheck and shfmt on the tracked files and changes nothing |
| Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs clang-format and clang-tidy at exact versions on the tracked C and C++ files and changes nothing | | Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs clang-format and clang-tidy at exact versions on the tracked C and C++ files and changes nothing |
| Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs `dotnet format` and `dotnet build` on an exact .NET SDK 10 or later and changes nothing | | Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Reusable (`workflow_call`) | a call from another repository | Runs `dotnet format` and `dotnet build` on an exact .NET SDK 10 or later and changes nothing |
| Code metrics | [`code-metrics.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/code-metrics.yml) | Reusable (`workflow_call`) | a call from another repository | Counts the code files and the lines of code (without comment and blank lines), reads a Cobertura coverage report and commits three SVG badges to a `badges` branch |
| Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | This repository only | push to `main` that changes `docs/wiki/**`, manual | Calls the reusable Publish wiki pages workflow for the wiki of this repository | | Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | This repository only | push to `main` that changes `docs/wiki/**`, manual | Calls the reusable Publish wiki pages workflow for the wiki of this repository |
| Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | This repository only | manual | Creates the version tag, the release page and the major tag after the checks | | Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | This repository only | manual | Creates the version tag, the release page and the major tag after the checks |
| Publish accepted milestones | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | This repository only | push to `main` that changes `docs/milestones/**` or `docs/sqa/reviews/**`, manual (dry run by default) | Creates or updates the Gitea milestone and issues of every milestone that is Accepted with a Go review | | Publish accepted milestones | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | This repository only | push to `main` that changes `docs/milestones/**` or `docs/sqa/reviews/**`, manual (dry run by default) | Creates or updates the Gitea milestone and issues of every milestone that is Accepted with a Go review |
@@ -99,50 +99,6 @@ deactivate Workflow
@enduml @enduml
``` ```
### Publish wiki (scoped, deprecated)
Publishes `wiki/` to the repository wiki, only in a repository that has opted in with `wiki/.publish`. The word `prune` in that file also deletes pages that are not in `wiki/`.
#### Workflow
```plantuml
@startuml
title Publish wiki/ to the repository wiki
autonumber
actor "Push to main that changes wiki/**,\nor manual trigger" as Trigger
participant "Gitea Actions\npublish-wiki" as Workflow
participant "shared-scripts\n(tools/publish_wiki.py at v1)" as Script
participant "Gitea wiki API" as Wiki
Trigger -> Workflow: Start workflow
activate Workflow
Workflow -> Script: Check out the repository and the script, run it
activate Script
alt wiki/.publish does not exist
Script --> Workflow: Log that publishing is not enabled and succeed\n(nothing is written)
else wiki/ has no Markdown pages
Script --> Workflow: Fail with [configuration]\n(an empty wiki/ never deletes pages)
else
Script -> Script: Read the marker (empty, or the word prune)\nand TOKEN_FOR_GITEA_WIKI
Script -> Wiki: GET repository (preflight)
Wiki --> Script: Wiki is enabled, token accepted
Script -> Wiki: GET pages
Wiki --> Script: Existing pages
Script -> Wiki: Create new pages, update changed pages
opt marker says prune
Script -> Wiki: Delete pages that are not in wiki/
end
Script --> Workflow: Log created, updated and deleted counts
end
deactivate Script
Workflow --> Trigger: Workflow result
deactivate Workflow
@enduml
```
### Quality checks ### Quality checks
A reusable workflow for Python and shell, called with `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (see the [guide](QualityChecksPythonShell)). A reusable workflow for Python and shell, called with `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (see the [guide](QualityChecksPythonShell)).
@@ -279,6 +235,50 @@ deactivate Workflow
@enduml @enduml
``` ```
### Code metrics
A reusable workflow that counts the code files and the lines of code (without comment and blank lines) of a repository and publishes them, with the test coverage, as three SVG badges on a `badges` branch, called with `uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2` (ADR-0010). It needs `contents: write` and runs no test: an earlier job of the caller produces a Cobertura XML coverage report and uploads it as an artifact ([guide](CodeMetrics)).
#### Workflow
```plantuml
@startuml
title Code metrics and coverage badges (reusable workflow)
autonumber
actor "Calling repository\nuses: ...code-metrics.yml@v2" as Caller
participant "Gitea Actions\ncode-metrics" as Workflow
participant "Branch badges\nof the caller" as Branch
Caller -> Workflow: workflow_call with working-directory, exclude,\ncoverage-report and thresholds
activate Workflow
Workflow -> Workflow: Check out the caller and the shared scripts
Workflow -> Workflow: Validate the inputs
alt an input is invalid
Workflow --> Caller: Fail with [configuration]
end
Workflow -> Workflow: Download the coverage artifact (when given)
Workflow -> Workflow: Count code files and lines of code
alt a coverage report is given but missing or malformed
Workflow --> Caller: Fail with [configuration] that names the file
else
Workflow -> Workflow: Write code-files.svg, code-lines.svg\nand coverage.svg
end
Workflow -> Branch: Compare with the files of the branch
alt no badge changed
Workflow --> Caller: Notice: nothing to commit, pass
else
Workflow -> Branch: One commit with [skip ci]
Workflow --> Caller: Badges published
end
deactivate Workflow
@enduml
```
### Release ### Release
Started by hand by a maintainer; with `dry_run` `true` (the default) it only checks (see the [release process](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)). Started by hand by a maintainer; with `dry_run` `true` (the default) it only checks (see the [release process](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)).
+47 -47
View File
@@ -1,4 +1,4 @@
<!-- translation of Home.md, source sha256 b6796554f4eb --> <!-- translation of Home.md, source sha256 9b967f9e1aff -->
> Ini ialah terjemahan [`Home`](Home). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`Home`](Home). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -13,7 +13,7 @@ Koleksi aliran kerja (workflow) Gitea Actions yang boleh digunakan semula untuk
Repositori ini ialah koleksi pusat bagi automasi yang boleh digunakan semula untuk repositori TirSystem. Repositori utama berada di `git.tirsystem.com` (Gitea) dan dicerminkan dengan push ke GitHub. Repositori ini ialah koleksi pusat bagi automasi yang boleh digunakan semula untuk repositori TirSystem. Repositori utama berada di `git.tirsystem.com` (Gitea) dan dicerminkan dengan push ke GitHub.
Ia mengandungi sepuluh aliran kerja: penyegerakan metadata ke cermin GitHub, penerbitan wiki (scoped, dan boleh guna semula bagi repositori yang memanggilnya), semakan kualiti bersama untuk Python dan shell, untuk C dan C++ serta untuk C#, aliran kerja keluaran, penerbitan pencapaian (milestone) yang diterima dan pengesahan repositori sendiri. Ia disenaraikan dengan tujuan dan rajah di bawah [Aliran kerja](#aliran-kerja). Ia mengandungi sepuluh aliran kerja: penyegerakan metadata ke cermin GitHub, penerbitan wiki (dipanggil oleh setiap repositori), semakan kualiti bersama untuk Python dan shell, untuk C dan C++ serta untuk C#, metrik kod dan lencana liputan, aliran kerja keluaran, penerbitan pencapaian (milestone) yang diterima dan pengesahan repositori sendiri. Ia disenaraikan dengan tujuan dan rajah di bawah [Aliran kerja](#aliran-kerja).
## Aliran kerja ## Aliran kerja
@@ -23,11 +23,11 @@ Terdapat sepuluh aliran kerja dalam repositori ini. Aliran kerja **scoped** diha
| Aliran kerja | Fail | Jenis | Bermula apabila | Tujuan | | Aliran kerja | Fail | Jenis | Bermula apabila | Tujuan |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push ke `main`, manual, setiap hari 03:17 UTC | Menyalin penerangan dan topik repositori Gitea ke push mirror GitHub-nya | | Sync GitHub mirror metadata | [`sync-github-metadata.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/sync-github-metadata.yml) | Scoped | push ke `main`, manual, setiap hari 03:17 UTC | Menyalin penerangan dan topik repositori Gitea ke push mirror GitHub-nya |
| Publish wiki | [`publish-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/scoped_workflows/publish-wiki.yml) | Scoped, pilih menyertai dengan `wiki/.publish`; usang, sedang diganti oleh aliran kerja boleh guna semula di bawah (ADR-0009) | push ke `main` yang mengubah `wiki/**`, manual | Menerbitkan halaman dalam `wiki/` ke wiki repositori |
| Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menerbitkan halaman dalam `docs/wiki/` (atau folder yang dinamakan oleh `wiki_dir`) ke wiki repositori pemanggil | | Publish wiki pages | [`publish-wiki-pages.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-wiki-pages.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menerbitkan halaman dalam `docs/wiki/` (atau folder yang dinamakan oleh `wiki_dir`) ke wiki repositori pemanggil |
| Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan ruff, mypy, shellcheck dan shfmt pada fail yang dijejaki dan tidak mengubah apa-apa | | Quality checks | [`quality-checks.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan ruff, mypy, shellcheck dan shfmt pada fail yang dijejaki dan tidak mengubah apa-apa |
| Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan clang-format dan clang-tidy pada versi tepat pada fail C dan C++ yang dijejaki dan tidak mengubah apa-apa | | Quality checks C++ | [`quality-checks-cpp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-cpp.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan clang-format dan clang-tidy pada versi tepat pada fail C dan C++ yang dijejaki dan tidak mengubah apa-apa |
| Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan `dotnet format` dan `dotnet build` pada .NET SDK 10 atau lebih baharu yang tepat dan tidak mengubah apa-apa | | Quality checks C# | [`quality-checks-csharp.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/quality-checks-csharp.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Menjalankan `dotnet format` dan `dotnet build` pada .NET SDK 10 atau lebih baharu yang tepat dan tidak mengubah apa-apa |
| Code metrics | [`code-metrics.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/code-metrics.yml) | Boleh guna semula (`workflow_call`) | panggilan daripada repositori lain | Mengira fail kod dan baris kod (tanpa baris komen dan baris kosong), membaca laporan liputan Cobertura dan melakukan commit tiga lencana SVG ke cabang `badges` |
| Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | Repositori ini sahaja | push ke `main` yang mengubah `docs/wiki/**`, manual | Memanggil aliran kerja boleh guna semula Publish wiki pages untuk wiki repositori ini | | Publish own wiki | [`publish-own-wiki.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/publish-own-wiki.yml) | Repositori ini sahaja | push ke `main` yang mengubah `docs/wiki/**`, manual | Memanggil aliran kerja boleh guna semula Publish wiki pages untuk wiki repositori ini |
| Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | Repositori ini sahaja | manual | Mencipta tag versi, halaman keluaran dan tag major selepas semakan | | Release | [`release.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/release.yml) | Repositori ini sahaja | manual | Mencipta tag versi, halaman keluaran dan tag major selepas semakan |
| Menerbitkan milestone yang diterima | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | Repositori ini sahaja | push ke `main` yang mengubah `docs/milestones/**` atau `docs/sqa/reviews/**`, manual (larian percubaan secara lalai) | Mencipta atau mengemas kini milestone Gitea dan isu bagi setiap milestone yang Accepted dengan semakan Go | | Menerbitkan milestone yang diterima | [`sync-milestones.yml`](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/.gitea/workflows/sync-milestones.yml) | Repositori ini sahaja | push ke `main` yang mengubah `docs/milestones/**` atau `docs/sqa/reviews/**`, manual (larian percubaan secara lalai) | Mencipta atau mengemas kini milestone Gitea dan isu bagi setiap milestone yang Accepted dengan semakan Go |
@@ -99,50 +99,6 @@ deactivate Workflow
@enduml @enduml
``` ```
### Menerbitkan wiki (scoped, usang)
Menerbitkan `wiki/` ke wiki repositori, hanya dalam repositori yang telah menyertai dengan `wiki/.publish`. Perkataan `prune` dalam fail itu juga memadam halaman yang tiada dalam `wiki/`.
#### Aliran kerja
```plantuml
@startuml
title Publish wiki/ to the repository wiki
autonumber
actor "Push to main that changes wiki/**,\nor manual trigger" as Trigger
participant "Gitea Actions\npublish-wiki" as Workflow
participant "shared-scripts\n(tools/publish_wiki.py at v1)" as Script
participant "Gitea wiki API" as Wiki
Trigger -> Workflow: Start workflow
activate Workflow
Workflow -> Script: Check out the repository and the script, run it
activate Script
alt wiki/.publish does not exist
Script --> Workflow: Log that publishing is not enabled and succeed\n(nothing is written)
else wiki/ has no Markdown pages
Script --> Workflow: Fail with [configuration]\n(an empty wiki/ never deletes pages)
else
Script -> Script: Read the marker (empty, or the word prune)\nand TOKEN_FOR_GITEA_WIKI
Script -> Wiki: GET repository (preflight)
Wiki --> Script: Wiki is enabled, token accepted
Script -> Wiki: GET pages
Wiki --> Script: Existing pages
Script -> Wiki: Create new pages, update changed pages
opt marker says prune
Script -> Wiki: Delete pages that are not in wiki/
end
Script --> Workflow: Log created, updated and deleted counts
end
deactivate Script
Workflow --> Trigger: Workflow result
deactivate Workflow
@enduml
```
### Semakan kualiti ### Semakan kualiti
Aliran kerja boleh guna semula untuk Python dan shell, dipanggil dengan `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (lihat [panduan](QualityChecksPythonShell)). Aliran kerja boleh guna semula untuk Python dan shell, dipanggil dengan `uses: TirSystem/github-action/.gitea/workflows/quality-checks.yml@v1` (lihat [panduan](QualityChecksPythonShell)).
@@ -279,6 +235,50 @@ deactivate Workflow
@enduml @enduml
``` ```
### Metrik kod dan lencana liputan
Aliran kerja boleh guna semula yang mengira fail kod dan baris kod (tanpa baris komen dan baris kosong) sesebuah repositori dan menerbitkannya, bersama liputan ujian, sebagai tiga lencana SVG pada cabang `badges`, dipanggil dengan `uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2` (ADR-0010). Ia memerlukan `contents: write` dan tidak menjalankan sebarang ujian: kerja yang lebih awal oleh pemanggil menghasilkan laporan liputan format Cobertura XML dan memuat naiknya sebagai artifak ([panduan](CodeMetrics.ms)).
#### Aliran kerja
```plantuml
@startuml
title Code metrics and coverage badges (reusable workflow)
autonumber
actor "Calling repository\nuses: ...code-metrics.yml@v2" as Caller
participant "Gitea Actions\ncode-metrics" as Workflow
participant "Branch badges\nof the caller" as Branch
Caller -> Workflow: workflow_call with working-directory, exclude,\ncoverage-report and thresholds
activate Workflow
Workflow -> Workflow: Check out the caller and the shared scripts
Workflow -> Workflow: Validate the inputs
alt an input is invalid
Workflow --> Caller: Fail with [configuration]
end
Workflow -> Workflow: Download the coverage artifact (when given)
Workflow -> Workflow: Count code files and lines of code
alt a coverage report is given but missing or malformed
Workflow --> Caller: Fail with [configuration] that names the file
else
Workflow -> Workflow: Write code-files.svg, code-lines.svg\nand coverage.svg
end
Workflow -> Branch: Compare with the files of the branch
alt no badge changed
Workflow --> Caller: Notice: nothing to commit, pass
else
Workflow -> Branch: One commit with [skip ci]
Workflow --> Caller: Badges published
end
deactivate Workflow
@enduml
```
### Keluaran ### Keluaran
Dimulakan secara manual oleh penyelenggara; dengan `dry_run` `true` (lalai) ia hanya menyemak (lihat [proses keluaran](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)). Dimulakan secara manual oleh penyelenggara; dengan `dry_run` `true` (lalai) ia hanya menyemak (lihat [proses keluaran](https://git.tirsystem.com/TirSystem/github-action/src/branch/main/guides/release-process.md)).
+1 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Onboarding.md, source sha256 4de4897fb3b7 --> <!-- translation of Onboarding.md, source sha256 1bc66efd5874 -->
> Dette er en oversættelse af [`Onboarding`](Onboarding). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`Onboarding`](Onboarding). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -56,8 +56,6 @@ Det genbrugelige workflow **Publish wiki pages** kopierer Markdown-siderne i `do
4. Gem `TOKEN_FOR_GITEA_WIKI` som en secret i repositoryets organisation med det scope, der står i [credentials.md](Credentials.da). 4. Gem `TOKEN_FOR_GITEA_WIKI` som en secret i repositoryets organisation med det scope, der står i [credentials.md](Credentials.da).
5. Flet ændringen til `main`. Loggen skal slutte med `Published <n> page(s) to the wiki of <owner>/<repo>`. 5. Flet ændringen til `main`. Loggen skal slutte med `Published <n> page(s) to the wiki of <owner>/<repo>`.
Et repository, der stadig har markøren `wiki/.publish`, publiceres af det ældre scoped workflow, som fjernes, når alle repositories har et kald. Flyt siderne til `docs/wiki/` og tilføj kaldet, før det sker.
## Runners ## Runners
| Punkt | Værdi | | Punkt | Værdi |
-4
View File
@@ -85,10 +85,6 @@ The wiki has English and the product owner's language as a minimum.
5. Merge the change to `main`. The log must end with `Published <n> page(s) to 5. Merge the change to `main`. The log must end with `Published <n> page(s) to
the wiki of <owner>/<repo>`. the wiki of <owner>/<repo>`.
A repository that still has the marker `wiki/.publish` is published by the
older scoped workflow, which is removed once every repository has a call.
Move the pages to `docs/wiki/` and add the call before that.
## Runners ## Runners
| Item | Value | | Item | Value |
+1 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Onboarding.md, source sha256 4de4897fb3b7 --> <!-- translation of Onboarding.md, source sha256 1bc66efd5874 -->
> Ini ialah terjemahan [`Onboarding`](Onboarding). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`Onboarding`](Onboarding). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -56,8 +56,6 @@ Aliran kerja boleh guna semula **Publish wiki pages** menyalin halaman Markdown
4. Simpan `TOKEN_FOR_GITEA_WIKI` sebagai secret organisasi repositori, dengan skop yang tertera dalam [credentials.md](Credentials.ms). 4. Simpan `TOKEN_FOR_GITEA_WIKI` sebagai secret organisasi repositori, dengan skop yang tertera dalam [credentials.md](Credentials.ms).
5. Gabungkan perubahan ke `main`. Log mesti berakhir dengan `Published <n> page(s) to the wiki of <owner>/<repo>`. 5. Gabungkan perubahan ke `main`. Log mesti berakhir dengan `Published <n> page(s) to the wiki of <owner>/<repo>`.
Repositori yang masih mempunyai penanda `wiki/.publish` diterbitkan oleh aliran kerja scoped yang lebih lama, yang dibuang apabila setiap repositori mempunyai panggilan. Alihkan halaman ke `docs/wiki/` dan tambah panggilan sebelum itu.
## Runners ## Runners
| Perkara | Nilai | | Perkara | Nilai |
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksCSharp.md, source sha256 36e34031e0b9 --> <!-- translation of QualityChecksCSharp.md, source sha256 a024fde8d1b3 -->
> Dette er en oversættelse af [`QualityChecksCSharp`](QualityChecksCSharp). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`QualityChecksCSharp`](QualityChecksCSharp). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -32,7 +32,7 @@ jobs:
| `working-directory` | `.` | Mappe, relativt til repositoryets rod, hvis filer kontrolleres | | `working-directory` | `.` | Mappe, relativt til repositoryets rod, hvis filer kontrolleres |
| `project` | tom | Solution- eller projektfil, relativt til `working-directory`; tom bruger den eneste sporede `*.sln` eller `*.slnx`, ellers den eneste `*.csproj`, der er sporet dér | | `project` | tom | Solution- eller projektfil, relativt til `working-directory`; tom bruger den eneste sporede `*.sln` eller `*.slnx`, ellers den eneste `*.csproj`, der er sporet dér |
| `dotnet-sdk-version` | `10.0.401` | Præcis version af .NET SDK, 10 eller nyere; en kanal som `10.0`, et interval og en version under 10 afvises | | `dotnet-sdk-version` | `10.0.401` | Præcis version af .NET SDK, 10 eller nyere; en kanal som `10.0`, et interval og en version under 10 afvises |
| `tools-ref` | `v1` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks-csharp.sh` hentes | | `tools-ref` | `v2` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks-csharp.sh` hentes |
Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag, aldrig ved `main`. Et kald ved et præcist tag er kun fuldt fastlåst, når `tools-ref` angiver samme tag. Se opgraderingsvejledningen. SDK-versionen er præcis: at hæve standardværdien er en ny udgivelse af dette repository, ikke en stille ændring. Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag, aldrig ved `main`. Et kald ved et præcist tag er kun fuldt fastlåst, når `tools-ref` angiver samme tag. Se opgraderingsvejledningen. SDK-versionen er præcis: at hæve standardværdien er en ny udgivelse af dette repository, ikke en stille ændring.
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
| `working-directory` | `.` | Directory, relative to the repository root, whose files are checked | | `working-directory` | `.` | Directory, relative to the repository root, whose files are checked |
| `project` | empty | Solution or project file, relative to `working-directory`; empty uses the single `*.sln` or `*.slnx`, else the single `*.csproj`, that is tracked there | | `project` | empty | Solution or project file, relative to `working-directory`; empty uses the single `*.sln` or `*.slnx`, else the single `*.csproj`, that is tracked there |
| `dotnet-sdk-version` | `10.0.401` | Exact version of the .NET SDK, 10 or later; a channel such as `10.0`, a range and a version below 10 are refused | | `dotnet-sdk-version` | `10.0.401` | Exact version of the .NET SDK, 10 or later; a channel such as `10.0`, a range and a version below 10 are refused |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-csharp.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-csharp.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag, never at Reference the workflow at the major tag (`@v1`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names `main`. A call at an exact tag is pinned completely only when `tools-ref` names
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksCSharp.md, source sha256 36e34031e0b9 --> <!-- translation of QualityChecksCSharp.md, source sha256 a024fde8d1b3 -->
> Ini ialah terjemahan [`QualityChecksCSharp`](QualityChecksCSharp). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`QualityChecksCSharp`](QualityChecksCSharp). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -32,7 +32,7 @@ jobs:
| `working-directory` | `.` | Direktori, relatif kepada akar repositori, yang failnya disemak | | `working-directory` | `.` | Direktori, relatif kepada akar repositori, yang failnya disemak |
| `project` | kosong | Fail solution atau projek, relatif kepada `working-directory`; kosong menggunakan satu-satunya `*.sln` atau `*.slnx` yang dijejaki, jika tiada maka satu-satunya `*.csproj` yang dijejaki di situ | | `project` | kosong | Fail solution atau projek, relatif kepada `working-directory`; kosong menggunakan satu-satunya `*.sln` atau `*.slnx` yang dijejaki, jika tiada maka satu-satunya `*.csproj` yang dijejaki di situ |
| `dotnet-sdk-version` | `10.0.401` | Versi tepat .NET SDK, 10 atau lebih baharu; saluran seperti `10.0`, julat dan versi di bawah 10 ditolak | | `dotnet-sdk-version` | `10.0.401` | Versi tepat .NET SDK, 10 atau lebih baharu; saluran seperti `10.0`, julat dan versi di bawah 10 ditolak |
| `tools-ref` | `v1` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks-csharp.sh` diambil | | `tools-ref` | `v2` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks-csharp.sh` diambil |
Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat, jangan sekali-kali pada `main`. Panggilan pada tag tepat hanya disematkan sepenuhnya apabila `tools-ref` menamakan tag yang sama. Lihat panduan naik taraf. Versi SDK adalah tepat: menaikkan nilai lalai ialah keluaran baharu repositori ini, bukan perubahan senyap. Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat, jangan sekali-kali pada `main`. Panggilan pada tag tepat hanya disematkan sepenuhnya apabila `tools-ref` menamakan tag yang sama. Lihat panduan naik taraf. Versi SDK adalah tepat: menaikkan nilai lalai ialah keluaran baharu repositori ini, bukan perubahan senyap.
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksCpp.md, source sha256 6faa57183a11 --> <!-- translation of QualityChecksCpp.md, source sha256 29d1e1390494 -->
> Dette er en oversættelse af [`QualityChecksCpp`](QualityChecksCpp). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`QualityChecksCpp`](QualityChecksCpp). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -34,7 +34,7 @@ jobs:
| `compile-commands-dir` | tom | Mappe, relativt til repositoryets rod, med en `compile_commands.json`, som din pipeline har bygget før kaldet; når den er sat, bruger clang-tidy den og ignorerer `std` | | `compile-commands-dir` | tom | Mappe, relativt til repositoryets rod, med en `compile_commands.json`, som din pipeline har bygget før kaldet; når den er sat, bruger clang-tidy den og ignorerer `std` |
| `clang-format-version` | `23.1.3` | Præcis version af pakken clang-format | | `clang-format-version` | `23.1.3` | Præcis version af pakken clang-format |
| `clang-tidy-version` | `22.1.8` | Præcis version af pakken clang-tidy | | `clang-tidy-version` | `22.1.8` | Præcis version af pakken clang-tidy |
| `tools-ref` | `v1` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks-cpp.sh` hentes | | `tools-ref` | `v2` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks-cpp.sh` hentes |
Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag, aldrig ved `main`. Et kald ved et præcist tag er kun fuldt fastlåst, når `tools-ref` angiver samme tag. Se opgraderingsvejledningen. Værktøjsversionerne er præcise: en nyere version af et værktøj er en ny udgivelse af dette repository, ikke en stille ændring. Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag, aldrig ved `main`. Et kald ved et præcist tag er kun fuldt fastlåst, når `tools-ref` angiver samme tag. Se opgraderingsvejledningen. Værktøjsversionerne er præcise: en nyere version af et værktøj er en ny udgivelse af dette repository, ikke en stille ændring.
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
| `compile-commands-dir` | empty | Directory, relative to the repository root, with a `compile_commands.json` that your pipeline built before the call; when set, clang-tidy uses it and ignores `std` | | `compile-commands-dir` | empty | Directory, relative to the repository root, with a `compile_commands.json` that your pipeline built before the call; when set, clang-tidy uses it and ignores `std` |
| `clang-format-version` | `23.1.3` | Exact version of the clang-format package | | `clang-format-version` | `23.1.3` | Exact version of the clang-format package |
| `clang-tidy-version` | `22.1.8` | Exact version of the clang-tidy package | | `clang-tidy-version` | `22.1.8` | Exact version of the clang-tidy package |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-cpp.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-cpp.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag, never at Reference the workflow at the major tag (`@v1`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names `main`. A call at an exact tag is pinned completely only when `tools-ref` names
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksCpp.md, source sha256 6faa57183a11 --> <!-- translation of QualityChecksCpp.md, source sha256 29d1e1390494 -->
> Ini ialah terjemahan [`QualityChecksCpp`](QualityChecksCpp). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`QualityChecksCpp`](QualityChecksCpp). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -34,7 +34,7 @@ jobs:
| `compile-commands-dir` | kosong | Direktori, relatif kepada akar repositori, dengan `compile_commands.json` yang dibina oleh saluran paip anda sebelum panggilan; apabila ditetapkan, clang-tidy menggunakannya dan mengabaikan `std` | | `compile-commands-dir` | kosong | Direktori, relatif kepada akar repositori, dengan `compile_commands.json` yang dibina oleh saluran paip anda sebelum panggilan; apabila ditetapkan, clang-tidy menggunakannya dan mengabaikan `std` |
| `clang-format-version` | `23.1.3` | Versi tepat pakej clang-format | | `clang-format-version` | `23.1.3` | Versi tepat pakej clang-format |
| `clang-tidy-version` | `22.1.8` | Versi tepat pakej clang-tidy | | `clang-tidy-version` | `22.1.8` | Versi tepat pakej clang-tidy |
| `tools-ref` | `v1` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks-cpp.sh` diambil | | `tools-ref` | `v2` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks-cpp.sh` diambil |
Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat, jangan sekali-kali pada `main`. Panggilan pada tag tepat hanya disematkan sepenuhnya apabila `tools-ref` menamakan tag yang sama. Lihat panduan naik taraf. Versi alat adalah tepat: versi alat yang lebih baharu ialah keluaran baharu repositori ini, bukan perubahan senyap. Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat, jangan sekali-kali pada `main`. Panggilan pada tag tepat hanya disematkan sepenuhnya apabila `tools-ref` menamakan tag yang sama. Lihat panduan naik taraf. Versi alat adalah tepat: versi alat yang lebih baharu ialah keluaran baharu repositori ini, bukan perubahan senyap.
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksPythonShell.md, source sha256 2a0c9d43c77d --> <!-- translation of QualityChecksPythonShell.md, source sha256 ef64b44b88ad -->
> Dette er en oversættelse af [`QualityChecksPythonShell`](QualityChecksPythonShell). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`QualityChecksPythonShell`](QualityChecksPythonShell). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -35,7 +35,7 @@ jobs:
| `mypy-version` | `1.11.2` | Version af mypy | | `mypy-version` | `1.11.2` | Version af mypy |
| `shellcheck-py-version` | `0.10.0.1` | Version af pakken shellcheck-py (ShellCheck 0.10.0) | | `shellcheck-py-version` | `0.10.0.1` | Version af pakken shellcheck-py (ShellCheck 0.10.0) |
| `shfmt-py-version` | `3.11.0.2` | Version af pakken shfmt-py (shfmt 3.11.0) | | `shfmt-py-version` | `3.11.0.2` | Version af pakken shfmt-py (shfmt 3.11.0) |
| `tools-ref` | `v1` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks.sh` hentes | | `tools-ref` | `v2` | Tag eller gren i `TirSystem/github-action`, hvorfra scriptet `tools/quality-checks.sh` hentes |
Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag (`@v1.0.0`), aldrig ved `main` og aldrig ved en pull requests gren: den gren slettes, når pull requesten flettes, og henvisningen holder op med at virke. Se opgraderingsvejledningen for, hvad hvert valg modtager. Henvis til workflowet ved major-tagget (`@v1`) eller et præcist tag (`@v1.0.0`), aldrig ved `main` og aldrig ved en pull requests gren: den gren slettes, når pull requesten flettes, og henvisningen holder op med at virke. Se opgraderingsvejledningen for, hvad hvert valg modtager.
+1 -1
View File
@@ -38,7 +38,7 @@ jobs:
| `mypy-version` | `1.11.2` | Version of mypy | | `mypy-version` | `1.11.2` | Version of mypy |
| `shellcheck-py-version` | `0.10.0.1` | Version of the shellcheck-py package (ShellCheck 0.10.0) | | `shellcheck-py-version` | `0.10.0.1` | Version of the shellcheck-py package (ShellCheck 0.10.0) |
| `shfmt-py-version` | `3.11.0.2` | Version of the shfmt-py package (shfmt 3.11.0) | | `shfmt-py-version` | `3.11.0.2` | Version of the shfmt-py package (shfmt 3.11.0) |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag Reference the workflow at the major tag (`@v1`) or at an exact tag
(`@v1.0.0`), never at `main` and never at the branch of a pull request: that (`@v1.0.0`), never at `main` and never at the branch of a pull request: that
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- translation of QualityChecksPythonShell.md, source sha256 2a0c9d43c77d --> <!-- translation of QualityChecksPythonShell.md, source sha256 ef64b44b88ad -->
> Ini ialah terjemahan [`QualityChecksPythonShell`](QualityChecksPythonShell). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`QualityChecksPythonShell`](QualityChecksPythonShell). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -35,7 +35,7 @@ jobs:
| `mypy-version` | `1.11.2` | Versi mypy | | `mypy-version` | `1.11.2` | Versi mypy |
| `shellcheck-py-version` | `0.10.0.1` | Versi pakej shellcheck-py (ShellCheck 0.10.0) | | `shellcheck-py-version` | `0.10.0.1` | Versi pakej shellcheck-py (ShellCheck 0.10.0) |
| `shfmt-py-version` | `3.11.0.2` | Versi pakej shfmt-py (shfmt 3.11.0) | | `shfmt-py-version` | `3.11.0.2` | Versi pakej shfmt-py (shfmt 3.11.0) |
| `tools-ref` | `v1` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks.sh` diambil | | `tools-ref` | `v2` | Tag atau cabang `TirSystem/github-action` tempat skrip `tools/quality-checks.sh` diambil |
Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat (`@v1.0.0`), jangan sekali-kali pada `main` dan jangan pada cabang pull request: cabang itu dipadam apabila pull request digabungkan dan rujukan itu berhenti berfungsi. Lihat panduan naik taraf untuk apa yang diterima oleh setiap pilihan. Rujuk aliran kerja pada tag major (`@v1`) atau pada tag tepat (`@v1.0.0`), jangan sekali-kali pada `main` dan jangan pada cabang pull request: cabang itu dipadam apabila pull request digabungkan dan rujukan itu berhenti berfungsi. Lihat panduan naik taraf untuk apa yang diterima oleh setiap pilihan.
+2 -5
View File
@@ -1,4 +1,4 @@
<!-- translation of Troubleshooting.md, source sha256 c68827295812 --> <!-- translation of Troubleshooting.md, source sha256 cad6363616e8 -->
> Dette er en oversættelse af [`Troubleshooting`](Troubleshooting). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`Troubleshooting`](Troubleshooting). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -31,7 +31,6 @@ Kategorien fortæller, hvor du skal kigge. En fejl uden for scriptet (jobbet sta
| `Could not determine the Gitea source repository.` | configuration | Kørslen har intet repositorynavn; meld det som en defekt | | `Could not determine the Gitea source repository.` | configuration | Kørslen har intet repositorynavn; meld det som en defekt |
| `Expected at most one GitHub push mirror ... found N` | configuration | Behold ét GitHub push-spejl | | `Expected at most one GitHub push mirror ... found N` | configuration | Behold ét GitHub push-spejl |
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Kun wiki-publicering: repositoryet kalder workflowet, men dets organisation har ingen sådan secret, eller kaldet sender den ikke; gem den og send den i `secrets:` (se [credentials.md](Credentials.da)) | | `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Kun wiki-publicering: repositoryet kalder workflowet, men dets organisation har ingen sådan secret, eller kaldet sender den ikke; gem den og send den i `secrets:` (se [credentials.md](Credentials.da)) |
| `wiki/.publish may only be empty or contain the word 'prune'.` | configuration | Kun wiki-publicering gennem det ældre scoped workflow: lad markøren være tom, eller skriv kun ordet `prune` i den |
| `The prune input must be 'true' or 'false'` | configuration | Kun wiki-publicering: sæt `prune` i kaldet til `"true"` eller `"false"` | | `The prune input must be 'true' or 'false'` | configuration | Kun wiki-publicering: sæt `prune` i kaldet til `"true"` eller `"false"` |
| `The wiki folder ... does not exist` | configuration | Kun wiki-publicering: sæt `wiki_dir` i kaldet til mappen med siderne (standard `docs/wiki`) | | `The wiki folder ... does not exist` | configuration | Kun wiki-publicering: sæt `wiki_dir` i kaldet til mappen med siderne (standard `docs/wiki`) |
| `... HTTP 403 ...` ved publicering af wikien | permissions | Kun wiki-publicering: tokenet skal have `write:repository` og skriveadgang til dette repository | | `... HTTP 403 ...` ved publicering af wikien | permissions | Kun wiki-publicering: tokenet skal have `write:repository` og skriveadgang til dette repository |
@@ -53,9 +52,7 @@ Kategorien fortæller, hvor du skal kigge. En fejl uden for scriptet (jobbet sta
`WARNING: Gitea returned an invalid push mirror list; GitHub metadata was not synced.` Kørslen lykkes, men intet blev synkroniseret. Kontroller, at Gitea-versionen understøtter push mirror-API'et, og kør igen. `WARNING: Gitea returned an invalid push mirror list; GitHub metadata was not synced.` Kørslen lykkes, men intet blev synkroniseret. Kontroller, at Gitea-versionen understøtter push mirror-API'et, og kør igen.
`No wiki/.publish marker in <owner>/<repo>; wiki publishing is not enabled for this repository.` Kørslen af det ældre scoped Publish wiki lykkes og skriver intet. Repositoryet har ikke meldt sig til; kald det genbrugelige workflow **Publish wiki pages** (se [onboarding.md](Onboarding.da)), hvis det skal publicere. `<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune input to true to delete them.` Kørslen lykkes. Sider, der kun findes i wikien, lades i fred, medmindre kaldet sætter `prune: "true"`.
`<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune input to true to delete them.` Kørslen lykkes. Sider, der kun findes i wikien, lades i fred, medmindre kaldet sætter `prune: "true"` (med det ældre scoped workflow: ordet `prune` i `wiki/.publish`).
## Runner-problemer ## Runner-problemer
+1 -8
View File
@@ -33,7 +33,6 @@ never starts, or stops before the step) is a **runner** problem.
| `Could not determine the Gitea source repository.` | configuration | The run has no repository name; report as a defect | | `Could not determine the Gitea source repository.` | configuration | The run has no repository name; report as a defect |
| `Expected at most one GitHub push mirror ... found N` | configuration | Keep one GitHub push mirror | | `Expected at most one GitHub push mirror ... found N` | configuration | Keep one GitHub push mirror |
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: the repository calls the workflow but its organization has no such secret, or the call does not pass it; store it and pass it in `secrets:` (see [credentials.md](Credentials)) | | `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: the repository calls the workflow but its organization has no such secret, or the call does not pass it; store it and pass it in `secrets:` (see [credentials.md](Credentials)) |
| `wiki/.publish may only be empty or contain the word 'prune'.` | configuration | Wiki publishing through the older scoped workflow only: leave the marker empty, or put only the word `prune` in it |
| `The prune input must be 'true' or 'false'` | configuration | Wiki publishing only: set `prune` in the call to `"true"` or `"false"` | | `The prune input must be 'true' or 'false'` | configuration | Wiki publishing only: set `prune` in the call to `"true"` or `"false"` |
| `The wiki folder ... does not exist` | configuration | Wiki publishing only: set `wiki_dir` in the call to the folder with the pages (default `docs/wiki`) | | `The wiki folder ... does not exist` | configuration | Wiki publishing only: set `wiki_dir` in the call to the folder with the pages (default `docs/wiki`) |
| `... HTTP 403 ...` while publishing the wiki | permissions | Wiki publishing only: the token needs `write:repository` and write access to this repository | | `... HTTP 403 ...` while publishing the wiki | permissions | Wiki publishing only: the token needs `write:repository` and write access to this repository |
@@ -60,15 +59,9 @@ settings.
synced.` The run succeeds but nothing was synced. Check that the Gitea synced.` The run succeeds but nothing was synced. Check that the Gitea
version supports the push mirror API and re-run. version supports the push mirror API and re-run.
`No wiki/.publish marker in <owner>/<repo>; wiki publishing is not enabled for
this repository.` The older scoped Publish wiki run succeeds and writes
nothing. The repository has not opted in; call the reusable workflow
**Publish wiki pages** (see [onboarding.md](Onboarding)) if it should publish.
`<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune `<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune
input to true to delete them.` The run succeeds. Pages that exist only in the input to true to delete them.` The run succeeds. Pages that exist only in the
wiki are left alone unless the call sets `prune: "true"` (with the older scoped wiki are left alone unless the call sets `prune: "true"`.
workflow: the word `prune` in `wiki/.publish`).
## Runner problems ## Runner problems
+2 -5
View File
@@ -1,4 +1,4 @@
<!-- translation of Troubleshooting.md, source sha256 c68827295812 --> <!-- translation of Troubleshooting.md, source sha256 cad6363616e8 -->
> Ini ialah terjemahan [`Troubleshooting`](Troubleshooting). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`Troubleshooting`](Troubleshooting). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -31,7 +31,6 @@ Kategori menunjukkan di mana perlu dilihat. Kegagalan di luar skrip (kerja tidak
| `Could not determine the Gitea source repository.` | configuration | Larian tiada nama repositori; laporkan sebagai kecacatan | | `Could not determine the Gitea source repository.` | configuration | Larian tiada nama repositori; laporkan sebagai kecacatan |
| `Expected at most one GitHub push mirror ... found N` | configuration | Kekalkan satu push mirror GitHub | | `Expected at most one GitHub push mirror ... found N` | configuration | Kekalkan satu push mirror GitHub |
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Penerbitan wiki sahaja: repositori memanggil aliran kerja tetapi organisasinya tiada secret itu, atau panggilan tidak menghantarnya; simpannya dan hantar dalam `secrets:` (lihat [credentials.md](Credentials.ms)) | | `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Penerbitan wiki sahaja: repositori memanggil aliran kerja tetapi organisasinya tiada secret itu, atau panggilan tidak menghantarnya; simpannya dan hantar dalam `secrets:` (lihat [credentials.md](Credentials.ms)) |
| `wiki/.publish may only be empty or contain the word 'prune'.` | configuration | Penerbitan wiki melalui aliran kerja scoped yang lebih lama sahaja: biarkan penanda kosong, atau letakkan hanya perkataan `prune` di dalamnya |
| `The prune input must be 'true' or 'false'` | configuration | Penerbitan wiki sahaja: tetapkan `prune` dalam panggilan kepada `"true"` atau `"false"` | | `The prune input must be 'true' or 'false'` | configuration | Penerbitan wiki sahaja: tetapkan `prune` dalam panggilan kepada `"true"` atau `"false"` |
| `The wiki folder ... does not exist` | configuration | Penerbitan wiki sahaja: tetapkan `wiki_dir` dalam panggilan kepada folder yang mengandungi halaman (lalai `docs/wiki`) | | `The wiki folder ... does not exist` | configuration | Penerbitan wiki sahaja: tetapkan `wiki_dir` dalam panggilan kepada folder yang mengandungi halaman (lalai `docs/wiki`) |
| `... HTTP 403 ...` semasa menerbitkan wiki | permissions | Penerbitan wiki sahaja: token memerlukan `write:repository` dan akses tulis kepada repositori ini | | `... HTTP 403 ...` semasa menerbitkan wiki | permissions | Penerbitan wiki sahaja: token memerlukan `write:repository` dan akses tulis kepada repositori ini |
@@ -53,9 +52,7 @@ Kategori menunjukkan di mana perlu dilihat. Kegagalan di luar skrip (kerja tidak
`WARNING: Gitea returned an invalid push mirror list; GitHub metadata was not synced.` Larian berjaya tetapi tiada apa-apa disegerakkan. Semak bahawa versi Gitea menyokong API push mirror dan jalankan semula. `WARNING: Gitea returned an invalid push mirror list; GitHub metadata was not synced.` Larian berjaya tetapi tiada apa-apa disegerakkan. Semak bahawa versi Gitea menyokong API push mirror dan jalankan semula.
`No wiki/.publish marker in <owner>/<repo>; wiki publishing is not enabled for this repository.` Larian Publish wiki scoped yang lebih lama berjaya dan tidak menulis apa-apa. Repositori belum memilih menyertainya; panggil aliran kerja boleh guna semula **Publish wiki pages** (lihat [onboarding.md](Onboarding.ms)) jika ia sepatutnya menerbitkan. `<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune input to true to delete them.` Larian berjaya. Halaman yang hanya ada dalam wiki dibiarkan melainkan panggilan menetapkan `prune: "true"`.
`<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune input to true to delete them.` Larian berjaya. Halaman yang hanya ada dalam wiki dibiarkan melainkan panggilan menetapkan `prune: "true"` (dengan aliran kerja scoped yang lebih lama: perkataan `prune` dalam `wiki/.publish`).
## Masalah runner ## Masalah runner
+3 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Upgrading.md, source sha256 7fba937279b1 --> <!-- translation of Upgrading.md, source sha256 29086c9fa3a7 -->
> Dette er en oversættelse af [`Upgrading`](Upgrading). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres. > Dette er en oversættelse af [`Upgrading`](Upgrading). Den engelske side er autoritativ, og ændringer her bliver overskrevet, næste gang wikien publiceres.
@@ -18,9 +18,9 @@ Sådan tager en softwareudvikler en ny udgivelse af de fælles workflows i brug
En udgivelse, der bryder kompatibiliteten, får en ny major-version (`v2`), så en pipeline på `@v1` aldrig modtager den, før du selv ændrer linjen. En udgivelse, der bryder kompatibiliteten, får en ny major-version (`v2`), så en pipeline på `@v1` aldrig modtager den, før du selv ændrer linjen.
Kvalitetskontrol-workflowene (`quality-checks.yml`, `quality-checks-cpp.yml` og `quality-checks-csharp.yml`) henter deres script ved deres input `tools-ref`, som som standard er `v1`. For at fastlåse et helt skal du kalde det ved et præcist tag og sætte `tools-ref` til samme tag; ellers følger scriptet major-tagget. Kvalitetskontrol-workflowene (`quality-checks.yml`, `quality-checks-cpp.yml` og `quality-checks-csharp.yml`) og kodemålings-workflowet (`code-metrics.yml`) henter deres scripts ved deres input `tools-ref`, som som standard er det aktuelle major-tag (`v2`). For at fastlåse et helt skal du kalde det ved et præcist tag og sætte `tools-ref` til samme tag; ellers følger scriptet major-tagget.
De to scoped workflows (**Sync GitHub mirror metadata** og **Publish wiki**) leveres af instansen og står ikke i dine `uses:`-linjer; du kan ikke fastlåse dem, men de henter deres scripts ved major-tagget. Det scoped workflow **Sync GitHub mirror metadata** leveres af instansen og står ikke i dine `uses:`-linjer; du kan ikke fastlåse det, men det henter sit script ved major-tagget. Publicering af wiki er et genbrugeligt workflow, du kalder (`publish-wiki-pages.yml`); det scoped workflow **Publish wiki** og dets markør `wiki/.publish` blev fjernet i 2.0.0, så et repository, der stadig har markøren, publicerer ikke mere, før det kalder det genbrugelige workflow (se introduktionsguiden).
## Aflæsning af en changelog-post ## Aflæsning af en changelog-post
+9 -5
View File
@@ -23,13 +23,17 @@ A breaking release gets a new major version (`v2`), so a pipeline on `@v1`
never receives it until you change the line yourself. never receives it until you change the line yourself.
The quality-checks workflows (`quality-checks.yml`, `quality-checks-cpp.yml` and The quality-checks workflows (`quality-checks.yml`, `quality-checks-cpp.yml` and
`quality-checks-csharp.yml`) fetch their script at their input `tools-ref`, which `quality-checks-csharp.yml`) and the code-metrics workflow (`code-metrics.yml`)
defaults to `v1`. To pin one completely, call it at an exact tag and set fetch their scripts at their input `tools-ref`, which defaults to the current major tag (`v2`). To pin one completely, call it at an exact tag and set
`tools-ref` to the same tag; otherwise the script follows the major tag. `tools-ref` to the same tag; otherwise the script follows the major tag.
The two scoped workflows (**Sync GitHub mirror metadata** and **Publish The scoped workflow **Sync GitHub mirror metadata** is delivered by the
wiki**) are delivered by the instance and are not in your `uses:` lines; you instance and is not in your `uses:` lines; you cannot pin it, but it fetches its
cannot pin them, but they fetch their scripts at the major tag. script at the major tag. Wiki publishing is a reusable workflow you call
(`publish-wiki-pages.yml`); the scoped **Publish wiki** workflow and its
`wiki/.publish` marker were removed in 2.0.0, so a repository that still has the
marker no longer publishes until it calls the reusable workflow (see the
onboarding guide).
## Reading a changelog entry ## Reading a changelog entry
+3 -3
View File
@@ -1,4 +1,4 @@
<!-- translation of Upgrading.md, source sha256 7fba937279b1 --> <!-- translation of Upgrading.md, source sha256 29086c9fa3a7 -->
> Ini ialah terjemahan [`Upgrading`](Upgrading). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya. > Ini ialah terjemahan [`Upgrading`](Upgrading). Halaman bahasa Inggeris ialah teks yang sah, dan perubahan di sini akan ditimpa pada penerbitan wiki yang seterusnya.
@@ -18,9 +18,9 @@ Cara seorang jurutera perisian menerima keluaran baharu aliran kerja bersama den
Keluaran yang memecahkan keserasian mendapat versi major baharu (`v2`), jadi saluran paip pada `@v1` tidak menerimanya sehingga anda sendiri menukar baris itu. Keluaran yang memecahkan keserasian mendapat versi major baharu (`v2`), jadi saluran paip pada `@v1` tidak menerimanya sehingga anda sendiri menukar baris itu.
Aliran kerja semakan kualiti (`quality-checks.yml`, `quality-checks-cpp.yml` dan `quality-checks-csharp.yml`) mengambil skripnya pada inputnya `tools-ref`, yang lalai ialah `v1`. Untuk menyematkan satu sepenuhnya, panggil pada tag tepat dan tetapkan `tools-ref` kepada tag yang sama; jika tidak, skrip mengikuti tag major. Aliran kerja semakan kualiti (`quality-checks.yml`, `quality-checks-cpp.yml` dan `quality-checks-csharp.yml`) dan aliran kerja metrik kod (`code-metrics.yml`) mengambil skripnya pada inputnya `tools-ref`, yang lalai ialah tag major semasa (`v2`). Untuk menyematkan satu sepenuhnya, panggil pada tag tepat dan tetapkan `tools-ref` kepada tag yang sama; jika tidak, skrip mengikuti tag major.
Dua aliran kerja scoped (**Sync GitHub mirror metadata** dan **Publish wiki**) dihantar oleh instans dan tidak terdapat dalam baris `uses:` anda; anda tidak boleh menyematkannya, tetapi ia mengambil skripnya pada tag major. Aliran kerja scoped **Sync GitHub mirror metadata** dihantar oleh instans dan tidak terdapat dalam baris `uses:` anda; anda tidak boleh menyematkannya, tetapi ia mengambil skripnya pada tag major. Penerbitan wiki ialah aliran kerja boleh guna semula yang anda panggil (`publish-wiki-pages.yml`); aliran kerja scoped **Publish wiki** dan penanda `wiki/.publish` telah dibuang dalam 2.0.0, jadi repositori yang masih mempunyai penanda itu tidak lagi menerbitkan sehingga ia memanggil aliran kerja boleh guna semula (lihat panduan permulaan).
## Membaca satu catatan changelog ## Membaca satu catatan changelog
+3
View File
@@ -11,6 +11,7 @@
- [Quality checks (Python, shell)](QualityChecksPythonShell) - [Quality checks (Python, shell)](QualityChecksPythonShell)
- [Quality checks (C and C++)](QualityChecksCpp) - [Quality checks (C and C++)](QualityChecksCpp)
- [Quality checks (C#)](QualityChecksCSharp) - [Quality checks (C#)](QualityChecksCSharp)
- [Code metrics](CodeMetrics)
- [Upgrading](Upgrading) - [Upgrading](Upgrading)
- [Capabilities](Capabilities) - [Capabilities](Capabilities)
@@ -23,6 +24,7 @@
- [Kvalitetskontrol (Python, shell)](QualityChecksPythonShell.da) - [Kvalitetskontrol (Python, shell)](QualityChecksPythonShell.da)
- [Kvalitetskontrol (C og C++)](QualityChecksCpp.da) - [Kvalitetskontrol (C og C++)](QualityChecksCpp.da)
- [Kvalitetskontrol (C#)](QualityChecksCSharp.da) - [Kvalitetskontrol (C#)](QualityChecksCSharp.da)
- [Kodemålinger](CodeMetrics.da)
- [Opgradering](Upgrading.da) - [Opgradering](Upgrading.da)
- [Kapabiliteter](Capabilities.da) - [Kapabiliteter](Capabilities.da)
@@ -35,5 +37,6 @@
- [Semakan kualiti (Python, shell)](QualityChecksPythonShell.ms) - [Semakan kualiti (Python, shell)](QualityChecksPythonShell.ms)
- [Semakan kualiti (C dan C++)](QualityChecksCpp.ms) - [Semakan kualiti (C dan C++)](QualityChecksCpp.ms)
- [Semakan kualiti (C#)](QualityChecksCSharp.ms) - [Semakan kualiti (C#)](QualityChecksCSharp.ms)
- [Metrik kod](CodeMetrics.ms)
- [Menaik taraf](Upgrading.ms) - [Menaik taraf](Upgrading.ms)
- [Keupayaan](Capabilities.ms) - [Keupayaan](Capabilities.ms)
+117
View File
@@ -0,0 +1,117 @@
# Showing code metrics and coverage badges
How a software engineer calls the shared code-metrics workflow and shows its
three badges (code files, lines of code and coverage) in a README. The workflow
counts the code of the repository, reads a coverage report that the caller
supplies and commits three SVG files to a `badges` branch. It runs no test and
needs no secret. Its contract is ADR-0010 in this repository.
## Calling the workflow
The workflow cannot see the files of your test job, so the tests run in a job of
your own, upload the Cobertura XML report as an artifact, and the metrics job
runs after it:
```yaml
name: Code metrics
on:
push:
branches: [ main ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- run: python3 -m pip install pytest pytest-cov && python3 -m pytest --cov --cov-report=xml
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage
path: coverage.xml
metrics:
needs: tests
permissions:
contents: write
uses: TirSystem/github-action/.gitea/workflows/code-metrics.yml@v2
with:
coverage-artifact: coverage
coverage-report: coverage.xml
```
| Input | Default | Meaning |
| --- | --- | --- |
| `working-directory` | `.` | Directory, relative to the repository root, whose code is counted |
| `exclude` | empty | Comma list of patterns of files and directories that are not counted, in addition to the defaults; a pattern without `/` matches a name anywhere, a pattern with `/` matches the path below `working-directory` |
| `coverage-report` | empty | Cobertura XML report: the file inside the artifact when `coverage-artifact` is set, otherwise a path in the repository; empty writes no coverage badge |
| `coverage-artifact` | empty | Name of an artifact, uploaded by an earlier job of the same run, that holds the report |
| `coverage-warn` | `60` | Coverage in percent below which the badge is red |
| `coverage-good` | `80` | Coverage in percent from which the badge is green; in between it is yellow |
| `badges-branch` | `badges` | Branch that holds the badge files; it is created when it does not exist |
| `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the scripts in `tools/` are fetched |
Reference the workflow at the major tag (`@v2`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names
the same tag. See the upgrade guide. Start the workflow on pushes to your
default branch only: the badge commit carries `[skip ci]` and is made with the
token of the run, which does not start another run, but a trigger on every
branch would write one commit per branch.
## What is counted
- A code file is a text file with the extension of a supported language:
Python, shell, PowerShell, C, C++, C#, Java, JavaScript, TypeScript, Go, Rust
and SQL. Markdown, YAML, JSON, XML, HTML and CSS are not code files.
- Every line is exactly one of blank (only white space), comment (only comment
text) or code (everything else, including a line with code and a trailing
comment). The badge shows the lines of code only.
- A comment marker inside a string is not a comment, and a Python docstring is a
string, so it counts as code.
- Directories that start with a dot and `node_modules`, `vendor`, `third_party`,
`dist`, `build`, `out`, `bin`, `obj`, `target`, `venv`, `__pycache__` and
`shared-scripts` are not counted. Generated code is excluded with `exclude`.
- Raw and verbatim strings that differ from an ordinary string (Rust `r#"..."#`,
C# `@"..."`, C++ raw strings) can be counted wrongly. The counts will differ
a little from other tools; the rules are the same on every run.
## The coverage badge
The report is a Cobertura XML file, which `coverage.py` (`coverage xml`),
`gcovr` (`--cobertura`) and `coverlet` (`cobertura` format) write. The badge
shows `lines-covered` over `lines-valid`, rounded to a whole percent, and its
colour follows the two thresholds. A report that does not exist, is not
well-formed Cobertura XML or has no valid lines fails the run with the file
named; the coverage badge is never written as `0%` for a bad report. Without
`coverage-report` the run passes with a notice and no coverage badge.
## Showing the badges
Add the images to the README with the raw URLs of the branch:
```markdown
![code files](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-files.svg)
![lines of code](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/code-lines.svg)
![coverage](https://git.tirsystem.com/OWNER/REPO/raw/branch/badges/coverage.svg)
```
On the GitHub mirror use `https://raw.githubusercontent.com/OWNER/REPO/badges/code-files.svg`;
the push mirror copies the branch. The `badges` branch also holds
`code-metrics.json` with the numbers per language. The instance caches a raw
file for up to six hours, so a changed badge can show the old number for a
while there; the mirror caches for five minutes. A private repository does not
show the badges to a reader who is not signed in.
## When the workflow fails
| Message | Cause | Fix |
| --- | --- | --- |
| `[configuration] working-directory must be a relative path inside the repository.` | An absolute path or `..` | Use a path inside the repository |
| `[configuration] coverage-report '<x>' does not exist.` | The report was not produced, or the artifact name or path is wrong | Check the test job and the artifact name; the path is inside the artifact |
| `[configuration] coverage-report '<x>' is not well-formed XML` or `is not a Cobertura report` | The file is another format | Write Cobertura XML (`coverage xml`, `gcovr --cobertura`) |
| `[configuration] coverage-report '<x>' has no valid lines.` | The tests ran no measured code | Check the coverage configuration |
| `[configuration] coverage-artifact '<x>' needs coverage-report` | The artifact is named but not the file in it | Set `coverage-report` |
| `[configuration] coverage-warn ... is above coverage-good` or `is not a number from 0 to 100` | A threshold is invalid | Correct the input |
| `[configuration] badges-branch '<x>' must not be a default branch` or `holds files that are not badge files` | The branch name is `main`, `master` or a branch with other content | Use a branch that holds only the badges |
| `the push to '<x>' failed twice` | Another run wrote the branch at the same time, or the token cannot write | Re-run; check that the job has `contents: write` |
| The download step fails | The artifact does not exist in this run, or the job does not run after the test job | Add `needs:` and check the artifact name |
-4
View File
@@ -79,10 +79,6 @@ The wiki has English and the product owner's language as a minimum.
5. Merge the change to `main`. The log must end with `Published <n> page(s) to 5. Merge the change to `main`. The log must end with `Published <n> page(s) to
the wiki of <owner>/<repo>`. the wiki of <owner>/<repo>`.
A repository that still has the marker `wiki/.publish` is published by the
older scoped workflow, which is removed once every repository has a call.
Move the pages to `docs/wiki/` and add the call before that.
## Runners ## Runners
| Item | Value | | Item | Value |
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
| `compile-commands-dir` | empty | Directory, relative to the repository root, with a `compile_commands.json` that your pipeline built before the call; when set, clang-tidy uses it and ignores `std` | | `compile-commands-dir` | empty | Directory, relative to the repository root, with a `compile_commands.json` that your pipeline built before the call; when set, clang-tidy uses it and ignores `std` |
| `clang-format-version` | `23.1.3` | Exact version of the clang-format package | | `clang-format-version` | `23.1.3` | Exact version of the clang-format package |
| `clang-tidy-version` | `22.1.8` | Exact version of the clang-tidy package | | `clang-tidy-version` | `22.1.8` | Exact version of the clang-tidy package |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-cpp.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-cpp.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag, never at Reference the workflow at the major tag (`@v1`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names `main`. A call at an exact tag is pinned completely only when `tools-ref` names
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
| `working-directory` | `.` | Directory, relative to the repository root, whose files are checked | | `working-directory` | `.` | Directory, relative to the repository root, whose files are checked |
| `project` | empty | Solution or project file, relative to `working-directory`; empty uses the single `*.sln` or `*.slnx`, else the single `*.csproj`, that is tracked there | | `project` | empty | Solution or project file, relative to `working-directory`; empty uses the single `*.sln` or `*.slnx`, else the single `*.csproj`, that is tracked there |
| `dotnet-sdk-version` | `10.0.401` | Exact version of the .NET SDK, 10 or later; a channel such as `10.0`, a range and a version below 10 are refused | | `dotnet-sdk-version` | `10.0.401` | Exact version of the .NET SDK, 10 or later; a channel such as `10.0`, a range and a version below 10 are refused |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-csharp.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks-csharp.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag, never at Reference the workflow at the major tag (`@v1`) or at an exact tag, never at
`main`. A call at an exact tag is pinned completely only when `tools-ref` names `main`. A call at an exact tag is pinned completely only when `tools-ref` names
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
| `mypy-version` | `1.11.2` | Version of mypy | | `mypy-version` | `1.11.2` | Version of mypy |
| `shellcheck-py-version` | `0.10.0.1` | Version of the shellcheck-py package (ShellCheck 0.10.0) | | `shellcheck-py-version` | `0.10.0.1` | Version of the shellcheck-py package (ShellCheck 0.10.0) |
| `shfmt-py-version` | `3.11.0.2` | Version of the shfmt-py package (shfmt 3.11.0) | | `shfmt-py-version` | `3.11.0.2` | Version of the shfmt-py package (shfmt 3.11.0) |
| `tools-ref` | `v1` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks.sh` is fetched | | `tools-ref` | `v2` | Tag or branch of `TirSystem/github-action` from which the script `tools/quality-checks.sh` is fetched |
Reference the workflow at the major tag (`@v1`) or at an exact tag Reference the workflow at the major tag (`@v1`) or at an exact tag
(`@v1.0.0`), never at `main` and never at the branch of a pull request: that (`@v1.0.0`), never at `main` and never at the branch of a pull request: that
+1 -8
View File
@@ -27,7 +27,6 @@ never starts, or stops before the step) is a **runner** problem.
| `Could not determine the Gitea source repository.` | configuration | The run has no repository name; report as a defect | | `Could not determine the Gitea source repository.` | configuration | The run has no repository name; report as a defect |
| `Expected at most one GitHub push mirror ... found N` | configuration | Keep one GitHub push mirror | | `Expected at most one GitHub push mirror ... found N` | configuration | Keep one GitHub push mirror |
| `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: the repository calls the workflow but its organization has no such secret, or the call does not pass it; store it and pass it in `secrets:` (see [credentials.md](credentials.md)) | | `TOKEN_FOR_GITEA_WIKI is missing or empty.` | configuration | Wiki publishing only: the repository calls the workflow but its organization has no such secret, or the call does not pass it; store it and pass it in `secrets:` (see [credentials.md](credentials.md)) |
| `wiki/.publish may only be empty or contain the word 'prune'.` | configuration | Wiki publishing through the older scoped workflow only: leave the marker empty, or put only the word `prune` in it |
| `The prune input must be 'true' or 'false'` | configuration | Wiki publishing only: set `prune` in the call to `"true"` or `"false"` | | `The prune input must be 'true' or 'false'` | configuration | Wiki publishing only: set `prune` in the call to `"true"` or `"false"` |
| `The wiki folder ... does not exist` | configuration | Wiki publishing only: set `wiki_dir` in the call to the folder with the pages (default `docs/wiki`) | | `The wiki folder ... does not exist` | configuration | Wiki publishing only: set `wiki_dir` in the call to the folder with the pages (default `docs/wiki`) |
| `... HTTP 403 ...` while publishing the wiki | permissions | Wiki publishing only: the token needs `write:repository` and write access to this repository | | `... HTTP 403 ...` while publishing the wiki | permissions | Wiki publishing only: the token needs `write:repository` and write access to this repository |
@@ -54,15 +53,9 @@ settings.
synced.` The run succeeds but nothing was synced. Check that the Gitea synced.` The run succeeds but nothing was synced. Check that the Gitea
version supports the push mirror API and re-run. version supports the push mirror API and re-run.
`No wiki/.publish marker in <owner>/<repo>; wiki publishing is not enabled for
this repository.` The older scoped Publish wiki run succeeds and writes
nothing. The repository has not opted in; call the reusable workflow
**Publish wiki pages** (see [onboarding.md](onboarding.md)) if it should publish.
`<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune `<n> page(s) are in the wiki but not in <folder>/ and were kept; set the prune
input to true to delete them.` The run succeeds. Pages that exist only in the input to true to delete them.` The run succeeds. Pages that exist only in the
wiki are left alone unless the call sets `prune: "true"` (with the older scoped wiki are left alone unless the call sets `prune: "true"`.
workflow: the word `prune` in `wiki/.publish`).
## Runner problems ## Runner problems
+9 -5
View File
@@ -17,13 +17,17 @@ A breaking release gets a new major version (`v2`), so a pipeline on `@v1`
never receives it until you change the line yourself. never receives it until you change the line yourself.
The quality-checks workflows (`quality-checks.yml`, `quality-checks-cpp.yml` and The quality-checks workflows (`quality-checks.yml`, `quality-checks-cpp.yml` and
`quality-checks-csharp.yml`) fetch their script at their input `tools-ref`, which `quality-checks-csharp.yml`) and the code-metrics workflow (`code-metrics.yml`)
defaults to `v1`. To pin one completely, call it at an exact tag and set fetch their scripts at their input `tools-ref`, which defaults to the current major tag (`v2`). To pin one completely, call it at an exact tag and set
`tools-ref` to the same tag; otherwise the script follows the major tag. `tools-ref` to the same tag; otherwise the script follows the major tag.
The two scoped workflows (**Sync GitHub mirror metadata** and **Publish The scoped workflow **Sync GitHub mirror metadata** is delivered by the
wiki**) are delivered by the instance and are not in your `uses:` lines; you instance and is not in your `uses:` lines; you cannot pin it, but it fetches its
cannot pin them, but they fetch their scripts at the major tag. script at the major tag. Wiki publishing is a reusable workflow you call
(`publish-wiki-pages.yml`); the scoped **Publish wiki** workflow and its
`wiki/.publish` marker were removed in 2.0.0, so a repository that still has the
marker no longer publishes until it calls the reusable workflow (see the
onboarding guide).
## Reading a changelog entry ## Reading a changelog entry
+289
View File
@@ -0,0 +1,289 @@
"""Offline tests for tools/badges.py (ADR-0010): the coverage reader and the SVG renderer."""
import importlib.util
import json
import xml.etree.ElementTree as ElementTree
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parent.parent
_SPEC = importlib.util.spec_from_file_location(
"badges", REPO_ROOT / "tools" / "badges.py"
)
assert _SPEC is not None and _SPEC.loader is not None
badges = importlib.util.module_from_spec(_SPEC)
_SPEC.loader.exec_module(badges)
DTD = (
'<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">'
)
def report(
tmp_path: Path, attributes: str, root: str = "coverage", prolog: str = ""
) -> Path:
path = tmp_path / "coverage.xml"
path.write_text(
f'<?xml version="1.0" ?>\n{prolog}<{root} {attributes}><packages/></{root}>\n'
)
return path
class TestReadCoverage:
@pytest.mark.parametrize(
("covered", "valid", "percent"),
[
(0, 10, 0),
(1, 3, 33),
(2, 3, 67),
(5, 8, 63),
(87, 100, 87),
(1, 200, 1),
(10, 10, 100),
],
)
def test_percent_is_covered_over_valid_rounded_half_up(
self, tmp_path, covered, valid, percent
):
path = report(
tmp_path, f'lines-covered="{covered}" lines-valid="{valid}" line-rate="0"'
)
assert badges.read_coverage(path) == percent
def test_the_half_rounds_up(self, tmp_path):
assert (
badges.read_coverage(report(tmp_path, 'lines-covered="1" lines-valid="8"'))
== 13
)
def test_line_rate_is_used_when_the_counts_are_absent(self, tmp_path):
assert badges.read_coverage(report(tmp_path, 'line-rate="0.875"')) == 88
def test_a_document_type_declaration_is_accepted(self, tmp_path):
path = report(tmp_path, 'lines-covered="9" lines-valid="10"', prolog=DTD + "\n")
assert badges.read_coverage(path) == 90
def test_missing_file_names_the_file(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="nope.xml' does not exist"):
badges.read_coverage(tmp_path / "nope.xml")
def test_malformed_xml_names_the_file(self, tmp_path):
path = tmp_path / "bad.xml"
path.write_text("<coverage lines-valid=")
with pytest.raises(
badges.ConfigurationError, match="bad.xml' is not well-formed"
):
badges.read_coverage(path)
def test_other_xml_is_not_a_cobertura_report(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="not a Cobertura report"):
badges.read_coverage(report(tmp_path, 'lines-valid="1"', root="testsuite"))
def test_no_valid_lines_is_a_failure_and_not_zero_percent(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="has no valid lines"):
badges.read_coverage(report(tmp_path, 'lines-covered="0" lines-valid="0"'))
def test_covered_above_valid_is_refused(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="outside 0..lines-valid"):
badges.read_coverage(report(tmp_path, 'lines-covered="5" lines-valid="4"'))
def test_report_without_any_rate_is_refused(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="neither lines-valid"):
badges.read_coverage(report(tmp_path, 'branch-rate="1"'))
def test_line_rate_outside_zero_to_one_is_refused(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="outside 0..1"):
badges.read_coverage(report(tmp_path, 'line-rate="1.5"'))
def test_values_that_are_not_numbers_are_refused(self, tmp_path):
with pytest.raises(badges.ConfigurationError, match="not a number"):
badges.read_coverage(report(tmp_path, 'lines-covered="a" lines-valid="b"'))
with pytest.raises(badges.ConfigurationError, match="not a number"):
badges.read_coverage(report(tmp_path, 'line-rate="high"'))
def test_entity_declarations_are_refused(self, tmp_path):
prolog = '<!DOCTYPE coverage [<!ENTITY x "y">]>\n'
with pytest.raises(badges.ConfigurationError, match="declares entities"):
badges.read_coverage(
report(tmp_path, 'lines-covered="1" lines-valid="2"', prolog=prolog)
)
class TestColor:
@pytest.mark.parametrize(
("percent", "color"),
[
(0, badges.RED),
(59, badges.RED),
(60, badges.YELLOW),
(79, badges.YELLOW),
(80, badges.GREEN),
(100, badges.GREEN),
],
)
def test_thresholds_are_warn_and_good(self, percent, color):
assert badges.coverage_color(percent, 60, 80) == color
def test_thresholds_can_be_moved(self):
assert badges.coverage_color(50, 40, 50) == badges.GREEN
assert badges.coverage_color(39, 40, 50) == badges.RED
class TestRender:
def test_is_valid_xml_with_title_and_text_alternative(self):
svg = badges.render("code files", "1,234", badges.BLUE)
root = ElementTree.fromstring(svg)
ns = "{http://www.w3.org/2000/svg}"
assert root.tag == ns + "svg"
assert root.get("role") == "img"
assert root.get("aria-label") == "code files: 1,234"
assert root.find(ns + "title").text == "code files: 1,234"
def test_same_input_gives_the_same_bytes_and_has_no_script_or_link(self):
first = badges.render("coverage", "87%", badges.GREEN)
assert first == badges.render("coverage", "87%", badges.GREEN)
for forbidden in (
"<script",
"href",
"<image",
"<style",
"http://www.w3.org/1999/xlink",
):
assert forbidden not in first
def test_width_follows_the_number_of_characters(self):
narrow = ElementTree.fromstring(badges.render("a", "1", badges.BLUE)).get(
"width"
)
wide = ElementTree.fromstring(badges.render("a", "1,000", badges.BLUE)).get(
"width"
)
assert int(wide) - int(narrow) == 4 * badges.CHAR_WIDTH
def test_text_is_escaped(self):
svg = badges.render("a<b", 'c&"d', badges.BLUE)
assert "a&lt;b" in svg and "c&amp;&quot;d" in svg
ElementTree.fromstring(svg)
def test_text_colour_has_the_better_contrast(self):
assert badges._text_color("#555555") == "#ffffff"
assert badges._text_color(badges.GREEN) == "#000000"
def metrics_file(tmp_path: Path, files: int = 3, lines: int = 1200) -> Path:
path = tmp_path / "metrics.json"
path.write_text(
json.dumps(
{"files": files, "lines": lines, "comment": 5, "blank": 6, "languages": {}}
)
)
return path
class TestMain:
def test_writes_three_badges_and_the_metrics(self, tmp_path, capsys):
out = tmp_path / "out"
cov = report(tmp_path, 'lines-covered="87" lines-valid="100"')
code = badges.main(
[
"--metrics",
str(metrics_file(tmp_path)),
"--output-dir",
str(out),
"--coverage-report",
str(cov),
]
)
assert code == 0
assert sorted(p.name for p in out.iterdir()) == [
"code-files.svg",
"code-lines.svg",
"code-metrics.json",
"coverage.svg",
]
assert (
'aria-label="lines of code: 1,200"' in (out / "code-lines.svg").read_text()
)
assert 'aria-label="coverage: 87%"' in (out / "coverage.svg").read_text()
assert f'fill="{badges.GREEN}"' in (out / "coverage.svg").read_text()
assert b"\r" not in (out / "code-files.svg").read_bytes()
assert "wrote" in capsys.readouterr().out
def test_output_is_byte_identical_on_a_second_run(self, tmp_path):
args = [
"--metrics",
str(metrics_file(tmp_path)),
"--output-dir",
str(tmp_path / "o"),
]
badges.main(args)
first = {p.name: p.read_bytes() for p in (tmp_path / "o").iterdir()}
badges.main(args)
assert first == {p.name: p.read_bytes() for p in (tmp_path / "o").iterdir()}
def test_without_a_report_no_coverage_badge_and_a_notice(self, tmp_path, capsys):
out = tmp_path / "out"
assert (
badges.main(
["--metrics", str(metrics_file(tmp_path)), "--output-dir", str(out)]
)
== 0
)
assert not (out / "coverage.svg").exists()
assert "::notice::No coverage-report given" in capsys.readouterr().out
def test_a_bad_report_fails_and_writes_nothing(self, tmp_path, capsys):
out = tmp_path / "out"
code = badges.main(
[
"--metrics",
str(metrics_file(tmp_path)),
"--output-dir",
str(out),
"--coverage-report",
str(tmp_path / "missing.xml"),
]
)
assert code == 1
assert "::error::[configuration] coverage-report" in capsys.readouterr().out
assert not out.exists()
@pytest.mark.parametrize(
("warn", "good", "message"),
[
("x", "80", "coverage-warn 'x'"),
("60", "101", "coverage-good '101'"),
("-1", "80", "coverage-warn '-1'"),
("90", "80", "above coverage-good"),
],
)
def test_invalid_thresholds_fail(self, tmp_path, capsys, warn, good, message):
code = badges.main(
[
"--metrics",
str(metrics_file(tmp_path)),
"--output-dir",
str(tmp_path / "o"),
"--coverage-warn",
warn,
"--coverage-good",
good,
]
)
assert code == 1
assert message in capsys.readouterr().out
def test_unreadable_metrics_fail(self, tmp_path, capsys):
bad = tmp_path / "m.json"
bad.write_text('{"files": 1}')
code = badges.main(["--metrics", str(bad), "--output-dir", str(tmp_path / "o")])
assert code == 1
assert "cannot be read" in capsys.readouterr().out
def test_no_code_files_is_a_notice_and_badges_that_show_zero(self, tmp_path, capsys):
out = tmp_path / "out"
metrics = metrics_file(tmp_path, files=0, lines=0)
assert badges.main(["--metrics", str(metrics), "--output-dir", str(out)]) == 0
assert "::notice::No code files were found" in capsys.readouterr().out
assert 'aria-label="code files: 0"' in (out / "code-files.svg").read_text()
+1
View File
@@ -105,6 +105,7 @@ def _write_sources(root: Path) -> None:
"quality-checks", "quality-checks",
"quality-checks-cpp", "quality-checks-cpp",
"quality-checks-csharp", "quality-checks-csharp",
"code-metrics",
"upgrading", "upgrading",
) )
for name in guide_names: for name in guide_names:
+334
View File
@@ -0,0 +1,334 @@
"""Offline tests for the reusable code-metrics workflow and tools/code-metrics.sh (ADR-0010).
The script steps run in a throwaway git repository whose `origin` is a bare
repository on disk, so no network and no instance is needed.
"""
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
import yaml
from workflow_source import REPO_ROOT
WORKFLOW = REPO_ROOT / ".gitea" / "workflows" / "code-metrics.yml"
SCRIPT = REPO_ROOT / "tools" / "code-metrics.sh"
BASH = shutil.which("bash")
GIT = shutil.which("git")
pytestmark = pytest.mark.skipif(
BASH is None or GIT is None, reason="bash and git are needed to run the workflow steps"
)
COVERAGE = '<?xml version="1.0" ?>\n<coverage lines-covered="87" lines-valid="100"><packages/></coverage>\n'
@pytest.fixture(scope="module")
def document() -> dict:
return yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))
class TestDefinition:
def test_is_a_reusable_workflow_with_the_contract_inputs(self, document):
inputs = document[True]["workflow_call"]["inputs"] # PyYAML reads `on` as True
assert {name: item["default"] for name, item in inputs.items()} == {
"working-directory": ".",
"exclude": "",
"coverage-report": "",
"coverage-artifact": "",
"coverage-warn": "60",
"coverage-good": "80",
"badges-branch": "badges",
"tools-ref": (WORKFLOW.parent.parent.parent / "MAJOR_TAG").read_text(encoding="utf-8").strip(),
}
def test_asks_for_contents_write_and_nothing_else_and_needs_no_secret(self, document):
job = document["jobs"]["code-metrics"]
assert job["permissions"] == {"contents": "write"}
assert "secrets" not in WORKFLOW.read_text(encoding="utf-8").replace("needs no secret", "")
def test_inputs_reach_the_scripts_only_through_the_environment(self, document):
job = document["jobs"]["code-metrics"]
for step in job["steps"]:
assert "${{" not in step.get("run", ""), f"{step.get('name')} interpolates an expression"
assert set(job["env"]) == {
"WORKING_DIRECTORY",
"EXCLUDE",
"COVERAGE_REPORT",
"COVERAGE_ARTIFACT",
"COVERAGE_WARN",
"COVERAGE_GOOD",
"BADGES_BRANCH",
}
def test_the_workflow_embeds_no_script_and_runs_the_file(self, document):
steps = document["jobs"]["code-metrics"]["steps"]
assert [step["run"] for step in steps if "run" in step] == [
"bash shared-scripts/tools/code-metrics.sh validate",
"bash shared-scripts/tools/code-metrics.sh measure",
"bash shared-scripts/tools/code-metrics.sh publish",
]
def test_the_scripts_are_fetched_at_the_tools_ref_input(self, document):
steps = document["jobs"]["code-metrics"]["steps"]
fetch = next(step for step in steps if step.get("name") == "Fetch the shared scripts")
assert fetch["with"] == {
"repository": "TirSystem/github-action",
"ref": "${{ inputs.tools-ref }}",
"path": "shared-scripts",
}
def test_the_script_parses(self):
result = subprocess.run([BASH, "-n", str(SCRIPT)], text=True, capture_output=True)
assert result.returncode == 0, result.stderr
def test_an_unknown_command_is_refused(self):
result = subprocess.run([BASH, str(SCRIPT), "bogus"], text=True, capture_output=True)
assert result.returncode == 2
def git(*args: str, cwd: Path) -> str:
result = subprocess.run(
[GIT, "-c", "user.name=t", "-c", "user.email=t@t", *args],
cwd=cwd,
text=True,
capture_output=True,
check=True,
)
return result.stdout.strip()
@pytest.fixture()
def python3_bin(tmp_path) -> Path:
"""A directory with a `python3` that runs the interpreter of the tests."""
directory = tmp_path / "pybin"
directory.mkdir()
shim = directory / "python3"
shim.write_text(f'#!/bin/sh\nexec "{Path(sys.executable).as_posix()}" "$@"\n', newline="\n")
shim.chmod(0o755)
return directory
@pytest.fixture()
def remote(tmp_path) -> Path:
path = tmp_path / "remote.git"
subprocess.run([GIT, "init", "-q", "--bare", str(path)], check=True)
return path
@pytest.fixture()
def repo(tmp_path, remote) -> Path:
root = tmp_path / "repo"
root.mkdir()
git("init", "-q", "-b", "main", cwd=root)
git("remote", "add", "origin", str(remote), cwd=root)
(root / "a.py").write_text("x = 1\n# c\n\n", newline="\n")
(root / "run.sh").write_text("echo hi\n", newline="\n")
git("add", "-A", cwd=root)
git("commit", "-q", "-m", "init", cwd=root)
return root
def run(command: str, repo: Path, tmp_path: Path, python3_bin: Path, **env: str):
environment = dict(os.environ)
environment.update(
{
"WORKING_DIRECTORY": ".",
"EXCLUDE": "",
"COVERAGE_REPORT": "",
"COVERAGE_ARTIFACT": "",
"COVERAGE_WARN": "60",
"COVERAGE_GOOD": "80",
"BADGES_BRANCH": "badges",
"BADGES_OUT": str(tmp_path / "out"),
"PATH": f"{python3_bin.as_posix()}{os.pathsep}{environment['PATH']}",
}
)
environment.update(env)
return subprocess.run(
[BASH, str(SCRIPT), command], cwd=repo, env=environment, text=True, capture_output=True
)
def branch_files(remote: Path, branch: str = "badges") -> list[str]:
out = subprocess.run(
[GIT, "--git-dir", str(remote), "ls-tree", "-r", "--name-only", branch],
text=True,
capture_output=True,
)
return out.stdout.split()
def commit_count(remote: Path, branch: str = "badges") -> int:
out = subprocess.run(
[GIT, "--git-dir", str(remote), "rev-list", "--count", branch], text=True, capture_output=True
)
return int(out.stdout.strip() or 0)
def measure_and_publish(repo, tmp_path, python3_bin, **env):
measured = run("measure", repo, tmp_path, python3_bin, **env)
assert measured.returncode == 0, measured.stdout + measured.stderr
return run("publish", repo, tmp_path, python3_bin, **env)
class TestValidate:
def test_accepts_the_defaults(self, repo, tmp_path, python3_bin):
result = run("validate", repo, tmp_path, python3_bin)
assert result.returncode == 0, result.stdout
assert "badges go to the branch badges" in result.stdout
@pytest.mark.parametrize(
("name", "value", "message"),
[
("WORKING_DIRECTORY", "/etc", "working-directory must be a relative path"),
("WORKING_DIRECTORY", "../x", "working-directory must be a relative path"),
("WORKING_DIRECTORY", "nope", "working-directory 'nope' does not exist"),
("COVERAGE_REPORT", "/tmp/c.xml", "coverage-report must be a relative path"),
("COVERAGE_ARTIFACT", "cov", "coverage-artifact 'cov' needs coverage-report"),
("BADGES_BRANCH", "main", "must not be a default branch"),
("BADGES_BRANCH", "master", "must not be a default branch"),
("BADGES_BRANCH", "", "must not be a default branch"),
("BADGES_BRANCH", "a b", "is not a valid branch name"),
("BADGES_BRANCH", "x..y", "is not a valid branch name"),
],
)
def test_refuses_an_invalid_input_and_names_it(
self, repo, tmp_path, python3_bin, name, value, message
):
result = run("validate", repo, tmp_path, python3_bin, **{name: value})
assert result.returncode == 1
assert f"::error::[configuration] " in result.stdout
assert message in result.stdout
class TestPublish:
def test_creates_the_branch_with_the_badges_and_the_numbers(self, repo, remote, tmp_path, python3_bin):
result = measure_and_publish(repo, tmp_path, python3_bin)
assert result.returncode == 0, result.stdout + result.stderr
assert sorted(branch_files(remote)) == ["code-files.svg", "code-lines.svg", "code-metrics.json"]
shown = subprocess.run(
[GIT, "--git-dir", str(remote), "show", "badges:code-lines.svg"], text=True, capture_output=True
).stdout
assert 'aria-label="lines of code: 2"' in shown # a.py has one code line, run.sh one
message = subprocess.run(
[GIT, "--git-dir", str(remote), "log", "-1", "--format=%s", "badges"],
text=True,
capture_output=True,
).stdout.strip()
assert message == "Update code metrics badges [skip ci]"
def test_the_branch_of_the_caller_is_not_changed(self, repo, remote, tmp_path, python3_bin):
before = git("status", "--porcelain", cwd=repo)
measure_and_publish(repo, tmp_path, python3_bin)
assert git("status", "--porcelain", cwd=repo) == before
assert git("branch", "--show-current", cwd=repo) == "main"
def test_an_unchanged_run_commits_nothing(self, repo, remote, tmp_path, python3_bin):
measure_and_publish(repo, tmp_path, python3_bin)
second = measure_and_publish(repo, tmp_path, python3_bin)
assert second.returncode == 0
assert "Badges are current; nothing to commit." in second.stdout
assert commit_count(remote) == 1
def test_a_changed_number_is_one_commit_that_changes_only_badge_files(
self, repo, remote, tmp_path, python3_bin
):
measure_and_publish(repo, tmp_path, python3_bin)
(repo / "b.py").write_text("y = 2\nz = 3\n", newline="\n")
git("add", "-A", cwd=repo)
git("commit", "-q", "-m", "more", cwd=repo)
result = measure_and_publish(repo, tmp_path, python3_bin)
assert result.returncode == 0, result.stdout
assert commit_count(remote) == 2
changed = subprocess.run(
[GIT, "--git-dir", str(remote), "show", "--name-only", "--format=", "badges"],
text=True,
capture_output=True,
).stdout.split()
assert sorted(changed) == ["code-files.svg", "code-lines.svg", "code-metrics.json"]
def test_a_coverage_report_adds_the_coverage_badge(self, repo, remote, tmp_path, python3_bin):
(repo / "cov.xml").write_text(COVERAGE, newline="\n")
result = measure_and_publish(repo, tmp_path, python3_bin, COVERAGE_REPORT="cov.xml")
assert result.returncode == 0, result.stdout
assert "coverage.svg" in branch_files(remote)
def test_a_report_from_an_artifact_is_read_below_the_artifact_directory(
self, repo, remote, tmp_path, python3_bin
):
artifact = repo / "coverage-artifact"
artifact.mkdir()
(artifact / "cov.xml").write_text(COVERAGE, newline="\n")
result = measure_and_publish(
repo, tmp_path, python3_bin, COVERAGE_ARTIFACT="coverage", COVERAGE_REPORT="cov.xml"
)
assert result.returncode == 0, result.stdout
assert "coverage.svg" in branch_files(remote)
def test_a_report_missing_from_the_artifact_names_the_path(self, repo, tmp_path, python3_bin):
result = run(
"measure",
repo,
tmp_path,
python3_bin,
COVERAGE_ARTIFACT="coverage",
COVERAGE_REPORT="cov.xml",
)
assert result.returncode == 1
assert "coverage-report 'coverage-artifact/cov.xml' does not exist" in result.stdout
def test_a_missing_report_fails_names_the_file_and_changes_nothing(
self, repo, remote, tmp_path, python3_bin
):
result = run("measure", repo, tmp_path, python3_bin, COVERAGE_REPORT="nope.xml")
assert result.returncode == 1
assert "::error::[configuration] coverage-report 'nope.xml' does not exist." in result.stdout
assert branch_files(remote) == []
def test_the_shared_scripts_directory_is_not_counted(self, repo, remote, tmp_path, python3_bin):
shared = repo / "shared-scripts" / "tools"
shared.mkdir(parents=True)
(shared / "big.py").write_text("a = 1\n" * 50, newline="\n")
measure_and_publish(repo, tmp_path, python3_bin)
shown = subprocess.run(
[GIT, "--git-dir", str(remote), "show", "badges:code-files.svg"], text=True, capture_output=True
).stdout
assert 'aria-label="code files: 2"' in shown
def test_a_branch_that_holds_other_files_is_refused(self, repo, remote, tmp_path, python3_bin):
git("push", "-q", "origin", "main:docs", cwd=repo)
result = measure_and_publish(repo, tmp_path, python3_bin, BADGES_BRANCH="docs")
assert result.returncode == 1
assert "it is not a badges branch" in result.stdout
def test_publish_without_measure_is_refused(self, repo, tmp_path, python3_bin):
result = run("publish", repo, tmp_path, python3_bin)
assert result.returncode == 1
assert "run measure first" in result.stdout
def test_a_rejected_push_is_retried_once_after_a_fetch(self, repo, remote, tmp_path, python3_bin):
marker = tmp_path / "rejected-once"
hook = remote / "hooks" / "pre-receive"
hook.write_text(
f'#!/bin/sh\nif [ ! -e "{marker.as_posix()}" ]; then touch "{marker.as_posix()}"; '
"echo rejected once >&2; exit 1; fi\nexit 0\n",
newline="\n",
)
hook.chmod(0o755)
result = measure_and_publish(repo, tmp_path, python3_bin)
assert result.returncode == 0, result.stdout + result.stderr
assert marker.exists()
def test_two_rejected_pushes_fail(self, repo, remote, tmp_path, python3_bin):
hook = remote / "hooks" / "pre-receive"
hook.write_text("#!/bin/sh\necho rejected >&2\nexit 1\n", newline="\n")
hook.chmod(0o755)
result = measure_and_publish(repo, tmp_path, python3_bin)
assert result.returncode == 1
assert re.search(r"push to 'badges' failed twice", result.stdout)
+317
View File
@@ -0,0 +1,317 @@
"""Offline tests for tools/count_loc.py (ADR-0010): hand-counted fixtures per language."""
import importlib.util
import json
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parent.parent
_SPEC = importlib.util.spec_from_file_location(
"count_loc", REPO_ROOT / "tools" / "count_loc.py"
)
assert _SPEC is not None and _SPEC.loader is not None
count_loc = importlib.util.module_from_spec(_SPEC)
_SPEC.loader.exec_module(count_loc)
LANGUAGE = {language.name: language for language in count_loc.LANGUAGES}
# name -> (source, code, comment, blank), counted by hand.
FIXTURES = {
"Python": (
"# a comment\n"
"x = 1 # trailing comment\n"
"\n"
's = "a # not a comment"\n'
"t = 'it''s # still a string'\n"
'"""docstring\n'
"# inside a string\n"
"\n"
'"""\n'
"y = 2", # no final newline
7,
1,
2,
),
"Shell": (
"#!/usr/bin/env bash\n"
"# comment\n"
'echo "$#" ${#args[@]} a#b\n'
"\n"
" # indented comment\n"
"echo 'it # stays' # but this is a comment\n"
"ls | wc -l;# after a semicolon\n",
3,
3,
1,
),
"PowerShell": (
'<# block\ncomment #>\nWrite-Host "a # b"\n# line\n$x = 1 # trailing\n',
2,
3,
0,
),
"C": (
"/* header\n"
" * text\n"
" */\n"
"#include <stdio.h>\n"
"\n"
"int main(void) { /* inline */ return 0; }\n"
"char quote = '\"'; // a double quote in a char\n"
'const char *url = "http://example.com";\n'
"// done\n",
4,
4,
1,
),
"C++": (
'int a = 0; // one\n/* block */\nauto s = "/* not a comment */";\n',
2,
1,
0,
),
"C#": (
"// line\n"
"using System;\n"
"/// <summary>doc</summary>\n"
'class A { string s = "// no"; }\n',
2,
2,
0,
),
"Java": (
"/** doc */\nclass A {\n // c\n int x; /* t */\n}\n",
3,
2,
0,
),
"JavaScript": (
"const a = `line one\n"
"// in a template\n"
"line three`;\n"
"// real comment\n"
"const b = 'x // y';\n"
"/* a */ /* b */\n",
4,
2,
0,
),
"TypeScript": (
"let n: number = 1; // c\n\n/*\n * block\n */\n",
1,
3,
1,
),
"Go": (
"package main\n// c\nvar r = '/'\nvar raw = `// not a comment\n`\n",
4,
1,
0,
),
"Rust": (
"/* outer /* nested */ still a comment */\n"
"fn f<'a>(x: &'a str) -> &'a str { x } // lifetimes\n"
"let c = '\\'';\n"
"// end\n",
2,
2,
0,
),
"SQL": (
"-- query\n"
"SELECT '-- not a comment' FROM t; -- but this is\n"
"/* a\n"
" block */\n"
"\n",
1,
3,
1,
),
}
@pytest.mark.parametrize("name", sorted(FIXTURES))
def test_fixture_counts_equal_the_hand_count(name):
source, code, comment, blank = FIXTURES[name]
assert count_loc.classify_text(source, LANGUAGE[name]) == (code, comment, blank)
def test_every_language_has_a_fixture():
assert set(FIXTURES) == set(LANGUAGE)
class TestClassify:
def test_empty_text_has_no_lines(self):
assert count_loc.classify_text("", LANGUAGE["Python"]) == (0, 0, 0)
def test_windows_line_endings_are_one_line_each(self):
assert count_loc.classify_text("a = 1\r\n# c\r\n\r\n", LANGUAGE["Python"]) == (
1,
1,
1,
)
def test_blank_line_inside_a_block_comment_is_blank(self):
assert count_loc.classify_text("/*\n\n*/\n", LANGUAGE["C"]) == (0, 2, 1)
def test_code_after_a_closing_block_comment_is_code(self):
assert count_loc.classify_text("/* a\n b */ x();\n", LANGUAGE["C"]) == (1, 1, 0)
def test_unterminated_string_ends_at_end_of_line(self):
assert count_loc.classify_text('s = "open // x\n// c\n', LANGUAGE["C"]) == (
1,
1,
0,
)
def test_unterminated_backtick_string_continues(self):
assert count_loc.classify_text("a = `x\n// y\n", LANGUAGE["JavaScript"]) == (
2,
0,
0,
)
def test_escaped_quote_does_not_end_the_string(self):
assert count_loc.classify_text('s = "a \\" // b";\n', LANGUAGE["C"]) == (
1,
0,
0,
)
class TestPatterns:
def test_star_stops_at_a_slash_and_double_star_does_not(self):
excludes = count_loc.Excludes(["src/*.py", "docs/**"])
assert excludes.matches("a.py", "src/a.py")
assert not excludes.matches("a.py", "src/sub/a.py")
assert excludes.matches("x.py", "docs/a/b/x.py")
def test_name_pattern_matches_anywhere(self):
excludes = count_loc.Excludes(["gen_*", "?.py"])
assert excludes.matches("gen_a.py", "deep/er/gen_a.py")
assert excludes.matches("a.py", "x/a.py")
assert not excludes.matches("ab.py", "x/ab.py")
def test_empty_patterns_are_ignored(self):
assert not count_loc.Excludes(["", " / "]).matches("a.py", "a.py")
def write(root: Path, name: str, content: str | bytes) -> None:
path = root / name
path.parent.mkdir(parents=True, exist_ok=True)
if isinstance(content, bytes):
path.write_bytes(content)
else:
path.write_text(content, encoding="utf-8")
class TestCount:
def test_counts_files_and_lines_per_language(self, tmp_path):
write(tmp_path, "a.py", "x = 1\n# c\n\n")
write(tmp_path, "pkg/b.py", "y = 2\n")
write(tmp_path, "run.sh", "echo hi\n")
write(tmp_path, "README.md", "# not code\n")
result = count_loc.count(tmp_path)
assert result == {
"files": 3,
"lines": 3,
"comment": 1,
"blank": 1,
"languages": {
"Python": {"files": 2, "lines": 2, "comment": 1, "blank": 1},
"Shell": {"files": 1, "lines": 1, "comment": 0, "blank": 0},
},
}
def test_default_excludes_hidden_vendored_and_shared_script_directories(
self, tmp_path
):
write(tmp_path, "keep.py", "a = 1\n")
for directory in (
".git",
".venv",
"node_modules",
"vendor",
"shared-scripts",
"build",
):
write(tmp_path, f"{directory}/skip.py", "b = 2\n")
assert count_loc.count(tmp_path)["files"] == 1
def test_exclude_patterns_add_to_the_defaults(self, tmp_path):
write(tmp_path, "keep.py", "a = 1\n")
write(tmp_path, "gen/out.py", "b = 2\n")
write(tmp_path, "src/gen_x.py", "c = 3\n")
write(tmp_path, "src/keep2.py", "d = 4\n")
result = count_loc.count(tmp_path, ["gen", "gen_*"])
assert result["files"] == 2
def test_binary_file_with_a_code_extension_is_not_counted(self, tmp_path):
write(tmp_path, "blob.py", b"a = 1\n\x00\x01")
assert count_loc.count(tmp_path)["files"] == 0
def test_invalid_utf8_and_a_byte_order_mark_are_read(self, tmp_path):
write(tmp_path, "a.py", b"\xef\xbb\xbfx = 1\n\xff\xfe = 2\n")
assert count_loc.count(tmp_path)["lines"] == 2
def test_empty_code_file_is_a_file_with_no_lines(self, tmp_path):
write(tmp_path, "empty.py", "")
result = count_loc.count(tmp_path)
assert (result["files"], result["lines"]) == (1, 0)
def test_directory_without_code_files_counts_zero(self, tmp_path):
write(tmp_path, "notes.txt", "hello\n")
result = count_loc.count(tmp_path)
assert result == {
"files": 0,
"lines": 0,
"comment": 0,
"blank": 0,
"languages": {},
}
def test_symbolic_link_is_not_followed(self, tmp_path):
real = tmp_path / "real"
write(real, "a.py", "x = 1\n")
link = tmp_path / "link.py"
try:
link.symlink_to(real / "a.py")
except (OSError, NotImplementedError):
pytest.skip("symbolic links are not available here")
assert count_loc.count(real)["files"] == 1
assert count_loc.count(tmp_path)["files"] == 1 # real/a.py only, not link.py
class TestMain:
def test_prints_json_to_standard_output(self, tmp_path, capsys):
write(tmp_path, "a.py", "x = 1\n")
assert count_loc.main(["--directory", str(tmp_path)]) == 0
out = json.loads(capsys.readouterr().out)
assert out["files"] == 1 and out["lines"] == 1
def test_writes_the_output_file_with_lf_endings(self, tmp_path):
write(tmp_path, "src/a.py", "x = 1\n")
target = tmp_path / "result.json"
assert (
count_loc.main(
["--directory", str(tmp_path / "src"), "--output", str(target)]
)
== 0
)
data = target.read_bytes()
assert b"\r" not in data and json.loads(data)["files"] == 1
def test_exclude_option_is_a_comma_list(self, tmp_path, capsys):
write(tmp_path, "a.py", "x = 1\n")
write(tmp_path, "b.py", "y = 1\n")
write(tmp_path, "c.py", "z = 1\n")
assert (
count_loc.main(["--directory", str(tmp_path), "--exclude", "a.py, b.py"])
== 0
)
assert json.loads(capsys.readouterr().out)["files"] == 1
def test_missing_directory_is_a_configuration_error(self, tmp_path, capsys):
assert count_loc.main(["--directory", str(tmp_path / "nope")]) == 1
assert "::error::[configuration]" in capsys.readouterr().out
+13 -110
View File
@@ -7,7 +7,7 @@ import urllib.error
import pytest import pytest
import yaml import yaml
from workflow_source import PUBLISH_WORKFLOW, REPO_ROOT, load_publish_module from workflow_source import REPO_ROOT, load_publish_module
REUSABLE_WORKFLOW = REPO_ROOT / ".gitea" / "workflows" / "publish-wiki-pages.yml" REUSABLE_WORKFLOW = REPO_ROOT / ".gitea" / "workflows" / "publish-wiki-pages.yml"
@@ -25,22 +25,6 @@ def b64(text: str) -> str:
return base64.b64encode(text.encode()).decode() return base64.b64encode(text.encode()).decode()
class TestParseMarker:
@pytest.mark.parametrize(
("text", "expected"),
[("", False), (" \n", False), (None, False), ("prune", True), (" prune\n", True)],
)
def test_reads_the_empty_marker_and_the_prune_word(self, publish_wiki, text, expected):
assert publish_wiki.parse_marker(text) is expected
@pytest.mark.parametrize("text", ["Prune", "prune: true", "delete", "prune\nmore"])
def test_rejects_anything_else(self, publish_wiki, text):
with pytest.raises(publish_wiki.WorkflowError) as caught:
publish_wiki.parse_marker(text)
assert caught.value.category == "configuration"
assert "prune" in str(caught.value)
class TestParseGiteaToken: class TestParseGiteaToken:
def test_returns_the_stripped_token(self, publish_wiki): def test_returns_the_stripped_token(self, publish_wiki):
assert publish_wiki.parse_gitea_token(" abc \n") == "abc" assert publish_wiki.parse_gitea_token(" abc \n") == "abc"
@@ -54,17 +38,15 @@ class TestParseGiteaToken:
class TestReadPages: class TestReadPages:
def test_reads_markdown_files_by_stem_and_ignores_the_marker(self, publish_wiki, tmp_path): def test_reads_markdown_files_by_stem_and_ignores_other_files(self, publish_wiki, tmp_path):
(tmp_path / "Home.md").write_bytes(b"home") (tmp_path / "Home.md").write_bytes(b"home")
(tmp_path / "Home.da.md").write_bytes(b"hjem") (tmp_path / "Home.da.md").write_bytes(b"hjem")
(tmp_path / ".publish").write_bytes(b"prune")
(tmp_path / "Notes.txt").write_bytes(b"ignored") (tmp_path / "Notes.txt").write_bytes(b"ignored")
assert publish_wiki.read_pages(tmp_path) == {"Home": b"home", "Home.da": b"hjem"} assert publish_wiki.read_pages(tmp_path) == {"Home": b"home", "Home.da": b"hjem"}
def test_rejects_a_directory_without_pages_so_the_wiki_is_never_wiped( def test_rejects_a_directory_without_pages_so_the_wiki_is_never_wiped(
self, publish_wiki, tmp_path self, publish_wiki, tmp_path
): ):
(tmp_path / ".publish").write_text("prune", encoding="utf-8")
with pytest.raises(publish_wiki.WorkflowError, match="no Markdown pages"): with pytest.raises(publish_wiki.WorkflowError, match="no Markdown pages"):
publish_wiki.read_pages(tmp_path) publish_wiki.read_pages(tmp_path)
@@ -143,7 +125,7 @@ def environment(monkeypatch, tmp_path):
wiki_dir.mkdir() wiki_dir.mkdir()
(wiki_dir / "Home.md").write_text("home v2", encoding="utf-8") (wiki_dir / "Home.md").write_text("home v2", encoding="utf-8")
(wiki_dir / "Credentials.md").write_text("credentials", encoding="utf-8") (wiki_dir / "Credentials.md").write_text("credentials", encoding="utf-8")
(wiki_dir / ".publish").write_text("prune\n", encoding="utf-8") monkeypatch.setenv("WIKI_PRUNE", "true")
monkeypatch.setenv("WIKI_DIR", str(wiki_dir)) monkeypatch.setenv("WIKI_DIR", str(wiki_dir))
monkeypatch.setenv("GITEA_API_URL", f"{API}/") monkeypatch.setenv("GITEA_API_URL", f"{API}/")
monkeypatch.setenv("SOURCE_REPOSITORY", "TirSystem/repo") monkeypatch.setenv("SOURCE_REPOSITORY", "TirSystem/repo")
@@ -156,58 +138,6 @@ def run_main(publish_wiki, gitea):
return publish_wiki.main() return publish_wiki.main()
class TestOptIn:
def test_a_repository_without_the_marker_is_never_written_to(
self, publish_wiki, environment, capsys
):
(environment / ".publish").unlink()
gitea = FakeGitea(publish_wiki, wiki={"Old": b64("hand written")})
assert run_main(publish_wiki, gitea) == 0
assert gitea.calls == []
assert "wiki publishing is not enabled" in capsys.readouterr().out
assert gitea.wiki == {"Old": b64("hand written")}
def test_a_repository_without_the_marker_does_not_need_the_secret(
self, publish_wiki, environment, monkeypatch
):
(environment / ".publish").unlink()
monkeypatch.setenv("WIKI_CREDENTIALS", "")
assert run_main(publish_wiki, FakeGitea(publish_wiki)) == 0
def test_a_repository_without_a_wiki_directory_is_skipped(
self, publish_wiki, monkeypatch, tmp_path
):
monkeypatch.setenv("WIKI_DIR", str(tmp_path / "missing"))
monkeypatch.setenv("SOURCE_REPOSITORY", "TirSystem/repo")
gitea = FakeGitea(publish_wiki)
assert run_main(publish_wiki, gitea) == 0
assert gitea.calls == []
def test_an_opted_in_repository_without_the_secret_fails_before_any_request(
self, publish_wiki, environment, monkeypatch
):
monkeypatch.setenv("WIKI_CREDENTIALS", "")
gitea = FakeGitea(publish_wiki)
with pytest.raises(publish_wiki.WorkflowError, match="TOKEN_FOR_GITEA_WIKI"):
run_main(publish_wiki, gitea)
assert gitea.calls == []
def test_an_unknown_marker_content_is_refused_before_any_request(
self, publish_wiki, environment
):
(environment / ".publish").write_text("mirror everything", encoding="utf-8")
gitea = FakeGitea(publish_wiki)
with pytest.raises(publish_wiki.WorkflowError, match="prune"):
run_main(publish_wiki, gitea)
assert gitea.calls == []
class TestPublish: class TestPublish:
def test_prune_creates_updates_and_deletes_to_match_the_source( def test_prune_creates_updates_and_deletes_to_match_the_source(
self, publish_wiki, environment, capsys self, publish_wiki, environment, capsys
@@ -227,9 +157,9 @@ class TestPublish:
assert "0 created, 1 updated, 1 deleted" in capsys.readouterr().out assert "0 created, 1 updated, 1 deleted" in capsys.readouterr().out
def test_without_prune_pages_outside_the_source_are_kept( def test_without_prune_pages_outside_the_source_are_kept(
self, publish_wiki, environment, capsys self, publish_wiki, environment, capsys, monkeypatch
): ):
(environment / ".publish").write_text("", encoding="utf-8") monkeypatch.setenv("WIKI_PRUNE", "false")
gitea = FakeGitea( gitea = FakeGitea(
publish_wiki, wiki={"Home": b64("home v1"), "Old": b64("hand written")} publish_wiki, wiki={"Home": b64("home v1"), "Old": b64("hand written")}
) )
@@ -302,11 +232,11 @@ class TestPageIdentity:
"""A wiki that already has pages named with spaces, as Gitea stores them.""" """A wiki that already has pages named with spaces, as Gitea stores them."""
def test_a_file_named_with_a_space_updates_the_existing_page( def test_a_file_named_with_a_space_updates_the_existing_page(
self, publish_wiki, environment self, publish_wiki, environment, monkeypatch
): ):
(environment / "Home.md").unlink() (environment / "Home.md").unlink()
(environment / "Credentials.md").unlink() (environment / "Credentials.md").unlink()
(environment / ".publish").write_text("", encoding="utf-8") monkeypatch.setenv("WIKI_PRUNE", "false")
(environment / "Home da.md").write_text("hjem v2", encoding="utf-8") (environment / "Home da.md").write_text("hjem v2", encoding="utf-8")
gitea = FakeGitea(publish_wiki, wiki={"Home-da": b64("hjem v1")}) gitea = FakeGitea(publish_wiki, wiki={"Home-da": b64("hjem v1")})
@@ -457,7 +387,6 @@ class TestExplicitPrune:
@pytest.fixture() @pytest.fixture()
def explicit(self, environment, monkeypatch): def explicit(self, environment, monkeypatch):
(environment / ".publish").unlink()
monkeypatch.setenv("WIKI_PRUNE", "false") monkeypatch.setenv("WIKI_PRUNE", "false")
return environment return environment
@@ -567,38 +496,12 @@ class TestReusableWorkflow:
assert fetch["ref"] == "${{ inputs.tools-ref }}" assert fetch["ref"] == "${{ inputs.tools-ref }}"
class TestWorkflow: def test_the_scoped_workflow_is_gone_and_the_script_has_no_marker_path():
@pytest.fixture() """ADR-0009, MIL-009: the scoped publish-wiki.yml and the marker are removed."""
def document(self): assert not (REPO_ROOT / ".gitea" / "scoped_workflows" / "publish-wiki.yml").exists()
return yaml.safe_load(PUBLISH_WORKFLOW.read_text(encoding="utf-8")) source = (REPO_ROOT / "tools" / "publish_wiki.py").read_text(encoding="utf-8")
assert "MARKER_NAME" not in source
def test_runs_only_on_main_when_wiki_changes_or_by_hand(self, document): assert "parse_marker" not in source
triggers = document[True] # PyYAML reads the key `on` as True
assert triggers["push"]["branches"] == ["main"]
assert triggers["push"]["paths"] == ["wiki/**"]
assert "workflow_dispatch" in triggers
def test_job_has_read_only_permissions(self, document):
assert document["jobs"]["publish-wiki"]["permissions"] == {"contents": "read"}
def test_secret_is_passed_only_through_the_environment_and_has_no_fallback(self, document):
text = PUBLISH_WORKFLOW.read_text(encoding="utf-8")
assert "secrets.TOKEN_FOR_GITEA }}" not in text
publish_step = document["jobs"]["publish-wiki"]["steps"][-1]
assert publish_step["env"]["WIKI_CREDENTIALS"] == "${{ secrets.TOKEN_FOR_GITEA_WIKI }}"
assert "secrets" not in publish_step["run"]
def test_the_scoped_workflow_runs_the_script_file(self, document):
assert (REPO_ROOT / "tools" / "publish_wiki.py").is_file()
steps = document["jobs"]["publish-wiki"]["steps"]
assert "python3 - <<" not in PUBLISH_WORKFLOW.read_text(encoding="utf-8")
assert steps[0]["uses"].startswith("actions/checkout@")
assert steps[1]["with"] == {
"repository": "TirSystem/github-action",
"ref": "v1",
"path": "shared-scripts",
}
assert steps[-1]["run"] == "python3 shared-scripts/tools/publish_wiki.py"
def test_this_repository_publishes_docs_wiki_through_the_reusable_workflow(): def test_this_repository_publishes_docs_wiki_through_the_reusable_workflow():
+1 -1
View File
@@ -46,7 +46,7 @@ class TestDefinition:
} }
assert inputs["languages"]["default"] == "python,shell" assert inputs["languages"]["default"] == "python,shell"
assert inputs["working-directory"]["default"] == "." assert inputs["working-directory"]["default"] == "."
assert inputs["tools-ref"]["default"] == "v1" assert inputs["tools-ref"]["default"] == (REPO_ROOT / "MAJOR_TAG").read_text(encoding="utf-8").strip()
def test_tool_versions_are_pinned_to_the_adr(self, document): def test_tool_versions_are_pinned_to_the_adr(self, document):
inputs = document[True]["workflow_call"]["inputs"] inputs = document[True]["workflow_call"]["inputs"]
+1 -1
View File
@@ -68,7 +68,7 @@ class TestDefinition:
"ref": "${{ inputs.tools-ref }}", "ref": "${{ inputs.tools-ref }}",
"path": "shared-scripts", "path": "shared-scripts",
} }
assert inputs_of(workflow)["tools-ref"]["default"] == "v1" assert inputs_of(workflow)["tools-ref"]["default"] == (REPO_ROOT / "MAJOR_TAG").read_text(encoding="utf-8").strip()
def test_inputs_reach_the_script_only_through_the_environment( def test_inputs_reach_the_script_only_through_the_environment(
self, self,
+107
View File
@@ -0,0 +1,107 @@
"""The default `tools-ref` of every reusable workflow names the current major.
A reusable workflow fetches the script it runs from this repository at its
input `tools-ref`. A default that names a tag without the script makes a call
with the defaults fail (MIL-011; code-metrics.yml defaulted to `v1`, where
`tools/code-metrics.sh` does not exist). The current major is defined once, in
`MAJOR_TAG`, and these tests check the workflows against it.
"""
import re
import subprocess
import pytest
import yaml
from workflow_source import REPO_ROOT, WORKFLOW_DIRS
MAJOR_TAG_FILE = REPO_ROOT / "MAJOR_TAG"
CHANGELOG = REPO_ROOT / "CHANGELOG.md"
SCRIPT_PATTERN = re.compile(r"shared-scripts/(tools/[A-Za-z0-9_.-]+)")
VERSION_HEADING = re.compile(r"^## \[(\d+)\.(\d+)\.(\d+)\]", re.MULTILINE)
def reusable_workflows():
"""Return the workflow files of this repository that a caller can use."""
path = WORKFLOW_DIRS[1]
found = []
for candidate in sorted(path.glob("*.yml")):
document = yaml.safe_load(candidate.read_text(encoding="utf-8"))
triggers = document.get("on") or document.get(True) or {}
if isinstance(triggers, dict) and "workflow_call" in triggers:
found.append(candidate)
return found
def tools_ref_problems(text, major, script_exists):
"""Return the problems of one workflow's default `tools-ref`, or [].
`text` is the workflow file, `major` the current major tag, and
`script_exists(tag, path)` says whether the tag holds the script.
"""
document = yaml.safe_load(text)
triggers = document.get("on") or document.get(True) or {}
inputs = (triggers.get("workflow_call") or {}).get("inputs") or {}
if "tools-ref" not in inputs:
return []
problems = []
default = inputs["tools-ref"].get("default")
if default != major:
problems.append(f"default tools-ref is {default!r}, the current major is {major!r}")
for script in sorted(set(SCRIPT_PATTERN.findall(text))):
if not script_exists(default, script):
problems.append(f"{script} is not in tag {default!r}")
return problems
def current_major():
return MAJOR_TAG_FILE.read_text(encoding="utf-8").strip()
def script_in_tag(tag, path):
"""True when the tag holds the file; True when the tag is not in this checkout."""
known = subprocess.run(
["git", "-C", str(REPO_ROOT), "rev-parse", "--verify", "--quiet", f"refs/tags/{tag}"],
capture_output=True,
check=False,
)
if known.returncode != 0:
return True
holds = subprocess.run(
["git", "-C", str(REPO_ROOT), "cat-file", "-e", f"{tag}:{path}"],
capture_output=True,
check=False,
)
return holds.returncode == 0
def test_major_tag_file_names_the_highest_major_of_the_changelog():
majors = [int(m.group(1)) for m in VERSION_HEADING.finditer(CHANGELOG.read_text(encoding="utf-8"))]
assert majors, "the changelog has no released version"
assert current_major() == f"v{max(majors)}"
@pytest.mark.parametrize("path", reusable_workflows(), ids=lambda p: p.name)
def test_default_tools_ref_is_the_current_major_and_holds_the_script(path):
problems = tools_ref_problems(path.read_text(encoding="utf-8"), current_major(), script_in_tag)
assert problems == []
@pytest.mark.parametrize("path", reusable_workflows(), ids=lambda p: p.name)
def test_every_script_a_workflow_runs_is_in_the_working_tree(path):
for script in SCRIPT_PATTERN.findall(path.read_text(encoding="utf-8")):
assert (REPO_ROOT / script).is_file(), f"{path.name} runs {script}, which does not exist"
def test_a_default_that_names_an_old_major_is_reported():
text = (WORKFLOW_DIRS[1] / "code-metrics.yml").read_text(encoding="utf-8")
seeded = re.sub(r'(tools-ref:\s*description:[^\n]*\n\s*type: string\n\s*default: )"[^"]*"', r'\1"v1"', text)
assert seeded != text, "the seeded default was not applied"
problems = tools_ref_problems(seeded, "v2", lambda tag, path: tag != "v1")
assert any("current major" in p for p in problems)
assert any("is not in tag 'v1'" in p for p in problems)
def test_the_fixed_default_has_no_problem():
text = (WORKFLOW_DIRS[1] / "code-metrics.yml").read_text(encoding="utf-8")
assert tools_ref_problems(text, current_major(), lambda tag, path: True) == []
-1
View File
@@ -13,7 +13,6 @@ WORKFLOW_DIRS = (
) )
SYNC_WORKFLOW = WORKFLOW_DIRS[0] / "sync-github-metadata.yml" SYNC_WORKFLOW = WORKFLOW_DIRS[0] / "sync-github-metadata.yml"
SYNC_SCRIPT = REPO_ROOT / "tools" / "sync_github_metadata.py" SYNC_SCRIPT = REPO_ROOT / "tools" / "sync_github_metadata.py"
PUBLISH_WORKFLOW = WORKFLOW_DIRS[0] / "publish-wiki.yml"
PUBLISH_SCRIPT = REPO_ROOT / "tools" / "publish_wiki.py" PUBLISH_SCRIPT = REPO_ROOT / "tools" / "publish_wiki.py"
_HEREDOC = re.compile( _HEREDOC = re.compile(
+228
View File
@@ -0,0 +1,228 @@
"""Read a Cobertura coverage report and write the code metrics badges (ADR-0010).
Usage:
python tools/badges.py --metrics code-metrics.json --output-dir DIR
[--coverage-report coverage.xml] [--coverage-warn 60] [--coverage-good 80]
Writes `code-files.svg`, `code-lines.svg`, `code-metrics.json` and, when a report
is given, `coverage.svg` into DIR. The same input gives the same bytes.
Exit codes: 0 written, 1 a configuration problem (printed as
`::error::[configuration] ...`, nothing is written).
"""
import argparse
import json
import sys
import xml.etree.ElementTree as ElementTree
from decimal import ROUND_HALF_UP, Decimal, InvalidOperation
from pathlib import Path
BLUE = "#007ec6"
RED = "#e05d44"
YELLOW = "#dfb317"
GREEN = "#44cc11"
LABEL_COLOR = "#555555"
CHAR_WIDTH = 6
PADDING = 10
HEIGHT = 20
class ConfigurationError(Exception):
"""An input is invalid; the message is printed as a `[configuration]` failure."""
def read_coverage(path: Path) -> int:
"""Return the line coverage of a Cobertura XML report as a whole percent, half up."""
if not path.is_file():
raise ConfigurationError(f"coverage-report '{path.as_posix()}' does not exist.")
data = path.read_bytes()
if b"<!ENTITY" in data:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' declares entities, which are refused."
)
try:
root = ElementTree.fromstring(data)
except ElementTree.ParseError as error:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' is not well-formed XML: {error}."
) from error
if root.tag != "coverage":
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' is not a Cobertura report (root element '{root.tag}')."
)
covered, valid = root.get("lines-covered"), root.get("lines-valid")
try:
if covered is not None and valid is not None:
covered_lines, valid_lines = int(covered), int(valid)
if valid_lines <= 0:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' has no valid lines."
)
if not 0 <= covered_lines <= valid_lines:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' has lines-covered outside 0..lines-valid."
)
fraction = Decimal(covered_lines) / Decimal(valid_lines)
else:
rate = root.get("line-rate")
if rate is None:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' has neither lines-valid and lines-covered nor line-rate."
)
fraction = Decimal(rate)
if not Decimal(0) <= fraction <= Decimal(1):
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' has a line-rate outside 0..1."
)
except (ValueError, InvalidOperation) as error:
raise ConfigurationError(
f"coverage-report '{path.as_posix()}' has a value that is not a number."
) from error
return int((fraction * 100).quantize(Decimal(1), rounding=ROUND_HALF_UP))
def coverage_color(percent: int, warn: float, good: float) -> str:
"""Return red below warn, yellow from warn to below good, green from good."""
if percent < warn:
return RED
if percent < good:
return YELLOW
return GREEN
def _luminance(color: str) -> float:
channels = [int(color[i : i + 2], 16) / 255 for i in (1, 3, 5)]
linear = [
c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4 for c in channels
]
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2]
def _text_color(background: str) -> str:
"""Black or white, whichever has the higher contrast on the background."""
lum = _luminance(background)
return "#ffffff" if (1.05 / (lum + 0.05)) >= ((lum + 0.05) / 0.05) else "#000000"
def _escape(text: str) -> str:
return (
text.replace("&", "&amp;")
.replace("<", "&lt;")
.replace(">", "&gt;")
.replace('"', "&quot;")
)
def render(label: str, value: str, color: str) -> str:
"""Return a flat two-part SVG badge; the width follows the number of characters."""
label_width = CHAR_WIDTH * len(label) + PADDING
value_width = CHAR_WIDTH * len(value) + PADDING
total = label_width + value_width
text = _escape(f"{label}: {value}")
label_x = label_width / 2
value_x = label_width + value_width / 2
return (
f'<svg xmlns="http://www.w3.org/2000/svg" width="{total}" height="{HEIGHT}" '
f'role="img" aria-label="{text}">\n'
f"<title>{text}</title>\n"
f'<rect width="{label_width}" height="{HEIGHT}" fill="{LABEL_COLOR}"/>\n'
f'<rect x="{label_width}" width="{value_width}" height="{HEIGHT}" fill="{color}"/>\n'
'<g font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11" '
'text-anchor="middle">\n'
f'<text x="{label_x:g}" y="14" fill="{_text_color(LABEL_COLOR)}">{_escape(label)}</text>\n'
f'<text x="{value_x:g}" y="14" fill="{_text_color(color)}">{_escape(value)}</text>\n'
"</g>\n"
"</svg>\n"
)
def _threshold(name: str, text: str) -> float:
try:
value = float(text)
except ValueError as error:
raise ConfigurationError(
f"{name} '{text}' is not a number from 0 to 100."
) from error
if not 0 <= value <= 100:
raise ConfigurationError(f"{name} '{text}' is not a number from 0 to 100.")
return value
def write_badges(
file_count: int,
line_count: int,
metrics_json: str,
output_dir: Path,
coverage: int | None,
warn: float,
good: float,
) -> list[Path]:
"""Write the badge files and the metrics JSON; return the paths in a fixed order."""
output_dir.mkdir(parents=True, exist_ok=True)
files = {
"code-files.svg": render("code files", f"{file_count:,}", BLUE),
"code-lines.svg": render("lines of code", f"{line_count:,}", BLUE),
}
if coverage is not None:
files["coverage.svg"] = render(
"coverage", f"{coverage}%", coverage_color(coverage, warn, good)
)
files["code-metrics.json"] = metrics_json
paths = []
for name, content in files.items():
path = output_dir / name
path.write_text(content, encoding="utf-8", newline="\n")
paths.append(path)
return paths
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--metrics", required=True, help="JSON written by count_loc.py")
parser.add_argument("--output-dir", required=True)
parser.add_argument("--coverage-report", default="")
parser.add_argument("--coverage-warn", default="60")
parser.add_argument("--coverage-good", default="80")
args = parser.parse_args(argv)
try:
warn = _threshold("coverage-warn", args.coverage_warn)
good = _threshold("coverage-good", args.coverage_good)
if warn > good:
raise ConfigurationError(
f"coverage-warn {args.coverage_warn} is above coverage-good {args.coverage_good}."
)
coverage = (
read_coverage(Path(args.coverage_report)) if args.coverage_report else None
)
metrics = json.loads(Path(args.metrics).read_text(encoding="utf-8"))
file_count, line_count = int(metrics["files"]), int(metrics["lines"])
except ConfigurationError as error:
print(f"::error::[configuration] {error}")
return 1
except (OSError, ValueError, KeyError, TypeError) as error:
print(
f"::error::[configuration] metrics file '{args.metrics}' cannot be read: {error}"
)
return 1
if file_count == 0:
print("::notice::No code files were found; the badges show 0.")
if coverage is None:
print("::notice::No coverage-report given; no coverage badge is written.")
metrics_json = json.dumps(metrics, indent=2, sort_keys=True) + "\n"
written = write_badges(
file_count,
line_count,
metrics_json,
Path(args.output_dir),
coverage,
warn,
good,
)
for path in written:
print(f"wrote {path}")
return 0
if __name__ == "__main__":
sys.exit(main())
+5 -3
View File
@@ -46,6 +46,7 @@ PAGES: tuple[Page, ...] = (
Page("QualityChecksPythonShell", "guides/quality-checks.md"), Page("QualityChecksPythonShell", "guides/quality-checks.md"),
Page("QualityChecksCpp", "guides/quality-checks-cpp.md"), Page("QualityChecksCpp", "guides/quality-checks-cpp.md"),
Page("QualityChecksCSharp", "guides/quality-checks-csharp.md"), Page("QualityChecksCSharp", "guides/quality-checks-csharp.md"),
Page("CodeMetrics", "guides/code-metrics.md"),
Page("Upgrading", "guides/upgrading.md"), Page("Upgrading", "guides/upgrading.md"),
Page("Capabilities", "README.md", ("Capabilities",)), Page("Capabilities", "README.md", ("Capabilities",)),
) )
@@ -66,6 +67,7 @@ _PAGE_FOR_SOURCE = {
"guides/quality-checks.md": "QualityChecksPythonShell", "guides/quality-checks.md": "QualityChecksPythonShell",
"guides/quality-checks-cpp.md": "QualityChecksCpp", "guides/quality-checks-cpp.md": "QualityChecksCpp",
"guides/quality-checks-csharp.md": "QualityChecksCSharp", "guides/quality-checks-csharp.md": "QualityChecksCSharp",
"guides/code-metrics.md": "CodeMetrics",
"guides/upgrading.md": "Upgrading", "guides/upgrading.md": "Upgrading",
} }
@@ -191,9 +193,9 @@ def render_page(page: Page, repo_root: Path = REPO_ROOT) -> str:
# Link text of the sidebar: English, then one list per translation code. # Link text of the sidebar: English, then one list per translation code.
SIDEBAR_TITLE = "TirSystem GitHub Actions" SIDEBAR_TITLE = "TirSystem GitHub Actions"
SIDEBAR_LABELS: dict[str, tuple[str, ...]] = { SIDEBAR_LABELS: dict[str, tuple[str, ...]] = {
"en": ("Home", "Onboarding", "Credentials", "Troubleshooting", "Quality checks (Python, shell)", "Quality checks (C and C++)", "Quality checks (C#)", "Upgrading", "Capabilities"), "en": ("Home", "Onboarding", "Credentials", "Troubleshooting", "Quality checks (Python, shell)", "Quality checks (C and C++)", "Quality checks (C#)", "Code metrics", "Upgrading", "Capabilities"),
"da": ("Hjem", "Tilslutning", "Credentials", "Fejlfinding", "Kvalitetskontrol (Python, shell)", "Kvalitetskontrol (C og C++)", "Kvalitetskontrol (C#)", "Opgradering", "Kapabiliteter"), "da": ("Hjem", "Tilslutning", "Credentials", "Fejlfinding", "Kvalitetskontrol (Python, shell)", "Kvalitetskontrol (C og C++)", "Kvalitetskontrol (C#)", "Kodemålinger", "Opgradering", "Kapabiliteter"),
"ms": ("Utama", "Menyertakan", "Kelayakan", "Diagnosis", "Semakan kualiti (Python, shell)", "Semakan kualiti (C dan C++)", "Semakan kualiti (C#)", "Menaik taraf", "Keupayaan"), "ms": ("Utama", "Menyertakan", "Kelayakan", "Diagnosis", "Semakan kualiti (Python, shell)", "Semakan kualiti (C dan C++)", "Semakan kualiti (C#)", "Metrik kod", "Menaik taraf", "Keupayaan"),
} }
SIDEBAR_NAME = "_Sidebar.md" SIDEBAR_NAME = "_Sidebar.md"
+137
View File
@@ -0,0 +1,137 @@
#!/usr/bin/env bash
# Steps of the reusable workflow .gitea/workflows/code-metrics.yml (ADR-0010).
# The workflow checks out the calling repository, fetches this file into
# shared-scripts/ and runs one command per step:
#
# code-metrics.sh validate check the inputs, before anything is counted
# code-metrics.sh measure count the code, read the coverage report and
# write the badge files (count_loc.py, badges.py)
# code-metrics.sh publish commit the badge files to the badges branch,
# and nothing when none of them changed
#
# Settings come from the environment, never from interpolated expressions:
# WORKING_DIRECTORY, EXCLUDE, COVERAGE_REPORT, COVERAGE_ARTIFACT,
# COVERAGE_WARN, COVERAGE_GOOD, BADGES_BRANCH, BADGES_OUT (the directory of the badge files; a temporary
# directory under RUNNER_TEMP by default).
# Every failure is printed as ::error::[category] message.
TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUT_DIR="${BADGES_OUT:-${RUNNER_TEMP:-/tmp}/code-metrics}"
ALLOWED_FILES='^(code-files\.svg|code-lines\.svg|coverage\.svg|code-metrics\.json)$'
COMMIT_MESSAGE="Update code metrics badges [skip ci]"
fail() {
echo "::error::[configuration] $1"
exit 1
}
relative_path() {
case "$1" in
"" | /* | .. | ../* | */.. | */../*) return 1 ;;
esac
}
validate_inputs() {
set -u
relative_path "$WORKING_DIRECTORY" ||
fail "working-directory must be a relative path inside the repository."
[ -d "$WORKING_DIRECTORY" ] ||
fail "working-directory '$WORKING_DIRECTORY' does not exist."
if [ -n "$COVERAGE_REPORT" ]; then
relative_path "$COVERAGE_REPORT" ||
fail "coverage-report must be a relative path inside the repository."
fi
if [ -n "$COVERAGE_ARTIFACT" ] && [ -z "$COVERAGE_REPORT" ]; then
fail "coverage-artifact '$COVERAGE_ARTIFACT' needs coverage-report, the file inside the artifact."
fi
case "$BADGES_BRANCH" in
main | master | HEAD | "") fail "badges-branch '$BADGES_BRANCH' must not be a default branch." ;;
esac
git check-ref-format --branch "$BADGES_BRANCH" > /dev/null 2>&1 ||
fail "badges-branch '$BADGES_BRANCH' is not a valid branch name."
echo "Counting ${WORKING_DIRECTORY}; badges go to the branch ${BADGES_BRANCH}"
}
measure() {
set -eu
metrics="$(mktemp)"
python3 "$TOOLS_DIR/count_loc.py" \
--directory "$WORKING_DIRECTORY" --exclude "$EXCLUDE" --output "$metrics"
rm -rf "$OUT_DIR"
report="$COVERAGE_REPORT"
if [ -n "$COVERAGE_ARTIFACT" ]; then
report="coverage-artifact/$COVERAGE_REPORT"
fi
python3 "$TOOLS_DIR/badges.py" \
--metrics "$metrics" --output-dir "$OUT_DIR" \
--coverage-report "$report" \
--coverage-warn "$COVERAGE_WARN" --coverage-good "$COVERAGE_GOOD"
rm -f "$metrics"
}
# Copy the badge files into the worktree and stage them; return 0 when
# something differs from the branch.
stage_files() {
local worktree="$1" file
for file in "$OUT_DIR"/*; do
cp "$file" "$worktree/$(basename "$file")"
done
git -C "$worktree" add -- .
! git -C "$worktree" diff --cached --quiet
}
commit_files() {
git -C "$1" -c user.name="code-metrics" -c user.email="code-metrics@invalid" \
commit --quiet -m "$COMMIT_MESSAGE"
}
publish() {
set -eu
[ -d "$OUT_DIR" ] || fail "no badge files in '$OUT_DIR'; run measure first."
local worktree exists=0 committed=0 attempt
worktree="$(mktemp -d)"
if git fetch --quiet origin "+refs/heads/$BADGES_BRANCH:refs/remotes/origin/$BADGES_BRANCH" 2> /dev/null; then
exists=1
if git ls-tree -r --name-only "origin/$BADGES_BRANCH" | grep -qvE "$ALLOWED_FILES"; then
fail "branch '$BADGES_BRANCH' holds files that are not badge files; it is not a badges branch."
fi
git worktree add --quiet --detach "$worktree" "origin/$BADGES_BRANCH"
else
git worktree add --quiet --detach "$worktree" HEAD
git -C "$worktree" checkout --quiet --orphan "$BADGES_BRANCH"
git -C "$worktree" rm -rfq --ignore-unmatch .
fi
for attempt in 1 2; do
if [ "$committed" -eq 0 ]; then
if stage_files "$worktree"; then
commit_files "$worktree"
committed=1
elif [ "$exists" -eq 1 ]; then
echo "Badges are current; nothing to commit."
break
fi
fi
if git -C "$worktree" push --quiet origin "HEAD:refs/heads/$BADGES_BRANCH"; then
echo "Published the badges to the branch ${BADGES_BRANCH}."
break
fi
[ "$attempt" -lt 2 ] || fail "the push to '$BADGES_BRANCH' failed twice."
if git fetch --quiet origin "+refs/heads/$BADGES_BRANCH:refs/remotes/origin/$BADGES_BRANCH" 2> /dev/null; then
git -C "$worktree" reset --quiet --hard "origin/$BADGES_BRANCH"
exists=1
committed=0
fi
done
git worktree remove --force "$worktree"
}
case "${1:-}" in
validate) validate_inputs ;;
measure) measure ;;
publish) publish ;;
*)
echo "::error::[configuration] usage: code-metrics.sh validate|measure|publish" >&2
exit 2
;;
esac
+375
View File
@@ -0,0 +1,375 @@
"""Count the code files and the lines of code of a directory (ADR-0010).
A code file is a text file whose extension is in LANGUAGES. Every physical line
of it is exactly one of blank, comment or code; the lines of code are the code
lines only. The result is JSON:
{"files": 3, "lines": 120, "comment": 14, "blank": 22,
"languages": {"Python": {"files": 2, "lines": 100, "comment": 10, "blank": 20}}}
Usage:
python tools/count_loc.py [--directory DIR] [--exclude PATTERNS] [--output FILE]
Exit codes: 0 counted, 1 the directory is not a directory (printed as
`::error::[configuration] ...`).
"""
import argparse
import json
import os
import re
import sys
from dataclasses import dataclass
from pathlib import Path
DEFAULT_EXCLUDED_DIRS = frozenset(
{
"node_modules",
"vendor",
"third_party",
"dist",
"build",
"out",
"bin",
"obj",
"target",
"venv",
"__pycache__",
"shared-scripts",
}
)
_C_STYLE_CHAR = re.compile(r"'(?:\\.[^']*|[^'\\])'")
@dataclass(frozen=True)
class Language:
"""The comment and string rules of one language."""
name: str
extensions: tuple[str, ...]
line_comment: str | None = None
block: tuple[str, str] | None = None
nested_block: bool = False
hash_at_word_start: bool = False
triple_quotes: bool = False
backtick_strings: bool = False
single_quote: str = (
"string" # "string", "char" (a literal of one character) or "none"
)
backslash_escapes: bool = True
escapes_in_single_quotes: bool = True
def _c_family(name: str, *extensions: str, single_quote: str = "char") -> Language:
return Language(
name,
extensions,
line_comment="//",
block=("/*", "*/"),
single_quote=single_quote,
)
LANGUAGES: tuple[Language, ...] = (
Language("Python", (".py",), line_comment="#", triple_quotes=True),
Language(
"Shell",
(".sh", ".bash"),
line_comment="#",
hash_at_word_start=True,
escapes_in_single_quotes=False,
),
Language(
"PowerShell",
(".ps1", ".psm1"),
line_comment="#",
block=("<#", "#>"),
hash_at_word_start=True,
backslash_escapes=False,
),
_c_family("C", ".c", ".h"),
_c_family("C++", ".cc", ".cpp", ".cxx", ".hh", ".hpp"),
_c_family("C#", ".cs"),
_c_family("Java", ".java"),
Language(
"JavaScript",
(".js", ".mjs", ".jsx"),
line_comment="//",
block=("/*", "*/"),
backtick_strings=True,
),
Language(
"TypeScript",
(".ts", ".tsx"),
line_comment="//",
block=("/*", "*/"),
backtick_strings=True,
),
Language(
"Go",
(".go",),
line_comment="//",
block=("/*", "*/"),
backtick_strings=True,
single_quote="char",
),
Language(
"Rust",
(".rs",),
line_comment="//",
block=("/*", "*/"),
nested_block=True,
single_quote="char",
),
Language(
"SQL",
(".sql",),
line_comment="--",
block=("/*", "*/"),
backslash_escapes=False,
),
)
_BY_EXTENSION = {ext: language for language in LANGUAGES for ext in language.extensions}
_WORD_START = " \t;|&("
def language_of(path: str) -> Language | None:
"""Return the language of a file name by its extension, or None."""
return _BY_EXTENSION.get(os.path.splitext(path)[1].lower())
@dataclass
class _State:
block_depth: int = 0
triple: str | None = None
backtick: bool = False
def _skip_string(line: str, start: int, quote: str, escapes: bool) -> int:
"""Return the index after the string that opens at start; the end of line if unclosed."""
i = start + 1
while i < len(line):
char = line[i]
if escapes and char == "\\":
i += 2
continue
if char == quote:
return i + 1
i += 1
return len(line)
def _scan_line(line: str, language: Language, state: _State) -> tuple[bool, bool]:
"""Scan one line; return (has_code, has_comment) and update the state."""
has_code = False
has_comment = False
i = 0
size = len(line)
block = language.block
while i < size:
if state.block_depth:
assert block is not None
has_comment = True
end = line.find(block[1], i)
nested = line.find(block[0], i) if language.nested_block else -1
if nested != -1 and (end == -1 or nested < end):
state.block_depth += 1
i = nested + len(block[0])
elif end == -1:
return has_code, has_comment
else:
state.block_depth -= 1
i = end + len(block[1])
continue
if state.triple is not None:
has_code = True
end = line.find(state.triple, i)
if end == -1:
return has_code, has_comment
i = end + len(state.triple)
state.triple = None
continue
if state.backtick:
has_code = True
end = line.find("`", i)
if end == -1:
return has_code, has_comment
i = end + 1
state.backtick = False
continue
char = line[i]
if char in " \t\r\f\v":
i += 1
continue
if block is not None and line.startswith(block[0], i):
state.block_depth = 1
has_comment = True
i += len(block[0])
continue
comment = language.line_comment
if comment is not None and line.startswith(comment, i):
word_start = i == 0 or line[i - 1] in _WORD_START
if word_start or not language.hash_at_word_start:
return has_code, True
if language.triple_quotes and (
line.startswith('"""', i) or line.startswith("'''", i)
):
state.triple = line[i : i + 3]
has_code = True
i += 3
continue
if char == '"':
has_code = True
i = _skip_string(line, i, '"', language.backslash_escapes)
continue
if char == "'" and language.single_quote == "string":
has_code = True
escapes = language.backslash_escapes and language.escapes_in_single_quotes
i = _skip_string(line, i, "'", escapes)
continue
if char == "'" and language.single_quote == "char":
has_code = True
literal = _C_STYLE_CHAR.match(line, i)
i = literal.end() if literal else i + 1
continue
if char == "`" and language.backtick_strings:
has_code = True
end = line.find("`", i + 1)
if end == -1:
state.backtick = True
return has_code, has_comment
i = end + 1
continue
has_code = True
i += 1
return has_code, has_comment
def classify_text(text: str, language: Language) -> tuple[int, int, int]:
"""Return (code, comment, blank) line counts of the text of a file."""
lines = text.replace("\r\n", "\n").replace("\r", "\n").split("\n")
if lines and lines[-1] == "":
lines.pop()
state = _State()
code = comment = blank = 0
for line in lines:
has_code, _ = _scan_line(line, language, state)
if line.strip() == "":
blank += 1
elif has_code:
code += 1
else:
comment += 1
return code, comment, blank
def _pattern_regex(pattern: str) -> re.Pattern[str]:
"""Translate an exclude pattern: `*` stops at `/`, `**` crosses it, `?` is one character."""
out = []
i = 0
while i < len(pattern):
char = pattern[i]
if pattern.startswith("**", i):
out.append(".*")
i += 2
continue
out.append(
"[^/]*" if char == "*" else "[^/]" if char == "?" else re.escape(char)
)
i += 1
return re.compile("".join(out) + r"\Z")
class Excludes:
"""The exclude patterns of the caller; a pattern without `/` matches a name anywhere."""
def __init__(self, patterns: list[str]) -> None:
self._names: list[re.Pattern[str]] = []
self._paths: list[re.Pattern[str]] = []
for pattern in patterns:
pattern = pattern.strip().strip("/")
if not pattern:
continue
target = self._paths if "/" in pattern else self._names
target.append(_pattern_regex(pattern))
def matches(self, name: str, relative: str) -> bool:
return any(rx.match(name) for rx in self._names) or any(
rx.match(relative) for rx in self._paths
)
def _is_text(data: bytes) -> bool:
return b"\x00" not in data
def count(directory: Path, patterns: list[str] | None = None) -> dict[str, object]:
"""Count the code files under directory; see the module docstring for the result."""
excludes = Excludes(patterns or [])
totals = {"files": 0, "lines": 0, "comment": 0, "blank": 0}
per_language: dict[str, dict[str, int]] = {}
root = str(directory)
for current, dirs, files in os.walk(root, followlinks=False):
relative_dir = os.path.relpath(current, root).replace(os.sep, "/")
prefix = "" if relative_dir == "." else relative_dir + "/"
dirs[:] = sorted(
name
for name in dirs
if not name.startswith(".")
and name not in DEFAULT_EXCLUDED_DIRS
and not excludes.matches(name, prefix + name)
)
for name in sorted(files):
full = os.path.join(current, name)
language = language_of(name)
if (
language is None
or os.path.islink(full)
or excludes.matches(name, prefix + name)
):
continue
data = Path(full).read_bytes()
if not _is_text(data):
continue
text = data.decode("utf-8", errors="replace").lstrip("")
code, comment, blank = classify_text(text, language)
entry = per_language.setdefault(
language.name, {"files": 0, "lines": 0, "comment": 0, "blank": 0}
)
for target in (entry, totals):
target["files"] += 1
target["lines"] += code
target["comment"] += comment
target["blank"] += blank
return {**totals, "languages": dict(sorted(per_language.items()))}
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument(
"--directory", default=".", help="directory to count (default .)"
)
parser.add_argument("--exclude", default="", help="comma list of exclude patterns")
parser.add_argument(
"--output", help="write the JSON here instead of standard output"
)
args = parser.parse_args(argv)
directory = Path(args.directory)
if not directory.is_dir():
print(
f"::error::[configuration] working-directory '{args.directory}' does not exist."
)
return 1
result = count(directory, [p for p in args.exclude.split(",") if p.strip()])
text = json.dumps(result, indent=2, sort_keys=True) + "\n"
if args.output:
Path(args.output).write_text(text, encoding="utf-8", newline="\n")
else:
sys.stdout.write(text)
return 0
if __name__ == "__main__":
sys.exit(main())
+10 -44
View File
@@ -1,19 +1,15 @@
"""Publish the pages of a folder to the Gitea wiki of the repository. """Publish the pages of a folder to the Gitea wiki of the repository.
Run by the reusable workflow publish-wiki.yml, which a repository calls Run by the reusable workflow publish-wiki-pages.yml, which a repository calls
(MIL-008), and by the scoped workflow of the same name until it is removed. (ADR-0009). The caller is the opt-in: the workflow sets WIKI_PRUNE and the
The reusable workflow sets WIKI_PRUNE: the caller is the opt-in, and the folder must exist. It reads its settings from the environment:
folder must exist. The scoped workflow leaves WIKI_PRUNE unset: a repository
publishes only when it has opted in with WIKI_DIR/.publish (ADR-0004), and the
word prune in that file lets the run delete wiki pages that are not in the
folder. It reads its settings from the environment:
GITEA_API_URL Gitea API base, for example https://host/api/v1 GITEA_API_URL Gitea API base, for example https://host/api/v1
SOURCE_REPOSITORY owner/repo of the repository whose wiki is written SOURCE_REPOSITORY owner/repo of the repository whose wiki is written
WIKI_CREDENTIALS the Gitea token, as clear text (TOKEN_FOR_GITEA_WIKI) WIKI_CREDENTIALS the Gitea token, as clear text (TOKEN_FOR_GITEA_WIKI)
WIKI_DIR directory with the pages (default: wiki) WIKI_DIR directory with the pages (default: docs/wiki)
WIKI_PRUNE true or false: delete pages that are not in the WIKI_PRUNE true or false, required: delete pages that are not in
folder; when set, no .publish marker is read the folder
Every failure is printed as ``ERROR: [category] message`` with the categories Every failure is printed as ``ERROR: [category] message`` with the categories
configuration, credentials, permissions and api; no secret value is printed. configuration, credentials, permissions and api; no secret value is printed.
@@ -32,8 +28,7 @@ from pathlib import Path
PAGE_LIMIT = 50 PAGE_LIMIT = 50
REQUEST_TIMEOUT_SECONDS = 30 REQUEST_TIMEOUT_SECONDS = 30
COMMIT_MESSAGE = "Publish wiki from the repository" COMMIT_MESSAGE = "Publish wiki from the repository"
MARKER_NAME = ".publish" DEFAULT_WIKI_DIR = "docs/wiki"
PRUNE_WORD = "prune"
class WorkflowError(RuntimeError): class WorkflowError(RuntimeError):
@@ -81,19 +76,6 @@ def request_json(url, method="GET", headers=None, body=None):
raise WorkflowError("api", f"Gitea API is unreachable ({error}).") from None raise WorkflowError("api", f"Gitea API is unreachable ({error}).") from None
def parse_marker(text):
"""Return True when the marker asks for pruning, False when it is empty."""
word = (text or "").strip()
if not word:
return False
if word == PRUNE_WORD:
return True
raise WorkflowError(
"configuration",
f"wiki/{MARKER_NAME} may only be empty or contain the word '{PRUNE_WORD}'.",
)
def parse_prune_setting(text): def parse_prune_setting(text):
"""Return the boolean of the WIKI_PRUNE input: true or false, nothing else.""" """Return the boolean of the WIKI_PRUNE input: true or false, nothing else."""
word = (text or "").strip().lower() word = (text or "").strip().lower()
@@ -254,21 +236,10 @@ def publish(pages, wiki_url, headers, send, prune):
def main(): def main():
wiki_dir = Path(os.environ.get("WIKI_DIR", "wiki")) wiki_dir = Path(os.environ.get("WIKI_DIR", DEFAULT_WIKI_DIR))
owner, repo = split_repository(os.environ.get("SOURCE_REPOSITORY")) owner, repo = split_repository(os.environ.get("SOURCE_REPOSITORY"))
prune_setting = os.environ.get("WIKI_PRUNE") prune = parse_prune_setting(os.environ.get("WIKI_PRUNE"))
if prune_setting is None:
marker = wiki_dir / MARKER_NAME
if not marker.is_file():
print(
f"No {wiki_dir}/{MARKER_NAME} marker in {owner}/{repo}; "
"wiki publishing is not enabled for this repository."
)
return 0
prune = parse_marker(marker.read_text(encoding="utf-8"))
else:
prune = parse_prune_setting(prune_setting)
if not wiki_dir.is_dir(): if not wiki_dir.is_dir():
raise WorkflowError( raise WorkflowError(
"configuration", "configuration",
@@ -316,12 +287,7 @@ def main():
if result["kept"]: if result["kept"]:
print( print(
f"{len(result['kept'])} page(s) are in the wiki but not in " f"{len(result['kept'])} page(s) are in the wiki but not in "
f"{wiki_dir}/ and were kept; " f"{wiki_dir}/ and were kept; set the prune input to true to delete them."
+ (
f"put the word '{PRUNE_WORD}' in {wiki_dir}/{MARKER_NAME} to delete them."
if prune_setting is None
else "set the prune input to true to delete them."
)
) )
return 0 return 0