From 9e3264a9e3f97df0471bddbae6422d620b549a7d Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 15:52:46 +0100 Subject: [PATCH 01/35] feat(coverage): support native GitHub Code Quality reports --- .github/renovate.json | 7 +++ .github/workflows/__shared-ci.yml | 1 + ...__test-workflow-continuous-integration.yml | 13 +++++ .github/workflows/continuous-integration.yml | 28 +++++++++-- actions/test/action.test.cjs | 2 +- actions/test/action.yml | 48 +++++++++++++++++-- tests/config.test.cjs | 21 ++++++++ 7 files changed, 110 insertions(+), 10 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index fe4ec8a..fcff3ea 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -31,6 +31,13 @@ ], "datasourceTemplate": "github-releases", "depNameTemplate": "golangci/golangci-lint" + }, + { + "customType": "regex", + "managerFilePatterns": ["/^actions/test/action\\.yml$/"], + "matchStrings": ["GOCOVER_COBERTURA_VERSION: (?v[^\\s]+)"], + "datasourceTemplate": "go", + "depNameTemplate": "github.com/boumenot/gocover-cobertura" } ] } diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index e11f26f..e9b90f3 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -23,6 +23,7 @@ jobs: uses: $/.github/workflows/__test-workflow-continuous-integration.yml permissions: contents: read + pull-requests: write id-token: write test-action-setup-go: uses: $/.github/workflows/__test-action-setup-go.yml diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 7f94995..198b78a 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -26,6 +26,7 @@ jobs: id-token: write with: working-directory: tests/go-project + test: '{"coverage":"github-code-quality","report-group":"fixture"}' go-versions: '["1.26", "1.27"]' dependency-review: false checks-disabled: @@ -38,3 +39,15 @@ jobs: working-directory: must-not-exist lint: exit 99 test: exit 99 + + collect-native-coverage: + name: Verify coverage from the primary runtime + needs: fixture + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@71ce8b3ff53d6673617b19fa01d6637c916d4948 # coverage support (PR #683, unreleased) + permissions: + contents: read + pull-requests: write + with: + comment: false + job-results: ${{ toJSON(needs) }} + coverage-reports: '[{"job":"fixture","label":"tests/go-project"}]' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9539d4f..02dfd0b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -92,6 +92,18 @@ # for standalone action usage. Pin the workflow to a reviewed commit SHA in production. --- +# +# ## Native GitHub coverage +# +# Select `test: '{"coverage":"github-code-quality","report-group":"backend"}'`. +# This tests the PR head commit; existing destinations keep their usual merge-ref +# checkout. Keep a separate merge-result test invocation when your policy requires it. +# Only the primary runtime publishes coverage. Optionally set test.coverage-reports +# to an array of {file, language, label} for multiple Cobertura components. +# Call the common ci-reports workflow with every expected job/label, then its +# publish-coverage workflow. Only publication needs code-quality: write. +# See [native coverage collection](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md#native-github-coverage). + name: Go Continuous Integration "on": workflow_call: @@ -117,7 +129,7 @@ name: Go Continuous Integration type: string default: "true" test: - description: true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty), and race (boolean). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection. + description: "true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage." type: string default: "true" audit: @@ -179,13 +191,14 @@ jobs: if (unknown.length) throw new Error('Unknown ' + name + ' options: ' + unknown.join(', ')); config = {...defaults, ...config}; for (const [key, value] of Object.entries(config)) { - if (typeof value !== typeof defaults[key]) throw new Error(name + '.' + key + ' has the wrong type.'); + if (Array.isArray(defaults[key]) ? !Array.isArray(value) : typeof value !== typeof defaults[key]) throw new Error(name + '.' + key + ' has the wrong type.'); } return config; } const lint = options('lint', process.env.LINT, {command: ''}); - const test = options('test', process.env.TEST, {"command": "", "coverage": "github", "race": true}); - if (test && !['', 'github', 'codecov'].includes(test.coverage)) throw new Error('test.coverage must be github, codecov or empty.'); + const test = options('test', process.env.TEST, {"command": "", "coverage": "github", "race": true, "coverage-reports": [], "report-group": ""}); + if (test && test['report-group'] && !/^[\w-]+$/.test(test['report-group'])) throw new Error('test.report-group must be a job ID.'); + if (test && !['', 'github', 'github-code-quality', 'codecov'].includes(test.coverage)) throw new Error('test.coverage must be github, github-code-quality, codecov or empty.'); const build = options('build', process.env.BUILD, {command: 'go build -mod=readonly -trimpath ./...', artifact: ''}); const artifact = build?.artifact; if (artifact && (artifact === '.' || artifact.startsWith('/') || artifact.includes('\\') || artifact.split('/').includes('..') || /[\r\n*?]/.test(artifact))) { @@ -236,7 +249,10 @@ jobs: contents: read id-token: write steps: - - *checkout + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ fromJSON(needs.configuration.outputs.test).coverage == 'github-code-quality' && github.event.pull_request.head.sha || github.sha }} + persist-credentials: false - uses: $/actions/setup-go with: working-directory: ${{ inputs.working-directory }} @@ -245,6 +261,8 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.test).command }} + report-group: ${{ fromJSON(needs.configuration.outputs.test).report-group }} + coverage-reports: ${{ fromJSON(needs.configuration.outputs.test).coverage-reports[0] && toJSON(fromJSON(needs.configuration.outputs.test).coverage-reports) || '' }} coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage || '' }} race: ${{ fromJSON(needs.configuration.outputs.test).race }} strategy: diff --git a/actions/test/action.test.cjs b/actions/test/action.test.cjs index 25ba88b..b7b512b 100644 --- a/actions/test/action.test.cjs +++ b/actions/test/action.test.cjs @@ -36,7 +36,7 @@ test("test configuration rejects unsupported coverage destinations", (t) => { ); assert.equal( runActionStep(actionFile, "validate", directory, { - COVERAGE: "", + COVERAGE: "github-code-quality", RACE: "true", }).status, 0, diff --git a/actions/test/action.yml b/actions/test/action.yml index 26de574..77c49e3 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -31,6 +31,15 @@ description: | See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions. + + Native `coverage: github-code-quality` prepares Cobertura artifacts for the common + [CI reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md) + and its opt-in publication workflow. Set `report-group` to the outer calling job + and list every expected component in the collector. The default label is the + repository-relative working directory, or `root`. Multiple reports need explicit + stable labels. Reports must measure the PR head commit, not the PR merge commit. + Keep merge-result validation separately when required. No upload permission is + needed in this test action; only the publication job needs `code-quality: write`. author: hoverkraft branding: icon: package @@ -45,8 +54,15 @@ inputs: race: description: Enable the race detector for the default command. Requires CGO and a C compiler. default: "true" + coverage-reports: + description: | + Native GitHub coverage reports as a JSON array of file, language and optional label. + Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. + Every file must be Cobertura XML produced by the test command. Paths are relative + to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. + default: "" coverage: - description: "Publication only: `github` (native go tool cover summary), `codecov`, or empty. Collection is controlled by the test command." + description: "Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command." default: github report-group: description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. @@ -55,6 +71,9 @@ outputs: report-artifact-id: description: Native report artifact ID. Empty when no reports were produced. value: ${{ steps.report-artifact.outputs.artifact-id }} + native-coverage-artifact-id: + description: Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. + value: ${{ steps.native-coverage.outputs.artifact-id }} coverage-artifact-id: description: Native coverage.out artifact ID for GitHub coverage, or empty when unavailable. value: ${{ steps.report-artifact.outputs.coverage-artifact-id }} @@ -72,7 +91,7 @@ runs: COVERAGE: ${{ inputs.coverage }} run: | case "$RACE" in true|false) ;; *) echo 'race must be true or false.' >&2; exit 1 ;; esac - case "$COVERAGE" in github|codecov|'') ;; *) echo 'coverage must be github, codecov or empty.' >&2; exit 1 ;; esac + case "$COVERAGE" in github|github-code-quality|codecov|'') ;; *) echo 'coverage must be github, github-code-quality, codecov or empty.' >&2; exit 1 ;; esac - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -95,16 +114,28 @@ runs: args=(-mod=readonly -count=1 -timeout=5m -covermode=atomic -coverprofile=coverage.out) if [ "$RACE" = true ]; then args+=(-race); fi go run "gotest.tools/gotestsum@$GOTESTSUM_VERSION" --junitfile=junit.xml --format=testname -- "${args[@]}" ./... + - name: Convert native Go coverage to Cobertura + id: cobertura + if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github-code-quality' && inputs.coverage-reports == '' }} + shell: bash + working-directory: ${{ steps.directory.outputs.absolute-path }} + env: + GOCOVER_COBERTURA_VERSION: v1.5.0 + GOTOOLCHAIN: local + GOWORK: "off" + run: | + test -s coverage.out || { echo 'Native coverage requires coverage.out.' >&2; exit 1; } + go run "github.com/boumenot/gocover-cobertura@$GOCOVER_COBERTURA_VERSION" < coverage.out > cobertura.xml - name: Report test results id: report-artifact if: ${{ !cancelled() && steps.run.outcome != 'skipped' }} uses: $/.github/actions/parse-ci-reports with: directory: ${{ steps.directory.outputs.absolute-path }} - report-paths: auto:test + report-paths: ${{ inputs.coverage == 'github-code-quality' && 'auto:test,auto:coverage' || 'auto:test' }} report-name: Go test results group: ${{ inputs.report-group || github.job }} - native-coverage: ${{ inputs.coverage == 'github' }} + native-coverage: ${{ inputs.coverage == 'github' || inputs.coverage == 'github-code-quality' }} - id: go-coverage uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github' }} @@ -125,3 +156,12 @@ runs: working-directory: ${{ steps.directory.outputs.absolute-path }} files: coverage.out fail-ci-if-error: "true" + + - name: Prepare native GitHub coverage + id: native-coverage + if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github-code-quality' }} + uses: hoverkraft-tech/ci-github-common/actions/quality/coverage-reports@71ce8b3ff53d6673617b19fa01d6637c916d4948 # coverage support (PR #683, unreleased) + with: + working-directory: ${{ steps.directory.outputs.absolute-path }} + report-group: ${{ inputs.report-group || github.job }} + reports: ${{ inputs.coverage-reports || '[{"file":"cobertura.xml","language":"Go"}]' }} diff --git a/tests/config.test.cjs b/tests/config.test.cjs index aecdd55..52342b4 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -115,3 +115,24 @@ test("rejects unsafe build artifact directories and empty commands", async () => false, ); }); + +test("preserves native coverage configuration and rejects ambiguous input types", async () => { + const options = { + coverage: "github-code-quality", + "report-group": "backend", + "coverage-reports": [ + { file: "custom.xml", language: "Go", label: "backend" }, + ], + }; + const actual = JSON.parse( + (await parse({ TEST: JSON.stringify(options) })).test, + ); + for (const [key, value] of Object.entries(options)) + assert.deepEqual(actual[key], value); + for (const invalid of [ + { "coverage-reports": {} }, + { "report-group": "bad/group" }, + ]) { + await assert.rejects(() => parse({ TEST: JSON.stringify(invalid) })); + } +}); From 2619e785f33bbc62625e5a7aace9e657ae7e9a4f Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 15:57:10 +0100 Subject: [PATCH 02/35] docs(coverage): regenerate action and workflow references --- .github/workflows/continuous-integration.md | 28 ++++++------- actions/test/README.md | 46 +++++++++++++++------ 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index f2b93bd..455be28 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -144,7 +144,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@3a72b809f7253a916ee2f4bcee59a66bbba131d3 # main + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 permissions: contents: read id-token: write @@ -168,7 +168,7 @@ jobs: # Default: `true` lint: "true" - # true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty), and race (boolean). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection. + # true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage. # Default: `true` test: "true" @@ -197,18 +197,18 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | -| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | -| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | -| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | -| **`go-versions`** | JSON array of Go versions. The last entry runs lint, audit and build and publishes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - | -| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` | -| **`test`** | true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty), and race (boolean). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection. | **false** | **string** | `true` | -| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | -| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | -| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | +| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | +| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | +| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | +| **`go-versions`** | JSON array of Go versions. The last entry runs lint, audit and build and publishes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - | +| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage. | **false** | **string** | `true` | +| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | +| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | +| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | diff --git a/actions/test/README.md b/actions/test/README.md index 2a95a25..cbbe98b 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -60,6 +60,15 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int +Native `coverage: github-code-quality` prepares Cobertura artifacts for the common +[CI reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md) +and its opt-in publication workflow. Set `report-group` to the outer calling job +and list every expected component in the collector. The default label is the +repository-relative working directory, or `root`. Multiple reports need explicit +stable labels. Reports must measure the PR head commit, not the PR merge commit. +Keep merge-result validation separately when required. No upload permission is +needed in this test action; only the publication job needs `code-quality: write`. + @@ -70,7 +79,7 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@3a72b809f7253a916ee2f4bcee59a66bbba131d3 # main +- uses: hoverkraft-tech/ci-github-go/actions/test@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 with: # Go module directory. # Default: `.` @@ -83,7 +92,13 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int # Default: `true` race: "true" - # Publication only: `github` (native go tool cover summary), `codecov`, or empty. Collection is controlled by the test command. + # Native GitHub coverage reports as a JSON array of file, language and optional label. + # Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. + # Every file must be Cobertura XML produced by the test command. Paths are relative + # to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. + coverage-reports: "" + + # Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command. # Default: `github` coverage: github @@ -97,13 +112,17 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`command`** | Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. | **false** | - | -| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | -| **`coverage`** | Publication only: `github` (native go tool cover summary), `codecov`, or empty. Collection is controlled by the test command. | **false** | `github` | -| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`command`** | Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. | **false** | - | +| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | +| **`coverage-reports`** | Native GitHub coverage reports as a JSON array of file, language and optional label. | **false** | - | +| | Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. | | | +| | Every file must be Cobertura XML produced by the test command. Paths are relative | | | +| | to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. | | | +| **`coverage`** | Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command. | **false** | `github` | +| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - | @@ -114,10 +133,11 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Outputs -| **Output** | **Description** | -| -------------------------- | ------------------------------------------------------------------------------- | -| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. | -| **`coverage-artifact-id`** | Native coverage.out artifact ID for GitHub coverage, or empty when unavailable. | +| **Output** | **Description** | +| --------------------------------- | ----------------------------------------------------------------------------------------------- | +| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. | +| **`native-coverage-artifact-id`** | Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. | +| **`coverage-artifact-id`** | Native coverage.out artifact ID for GitHub coverage, or empty when unavailable. | From 758f62c71720f9369f759aa2441f8a2740f91d86 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 16:07:51 +0100 Subject: [PATCH 03/35] fix(coverage): consume corrected collection and isolate previews --- .github/workflows/__test-workflow-continuous-integration.yml | 3 ++- actions/test/action.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 198b78a..3e35861 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -43,11 +43,12 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: fixture - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@71ce8b3ff53d6673617b19fa01d6637c916d4948 # coverage support (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@d52648f1645f1318908149af3f35b71b897ca566 # coverage support (PR #683, unreleased) permissions: contents: read pull-requests: write with: comment: false + concurrency-group: test-native-go-${{ github.run_id }}-${{ github.run_attempt }} job-results: ${{ toJSON(needs) }} coverage-reports: '[{"job":"fixture","label":"tests/go-project"}]' diff --git a/actions/test/action.yml b/actions/test/action.yml index 77c49e3..b2d8ee0 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -160,7 +160,7 @@ runs: - name: Prepare native GitHub coverage id: native-coverage if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github-code-quality' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/coverage-reports@71ce8b3ff53d6673617b19fa01d6637c916d4948 # coverage support (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/coverage-reports@d52648f1645f1318908149af3f35b71b897ca566 # coverage support (PR #683, unreleased) with: working-directory: ${{ steps.directory.outputs.absolute-path }} report-group: ${{ inputs.report-group || github.job }} From 0814116d658bad2bf0f56c9e61b492a46b43dd88 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 18:59:27 +0100 Subject: [PATCH 04/35] feat(reports)!: adopt the shared CI report contract --- .github/actions/parse-ci-reports/README.md | 138 ------------------ .../actions/parse-ci-reports/action.test.cjs | 68 --------- .github/actions/parse-ci-reports/action.yml | 89 ----------- .github/linters/actionlint.yml | 15 ++ .github/workflows/__main-ci.yml | 1 + .github/workflows/__pull-request-ci.yml | 1 + .github/workflows/__release.yml | 1 + .github/workflows/__shared-ci.yml | 7 +- .github/workflows/__test-action-lint.yml | 10 +- .../__test-action-parse-ci-reports.yml | 65 --------- .github/workflows/__test-action-setup-go.yml | 6 +- .github/workflows/__test-action-test.yml | 33 ++--- ...__test-workflow-continuous-integration.yml | 14 +- .github/workflows/continuous-integration.yml | 120 +++++++++------ actions/lint/action.yml | 30 ++-- actions/test/action.test.cjs | 4 +- actions/test/action.yml | 125 ++++------------ package.json | 5 +- tests/config.test.cjs | 11 +- 19 files changed, 180 insertions(+), 563 deletions(-) delete mode 100644 .github/actions/parse-ci-reports/README.md delete mode 100644 .github/actions/parse-ci-reports/action.test.cjs delete mode 100644 .github/actions/parse-ci-reports/action.yml create mode 100644 .github/linters/actionlint.yml delete mode 100644 .github/workflows/__test-action-parse-ci-reports.yml diff --git a/.github/actions/parse-ci-reports/README.md b/.github/actions/parse-ci-reports/README.md deleted file mode 100644 index 0400d8f..0000000 --- a/.github/actions/parse-ci-reports/README.md +++ /dev/null @@ -1,138 +0,0 @@ - - -# GitHub Action: Parse CI reports - -
- Parse CI reports -
- ---- - - - - - - - - -[![Marketplace](https://img.shields.io/badge/Marketplace-parse--ci--reports-blue?logo=github-actions)](https://github.com/marketplace/actions/parse-ci-reports) -[![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-go)](https://github.com/hoverkraft-tech/ci-github-go/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-go)](http://choosealicense.com/licenses/mit/) -[![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) - - - - - - - -## Overview - -Parse native reports and retain parsed files for consolidated reporting. Keep native Go coverage in a separate artifact because the common parser does not support its format. Internal helper for lint and test. - - - - - - - - -## Usage - -```yaml -- uses: hoverkraft-tech/ci-github-go/.github/actions/parse-ci-reports@eac34b0e29b78265265a2021a9099f73ab699e0c # fix/consolidated-go-coverage - with: - # Validated absolute project directory. - # This input is required. - directory: "" - - # Report paths or auto selectors passed to the common parser. - # Default: `auto:test` - report-paths: auto:test - - # Calling job ID used to group reports. - # This input is required. - group: "" - - # Retain the project's coverage.out in a separate artifact when present. - # Default: `false` - native-coverage: "false" - - # Title of the GitHub report summary. - # Default: `CI reports` - report-name: CI reports -``` - - - - - -## Inputs - -| **Input** | **Description** | **Required** | **Default** | -| --------------------- | ---------------------------------------------------------------------- | ------------ | ------------ | -| **`directory`** | Validated absolute project directory. | **true** | - | -| **`report-paths`** | Report paths or auto selectors passed to the common parser. | **false** | `auto:test` | -| **`group`** | Calling job ID used to group reports. | **true** | - | -| **`native-coverage`** | Retain the project's coverage.out in a separate artifact when present. | **false** | `false` | -| **`report-name`** | Title of the GitHub report summary. | **false** | `CI reports` | - - - - - - - - -## Outputs - -| **Output** | **Description** | -| -------------------------- | ----------------------------------------------------------------------- | -| **`artifact-id`** | Uploaded artifact ID, or empty when no report files exist. | -| **`coverage-artifact-id`** | Native Go coverage artifact ID, or empty when no coverage was retained. | - - - - - - - - - - - - - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) for more details. - - - - - - - - -## License - -This project is licensed under the MIT License. - -SPDX-License-Identifier: MIT - -Copyright © 2026 hoverkraft-tech - -For more details, see the [license](http://choosealicense.com/licenses/mit/). - - - - - ---- - -This documentation was automatically generated by [CI Dokumentor](https://github.com/hoverkraft-tech/ci-dokumentor). - - - - diff --git a/.github/actions/parse-ci-reports/action.test.cjs b/.github/actions/parse-ci-reports/action.test.cjs deleted file mode 100644 index 9efd740..0000000 --- a/.github/actions/parse-ci-reports/action.test.cjs +++ /dev/null @@ -1,68 +0,0 @@ -const assert = require("node:assert/strict"); -const fs = require("node:fs"); -const path = require("node:path"); -const test = require("node:test"); -const { - createWorkspace, - loadActionStep, -} = require("../../../tests/action-test-helpers.cjs"); - -const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor; - -test("report artifacts contain only parsed reports and use unique names", async (t) => { - const directory = createWorkspace(t); - const report = path.join(directory, "junit.xml"); - fs.writeFileSync(report, ""); - fs.writeFileSync( - path.join(directory, "unrelated-secret.txt"), - "not a report", - ); - const prepare = new AsyncFunction( - "core", - "process", - "require", - loadActionStep(path.join(__dirname, "action.yml"), "prepare").with.script, - ); - async function outputs(files, group = "outer-job", nativeCoverage = false) { - const result = {}; - await prepare( - { - setOutput: (key, value) => { - result[key] = value; - }, - }, - { - env: { - DIRECTORY: directory, - REPORT_FILES: JSON.stringify(files), - REPORT_GROUP: group, - NATIVE_COVERAGE: String(nativeCoverage), - GITHUB_RUN_ATTEMPT: "2", - }, - }, - require, - ); - return result; - } - assert.deepEqual(await outputs([]), {}); - const first = await outputs([report]); - assert.equal(first.files, report); - assert.match(first.name, /^ci-reports-2-outer-job-/); - assert.notEqual(first.name, (await outputs([report])).name); - await assert.rejects(() => outputs([report], "../bad-group"), /report-group/); - const coverage = path.join(directory, "coverage.out"); - fs.writeFileSync(coverage, "mode: atomic\n"); - const retained = await outputs([report], "outer-job", true); - assert.equal(retained.files, report); - assert.equal(retained["coverage-file"], coverage); - assert.match(retained["coverage-name"], /^go-coverage-2-outer-job-/); - assert.equal( - retained.name.replace("ci-reports-", "go-coverage-"), - retained["coverage-name"], - ); - const coverageOnly = await outputs([], "outer-job", true); - assert.equal(coverageOnly.files, undefined); - assert.equal(coverageOnly["coverage-file"], coverage); - await assert.rejects(() => outputs([], "../bad-group", true), /report-group/); - assert.equal((await outputs([report])).files, report); -}); diff --git a/.github/actions/parse-ci-reports/action.yml b/.github/actions/parse-ci-reports/action.yml deleted file mode 100644 index afde3b3..0000000 --- a/.github/actions/parse-ci-reports/action.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -name: Parse CI reports -description: - Parse native reports and retain parsed files for consolidated reporting. - Keep native Go coverage in a separate artifact because the common parser does not support its format. - Internal helper for lint and test. -inputs: - directory: - description: Validated absolute project directory. - required: true - report-paths: - description: Report paths or auto selectors passed to the common parser. - default: auto:test - group: - description: Calling job ID used to group reports. - required: true - native-coverage: - description: Retain the project's coverage.out in a separate artifact when present. - default: "false" - report-name: - description: Title of the GitHub report summary. - default: CI reports -outputs: - artifact-id: - description: Uploaded artifact ID, or empty when no report files exist. - value: ${{ steps.upload.outputs.artifact-id }} - coverage-artifact-id: - description: Native Go coverage artifact ID, or empty when no coverage was retained. - value: ${{ steps.upload-coverage.outputs.artifact-id }} -runs: - using: composite - steps: - - id: parse - if: ${{ !cancelled() }} - uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@66882b24f9f13e45a6541896a5a7c638cb91c94c # 4.0.0 - with: - working-directory: ${{ inputs.directory }} - report-paths: | - ${{ inputs.report-paths }} - !**/.venv/** - !**/.git/** - !**/.cache/** - !**/vendor/** - report-name: ${{ inputs.report-name }} - output-format: annotations,summary,markdown - - id: prepare - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - DIRECTORY: ${{ inputs.directory }} - REPORT_FILES: ${{ steps.parse.outputs.parsed-files }} - REPORT_GROUP: ${{ inputs.group }} - NATIVE_COVERAGE: ${{ inputs.native-coverage }} - with: - script: | - const fs = require('node:fs'); - const path = require('node:path'); - const files = JSON.parse(process.env.REPORT_FILES || '[]'); - const coverage = path.join(process.env.DIRECTORY, 'coverage.out'); - const retainCoverage = process.env.NATIVE_COVERAGE === 'true' && fs.existsSync(coverage); - if (!files.length && !retainCoverage) return; - const group = process.env.REPORT_GROUP; - if (!/^[\w-]+$/.test(group)) throw new Error('report-group must be a job ID.'); - const suffix = `${process.env.GITHUB_RUN_ATTEMPT}-${group}-${require('node:crypto').randomUUID()}`; - if (files.length) { - core.setOutput('files', files.join('\n')); - core.setOutput('name', `ci-reports-${suffix}`); - } - if (retainCoverage) { - core.setOutput('coverage-file', coverage); - core.setOutput('coverage-name', `go-coverage-${suffix}`); - } - if: ${{ !cancelled() }} - - id: upload - if: ${{ !cancelled() && steps.prepare.outputs.files != '' }} - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: ${{ steps.prepare.outputs.name }} - path: ${{ steps.prepare.outputs.files }} - include-hidden-files: true - if-no-files-found: error - retention-days: 7 - - id: upload-coverage - if: ${{ !cancelled() && steps.prepare.outputs.coverage-file != '' }} - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: ${{ steps.prepare.outputs.coverage-name }} - path: ${{ steps.prepare.outputs.coverage-file }} - if-no-files-found: error - retention-days: 7 diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml new file mode 100644 index 0000000..1bb6ca0 --- /dev/null +++ b/.github/linters/actionlint.yml @@ -0,0 +1,15 @@ +# FIXME: Remove only the code-quality exception when Actionlint supports it. +# https://github.com/rhysd/actionlint/pull/674 +paths: + { + .github/workflows/__main-ci.yml: + { ignore: [^unknown permission scope "code-quality"\.] }, + .github/workflows/__pull-request-ci.yml: + { ignore: [^unknown permission scope "code-quality"\.] }, + .github/workflows/__release.yml: + { ignore: [^unknown permission scope "code-quality"\.] }, + .github/workflows/__shared-ci.yml: + { ignore: [^unknown permission scope "code-quality"\.] }, + .github/workflows/__test-workflow-continuous-integration.yml: + { ignore: [^unknown permission scope "code-quality"\.] }, + } diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml index 6ed761c..87a9232 100644 --- a/.github/workflows/__main-ci.yml +++ b/.github/workflows/__main-ci.yml @@ -16,6 +16,7 @@ jobs: actions: read security-events: write id-token: write + code-quality: write release: needs: ci if: github.event_name != 'schedule' && vars.CI_BOT_APP_CLIENT_ID != '' diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml index 7232af2..8b907bc 100644 --- a/.github/workflows/__pull-request-ci.yml +++ b/.github/workflows/__pull-request-ci.yml @@ -16,6 +16,7 @@ jobs: actions: read security-events: write id-token: write + code-quality: write "on": merge_group: null pull_request: diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml index c41a8b4..78cc269 100644 --- a/.github/workflows/__release.yml +++ b/.github/workflows/__release.yml @@ -17,6 +17,7 @@ jobs: actions: read security-events: write id-token: write + code-quality: write release: name: Create and publish release needs: ci diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index e9b90f3..68b72b1 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -5,7 +5,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) permissions: contents: read statuses: write @@ -25,6 +25,7 @@ jobs: contents: read pull-requests: write id-token: write + code-quality: write test-action-setup-go: uses: $/.github/workflows/__test-action-setup-go.yml permissions: @@ -47,7 +48,3 @@ jobs: uses: $/.github/workflows/__test-action-build.yml permissions: contents: read - test-action-parse-ci-reports: - uses: $/.github/workflows/__test-action-parse-ci-reports.yml - permissions: - contents: read diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 486034c..a4cacf5 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -16,13 +16,13 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) with: command: test:ci arguments: '["actions/lint/action.test.cjs"]' - coverage: "" - comment: "false" + coverage: "false" - name: Arrange - Install the project runtime and dependencies uses: $/actions/setup-go with: @@ -65,7 +65,7 @@ jobs: - name: Assert - Retained report contains the diagnostic shell: bash run: | - test -f "$REPORT_DIRECTORY/checkstyle.xml" - grep -q 'message="expected lint failure"' "$REPORT_DIRECTORY/checkstyle.xml" + test -f "$REPORT_DIRECTORY/ci-report.json" + grep -rq 'message="expected lint failure"' "$REPORT_DIRECTORY/reports" env: REPORT_DIRECTORY: ${{ runner.temp }}/lint-reports diff --git a/.github/workflows/__test-action-parse-ci-reports.yml b/.github/workflows/__test-action-parse-ci-reports.yml deleted file mode 100644 index 90ebe67..0000000 --- a/.github/workflows/__test-action-parse-ci-reports.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -name: Internal - Test parse-ci-reports action -"on": - workflow_call: null -permissions: {} -jobs: - reports: - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: read - outputs: - artifact-id: ${{ steps.report.outputs.artifact-id }} - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0 - with: - command: test:ci - arguments: '[".github/actions/parse-ci-reports/action.test.cjs"]' - coverage: "" - comment: "false" - - name: Arrange - Empty report directory - run: mkdir -p "$RUNNER_TEMP/empty-reports" - - name: Act - Retain no reports - id: empty - uses: $/.github/actions/parse-ci-reports - with: - directory: ${{ runner.temp }}/empty-reports - group: reports - - name: Assert - No empty artifact is created - env: - ARTIFACT: ${{ steps.empty.outputs.artifact-id }} - run: test -z "$ARTIFACT" - - name: Arrange - One report and an unrelated private file - run: | - mkdir -p "$RUNNER_TEMP/report-fixture" - printf '%s\n' '' > "$RUNNER_TEMP/report-fixture/junit.xml" - printf '%s\n' 'not a report' > "$RUNNER_TEMP/report-fixture/private.txt" - - name: Act - Retain the selected report - id: report - uses: $/.github/actions/parse-ci-reports - with: - directory: ${{ runner.temp }}/report-fixture - group: reports - report-paths: junit.xml - verify: - needs: reports - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: read - steps: - - name: Assert - Artifact can be downloaded - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - artifact-ids: ${{ needs.reports.outputs.artifact-id }} - path: ${{ runner.temp }}/downloaded-reports - - name: Assert - Only the selected file was retained - run: | - test -f "$RUNNER_TEMP/downloaded-reports/junit.xml" - test ! -e "$RUNNER_TEMP/downloaded-reports/private.txt" - test "$(find "$RUNNER_TEMP/downloaded-reports" -type f | wc -l)" -eq 1 diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 79bd9f0..c053dc9 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -14,13 +14,13 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) with: command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' - coverage: "" - comment: "false" + coverage: "false" - name: Act - Detect the runtime and install dependencies uses: $/actions/setup-go with: diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 86e3e34..55b279a 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -12,19 +12,18 @@ jobs: outputs: artifact-id: ${{ steps.failed-test.outputs.report-artifact-id }} success-artifact-id: ${{ steps.test.outputs.report-artifact-id }} - coverage-artifact-id: ${{ steps.test.outputs.coverage-artifact-id }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) with: command: test:ci arguments: '["actions/test/action.test.cjs"]' - coverage: "" - comment: "false" + coverage: "false" - uses: $/actions/setup-go with: working-directory: tests/go-project @@ -42,14 +41,13 @@ jobs: command: |- printf '%s' 'failure' > junit.xml exit 17 - coverage: "" + coverage: "false" name: Act - Run a failing test command - name: Assert failures and reports uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: SUCCESS_ARTIFACT: ${{ steps.test.outputs.report-artifact-id }} FAILURE_ARTIFACT: ${{ steps.failed-test.outputs.report-artifact-id }} - COVERAGE_ARTIFACT: ${{ steps.test.outputs.coverage-artifact-id }} TEST_OUTCOME: ${{ steps.failed-test.outcome }} with: script: | @@ -58,8 +56,6 @@ jobs: assert.ok(process.env.SUCCESS_ARTIFACT, 'Successful tests retain reports'); assert.ok(process.env.FAILURE_ARTIFACT, 'Failed tests retain reports'); assert.notEqual(process.env.SUCCESS_ARTIFACT, process.env.FAILURE_ARTIFACT); - assert.ok(process.env.COVERAGE_ARTIFACT, 'Native coverage is retained separately'); - assert.notEqual(process.env.SUCCESS_ARTIFACT, process.env.COVERAGE_ARTIFACT); verify: needs: test runs-on: ubuntu-latest @@ -78,8 +74,8 @@ jobs: env: REPORT_DIRECTORY: ${{ runner.temp }}/failed-reports run: | - test -f "$REPORT_DIRECTORY/junit.xml" - grep -q 'message="expected"' "$REPORT_DIRECTORY/junit.xml" + test -f "$REPORT_DIRECTORY/ci-report.json" + grep -rq 'message="expected"' "$REPORT_DIRECTORY/reports" - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: github-token: ${{ github.token }} @@ -89,18 +85,7 @@ jobs: uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@33462c06bcbbd9144d7f661929e61953604b444d # 4.3.2 with: working-directory: ${{ runner.temp }}/successful-reports - report-paths: "**/*" + report-paths: "reports/**/*.xml + + coverage/report-*.xml" output-format: summary - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - github-token: ${{ github.token }} - artifact-ids: ${{ needs.test.outputs.coverage-artifact-id }} - path: ${{ runner.temp }}/native-coverage - - name: Verify native coverage stays available outside consolidated artifacts - shell: bash - env: - REPORT_DIRECTORY: ${{ runner.temp }}/successful-reports - COVERAGE_DIRECTORY: ${{ runner.temp }}/native-coverage - run: | - test ! -e "$REPORT_DIRECTORY/coverage.out" - grep -q '^mode: atomic$' "$COVERAGE_DIRECTORY/coverage.out" diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 3e35861..a04608b 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -12,13 +12,13 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) with: command: test:ci arguments: '["tests/config.test.cjs"]' - coverage: "" - comment: "false" + coverage: "false" fixture: uses: $/.github/workflows/continuous-integration.yml permissions: @@ -26,7 +26,7 @@ jobs: id-token: write with: working-directory: tests/go-project - test: '{"coverage":"github-code-quality","report-group":"fixture"}' + test: '{"coverage":true}' go-versions: '["1.26", "1.27"]' dependency-review: false checks-disabled: @@ -43,12 +43,12 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: fixture - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@d52648f1645f1318908149af3f35b71b897ca566 # coverage support (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) permissions: contents: read pull-requests: write + code-quality: write + id-token: write with: comment: false - concurrency-group: test-native-go-${{ github.run_id }}-${{ github.run_attempt }} job-results: ${{ toJSON(needs) }} - coverage-reports: '[{"job":"fixture","label":"tests/go-project"}]' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 02dfd0b..7b5eabb 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -11,7 +11,6 @@ # uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@main # permissions: # contents: read -# id-token: write # with: # working-directory: . # go-versions: '["1.26", "1.27"]' @@ -19,7 +18,7 @@ # # An empty versions input uses project detection once. The last matrix entry is # the primary version: lint, audit and build checks run there, and only -# that version publishes coverage. Tests run on every entry with fail-fast disabled. +# that version contributes coverage. Tests run on every entry with fail-fast disabled. # Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON # array of Linux labels and applies to every job, including configuration. # @@ -64,46 +63,52 @@ # inside the checkout. Each invocation uses a unique artifact name. # Build output is not published as a release. # -# ### Reports and permissions +# ### Reports and coverage # -# Tests retain JUnit and supported coverage files for seven days, including after -# command failures. Lint retains parsed SARIF/Checkstyle reports. Only report files -# are uploaded, with unique names for parallel calls; a job producing no reports -# returns an empty `report-artifact-id`. Summaries and annotations work without PR -# write permissions. Individual PR comments are not created. +# Lint and test jobs retain native diagnostics in one artifact per execution. +# They post no PR comments and need no publication permissions. Configure native +# test reports (JUnit or TAP) and lint reports (for example Checkstyle or SARIF). +# Missing required reports fail even when the tool command exits successfully. +# Available reports are retained after failures. # -# Use the common -# [ci-reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.yml) -# for consolidated comments after standalone producer jobs; set `report-group` to -# the outer calling job ID when required. Go coverage uses native `go tool cover` summaries and retains -# `coverage.out` in separate `go-coverage-*` artifacts; the common parser handles -# JUnit, not native Go coverage. Coverage details remain in each test job summary. +# Tests require Cobertura by default. The highest configured runtime contributes +# coverage; every runtime retains its test results. Set `test: '{"coverage":false}'` +# for tests that deliberately produce no Cobertura. The command still controls +# instrumentation. Custom `test.coverage-reports` describes Cobertura file paths, +# Linguist languages and stable component labels; it belongs beside the producer. +# Separate components stay separate. Merge shards in the framework first. # -# `test: '{"coverage":"codecov"}'` enables OIDC upload. The expected coverage file is -# `coverage.out`. A custom command must produce -# the applicable file. `coverage` controls publication, not collection, and an -# empty value still retains JUnit results. The reusable workflow declares -# `id-token: write` for Codecov and callers must grant it, including for default -# GitHub reports. Standalone GitHub reporting requires only read permissions. -# No repository-specific bot secrets are required by the public actions or workflow. +# Call the common workflow once after producer workflows. It reads their complete +# report plans from `needs`, regardless of calling job names: # -# See [setup-go](../../actions/setup-go/README.md), [lint](../../actions/lint/README.md), -# [test](../../actions/test/README.md) and [audit](../../actions/audit/README.md) -# for standalone action usage. Pin the workflow to a reviewed commit SHA in production. - ---- +# ```yaml +# reports: +# needs: [checks] +# if: ${{ always() }} +# uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@ +# permissions: +# contents: read +# pull-requests: write +# code-quality: write +# id-token: write +# with: +# job-results: ${{ toJSON(needs) }} +# coverage: github +# ``` # -# ## Native GitHub coverage +# Select `coverage: none` (default) for summaries, `github` for native GitHub +# coverage, or `codecov`. Both publishers consume validated Cobertura. Native +# GitHub coverage requires repository enablement and a default-branch baseline. +# The reporting workflow owns one CI comment and the `CI reports complete` check. +# Forks retain diagnostics without write operations. Partial reruns require +# rerunning all producers. Producer workflows test the PR head or push revision. +# +# Standalone action jobs forward their `report-plan` output. Custom outer matrices +# must forward a complete plan derived from their configuration; GitHub's last +# successful matrix output does not describe all executions. See the common +# [recording action](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/quality/record-ci-reports) +# for the advanced contract. No collector-side coverage inventory is needed. # -# Select `test: '{"coverage":"github-code-quality","report-group":"backend"}'`. -# This tests the PR head commit; existing destinations keep their usual merge-ref -# checkout. Keep a separate merge-result test invocation when your policy requires it. -# Only the primary runtime publishes coverage. Optionally set test.coverage-reports -# to an array of {file, language, label} for multiple Cobertura components. -# Call the common ci-reports workflow with every expected job/label, then its -# publish-coverage workflow. Only publication needs code-quality: write. -# See [native coverage collection](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md#native-github-coverage). - name: Go Continuous Integration "on": workflow_call: @@ -121,7 +126,7 @@ name: Go Continuous Integration type: string default: . go-versions: - description: JSON array of Go versions. The last entry runs lint, audit and build and publishes coverage. Empty runs project detection once. An empty entry uses the project version. + description: JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. type: string default: "" lint: @@ -129,7 +134,7 @@ name: Go Continuous Integration type: string default: "true" test: - description: "true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage." + description: "true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime." type: string default: "true" audit: @@ -148,10 +153,17 @@ name: Go Continuous Integration description: Pinned golangci-lint v2 release used by the lint action. type: string default: v2.15.0 + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. + default: "" + type: string outputs: build-artifact-id: description: Build artifact ID when build.artifact is configured. value: ${{ jobs.build.outputs.artifact-id }} + report-plan: + description: Complete expected report plan, consumed automatically by ci-reports. + value: ${{ jobs.configuration.outputs.report-plan }} permissions: {} jobs: configuration: @@ -163,6 +175,8 @@ jobs: lint: ${{ steps.config.outputs.lint }} test: ${{ steps.config.outputs.test }} build: ${{ steps.config.outputs.build }} + report-plan: ${{ steps.report-plan.outputs.report-plan }} + report-selections: ${{ steps.report-plan.outputs.selections }} steps: - id: config uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -171,6 +185,8 @@ jobs: LINT: ${{ inputs.lint }} TEST: ${{ inputs.test }} BUILD: ${{ inputs.build }} + DIRECTORY: ${{ inputs.working-directory }} + CHECKS: ${{ inputs.checks }} with: script: | const versions = process.env.VERSIONS.trim() ? JSON.parse(process.env.VERSIONS) : ['']; @@ -196,9 +212,7 @@ jobs: return config; } const lint = options('lint', process.env.LINT, {command: ''}); - const test = options('test', process.env.TEST, {"command": "", "coverage": "github", "race": true, "coverage-reports": [], "report-group": ""}); - if (test && test['report-group'] && !/^[\w-]+$/.test(test['report-group'])) throw new Error('test.report-group must be a job ID.'); - if (test && !['', 'github', 'github-code-quality', 'codecov'].includes(test.coverage)) throw new Error('test.coverage must be github, github-code-quality, codecov or empty.'); + const test = options('test', process.env.TEST, {"command": "", "coverage": true, "race": true, "coverage-reports": []}); const build = options('build', process.env.BUILD, {command: 'go build -mod=readonly -trimpath ./...', artifact: ''}); const artifact = build?.artifact; if (artifact && (artifact === '.' || artifact.startsWith('/') || artifact.includes('\\') || artifact.split('/').includes('..') || /[\r\n*?]/.test(artifact))) { @@ -210,6 +224,21 @@ jobs: core.setOutput('primary-version', versions.at(-1)); core.setOutput('lint', JSON.stringify(lint)); core.setOutput('test', JSON.stringify(test)); + + const directory = process.env.DIRECTORY || '.'; + const producers = []; + if (process.env.CHECKS === 'true' && lint) producers.push({key:'lint',type:'lint',directory,coverage:[]}); + if (process.env.CHECKS === 'true' && test) for (const version of versions) { + producers.push({key:'test-'+(version || 'project'),type:'test',directory, + coverage:version === versions.at(-1) && test.coverage ? (test['coverage-reports'].length ? test['coverage-reports'] : [{file:'cobertura.xml',language:'Go'}]) : []}); + } + core.setOutput('report-producers', producers); + - id: report-plan + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + with: + operation: plan + producers: ${{ steps.config.outputs.report-producers }} + report-plan: ${{ inputs.report-plan }} dependency-review: if: inputs.checks && inputs.dependency-review && github.event_name == 'pull_request' runs-on: ${{ fromJSON(inputs.runs-on) }} @@ -220,6 +249,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1 lint: if: inputs.checks && needs.configuration.outputs.lint != 'null' @@ -240,6 +270,7 @@ jobs: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} golangci-lint-version: ${{ inputs.golangci-lint-version }} + report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections).lint) }} test: if: inputs.checks && needs.configuration.outputs.test != 'null' needs: configuration @@ -247,11 +278,10 @@ jobs: timeout-minutes: 20 permissions: contents: read - id-token: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: ${{ fromJSON(needs.configuration.outputs.test).coverage == 'github-code-quality' && github.event.pull_request.head.sha || github.sha }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false - uses: $/actions/setup-go with: @@ -261,10 +291,10 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.test).command }} - report-group: ${{ fromJSON(needs.configuration.outputs.test).report-group }} coverage-reports: ${{ fromJSON(needs.configuration.outputs.test).coverage-reports[0] && toJSON(fromJSON(needs.configuration.outputs.test).coverage-reports) || '' }} - coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage || '' }} + coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} race: ${{ fromJSON(needs.configuration.outputs.test).race }} + report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections)[format('test-{0}', matrix.version || 'project')]) }} strategy: fail-fast: false matrix: diff --git a/actions/lint/action.yml b/actions/lint/action.yml index ce8f934..c646f16 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -31,13 +31,16 @@ inputs: command: description: Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. default: "" - report-group: - description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. default: "" outputs: + report-plan: + description: Expected lint report metadata. Forward from standalone jobs. + value: ${{ steps.report-plan.outputs.report-plan }} report-artifact-id: - description: Native report artifact ID. Empty when no reports were produced. - value: ${{ steps.report-artifact.outputs.artifact-id }} + description: Native lint report bundle. + value: ${{ steps.reports.outputs.artifact-id }} runs: using: composite steps: @@ -45,6 +48,12 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 with: working-directory: ${{ inputs.working-directory }} + - id: report-plan + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + with: + operation: plan + report-plan: ${{ inputs.report-plan }} + producers: '[{"key":"lint","type":"lint","directory":${{ toJSON(steps.directory.outputs.workspace-relative-path || ''.'') }},"coverage":[]}]' - id: golangci if: inputs.command == '' uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 @@ -79,12 +88,11 @@ runs: go mod tidy -diff || status=1 golangci-lint run --timeout=5m --output.sarif.path=golangci-lint.sarif || status=1 exit "$status" - - name: Report lint results - id: report-artifact - if: ${{ !cancelled() && steps.run.outcome != 'skipped' }} - uses: $/.github/actions/parse-ci-reports + - id: reports + name: Record lint results + if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) with: - directory: ${{ steps.directory.outputs.absolute-path }} + working-directory: ${{ steps.directory.outputs.absolute-path }} + report-plan: ${{ steps.report-plan.outputs.report-plan }} report-paths: auto:lint - report-name: Go lint results - group: ${{ inputs.report-group || github.job }} diff --git a/actions/test/action.test.cjs b/actions/test/action.test.cjs index b7b512b..2ca357f 100644 --- a/actions/test/action.test.cjs +++ b/actions/test/action.test.cjs @@ -25,7 +25,7 @@ test("custom commands retain quoting and fail without continuing to default tool assert.equal(fs.readFileSync(output, "utf8"), 'quotes " and $(not-executed)'); }); -test("test configuration rejects unsupported coverage destinations", (t) => { +test("test configuration rejects non-boolean coverage configuration", (t) => { const directory = createWorkspace(t); assert.notEqual( runActionStep(actionFile, "validate", directory, { @@ -36,7 +36,7 @@ test("test configuration rejects unsupported coverage destinations", (t) => { ); assert.equal( runActionStep(actionFile, "validate", directory, { - COVERAGE: "github-code-quality", + COVERAGE: "true", RACE: "true", }).status, 0, diff --git a/actions/test/action.yml b/actions/test/action.yml index b2d8ee0..91d2937 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -1,45 +1,15 @@ --- name: Test Go description: | - Run Go tests with gotestsum, JUnit output and atomic coverage. + Run Go tests and retain native test and coverage reports. - Defaults enable `-race`, `-count=1` and a five-minute package timeout. - The race detector requires CGO and a C compiler on a supported Linux runner; - set `race: "false"` when unavailable. A trusted Bash `command` replaces defaults - and must produce JUnit for test reporting and `coverage.out` for coverage. - GitHub coverage uses native `go tool cover` summaries and retains `coverage.out`; - the common report parser handles JUnit, not the native Go coverage format. - Native coverage is retained in a separate `go-coverage-*` artifact, so consolidated - CI reports receive only supported files. Coverage details remain in the test job summary. + Use the matching setup action first. Commands must generate JUnit reports. + Coverage collection requires Cobertura XML. The test command controls instrumentation. - - - - Run [setup-go](../setup-go/README.md) first with the same `working-directory`. - - - - `coverage: "github"` is the default. Set `coverage: "codecov"` and grant the - job `id-token: write` for OIDC upload of `coverage.out`. An empty coverage - value disables publication while retaining JUnit; collection is controlled by - the command. Custom commands must produce the applicable report files. - - - - - Native reports survive command failures and are retained for seven days. - See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions. - - - - Native `coverage: github-code-quality` prepares Cobertura artifacts for the common - [CI reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md) - and its opt-in publication workflow. Set `report-group` to the outer calling job - and list every expected component in the collector. The default label is the - repository-relative working directory, or `root`. Multiple reports need explicit - stable labels. Reports must measure the PR head commit, not the PR merge commit. - Keep merge-result validation separately when required. No upload permission is - needed in this test action; only the publication job needs `code-quality: write`. + Forward report-plan from standalone jobs, or use the reusable CI workflow, which + exposes the complete expected plan automatically. Choose external coverage + publication once in the common ci-reports workflow. This action posts no comments + and needs no publication permissions. Available reports survive test failures. author: hoverkraft branding: icon: package @@ -55,28 +25,22 @@ inputs: description: Enable the race detector for the default command. Requires CGO and a C compiler. default: "true" coverage-reports: - description: | - Native GitHub coverage reports as a JSON array of file, language and optional label. - Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. - Every file must be Cobertura XML produced by the test command. Paths are relative - to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. + description: |- + Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. default: "" coverage: - description: "Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command." - default: github - report-group: - description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. + description: Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. + default: "true" + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. default: "" outputs: + report-plan: + description: Expected report metadata. Forward from standalone jobs. + value: ${{ steps.report-plan.outputs.report-plan }} report-artifact-id: - description: Native report artifact ID. Empty when no reports were produced. - value: ${{ steps.report-artifact.outputs.artifact-id }} - native-coverage-artifact-id: - description: Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. - value: ${{ steps.native-coverage.outputs.artifact-id }} - coverage-artifact-id: - description: Native coverage.out artifact ID for GitHub coverage, or empty when unavailable. - value: ${{ steps.report-artifact.outputs.coverage-artifact-id }} + description: Native report bundle, including available diagnostics after failures. + value: ${{ steps.reports.outputs.artifact-id }} runs: using: composite steps: @@ -91,7 +55,13 @@ runs: COVERAGE: ${{ inputs.coverage }} run: | case "$RACE" in true|false) ;; *) echo 'race must be true or false.' >&2; exit 1 ;; esac - case "$COVERAGE" in github|github-code-quality|codecov|'') ;; *) echo 'coverage must be github, github-code-quality, codecov or empty.' >&2; exit 1 ;; esac + case "$COVERAGE" in true|false) ;; *) echo 'coverage must be true or false.' >&2; exit 1 ;; esac + - id: report-plan + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + with: + operation: plan + report-plan: ${{ inputs.report-plan }} + producers: '[{"key":"test","type":"test","directory":${{ toJSON(steps.directory.outputs.workspace-relative-path || ''.'') }},"coverage":${{ inputs.coverage == ''true'' && (inputs.coverage-reports || ''[{"file":"cobertura.xml","language":"Go"}]'') || ''[]'' }}}]' - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -116,7 +86,7 @@ runs: go run "gotest.tools/gotestsum@$GOTESTSUM_VERSION" --junitfile=junit.xml --format=testname -- "${args[@]}" ./... - name: Convert native Go coverage to Cobertura id: cobertura - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github-code-quality' && inputs.coverage-reports == '' }} + if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'true' && inputs.coverage-reports == '' }} shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} env: @@ -126,42 +96,11 @@ runs: run: | test -s coverage.out || { echo 'Native coverage requires coverage.out.' >&2; exit 1; } go run "github.com/boumenot/gocover-cobertura@$GOCOVER_COBERTURA_VERSION" < coverage.out > cobertura.xml - - name: Report test results - id: report-artifact - if: ${{ !cancelled() && steps.run.outcome != 'skipped' }} - uses: $/.github/actions/parse-ci-reports - with: - directory: ${{ steps.directory.outputs.absolute-path }} - report-paths: ${{ inputs.coverage == 'github-code-quality' && 'auto:test,auto:coverage' || 'auto:test' }} - report-name: Go test results - group: ${{ inputs.report-group || github.job }} - native-coverage: ${{ inputs.coverage == 'github' || inputs.coverage == 'github-code-quality' }} - - id: go-coverage - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github' }} - env: - DIRECTORY: ${{ steps.directory.outputs.absolute-path }} - with: - script: | - const fs = require('node:fs'); - const path = require('node:path'); - const file = path.join(process.env.DIRECTORY, 'coverage.out'); - if (!fs.existsSync(file)) return; - const result = await exec.getExecOutput('go', ['tool', 'cover', '-func=' + file], {cwd: process.env.DIRECTORY}); - await core.summary.addHeading('Go coverage').addCodeBlock(result.stdout, 'text').write(); - - name: Upload coverage to Codecov - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'codecov' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/codecov@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 - with: - working-directory: ${{ steps.directory.outputs.absolute-path }} - files: coverage.out - fail-ci-if-error: "true" - - - name: Prepare native GitHub coverage - id: native-coverage - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'github-code-quality' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/coverage-reports@d52648f1645f1318908149af3f35b71b897ca566 # coverage support (PR #683, unreleased) + - name: Record test results + id: reports + if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) with: working-directory: ${{ steps.directory.outputs.absolute-path }} - report-group: ${{ inputs.report-group || github.job }} - reports: ${{ inputs.coverage-reports || '[{"file":"cobertura.xml","language":"Go"}]' }} + report-plan: ${{ steps.report-plan.outputs.report-plan }} + report-paths: auto:test diff --git a/package.json b/package.json index 123924f..50b1493 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "private": true, "description": "Development-only tests for GitHub Actions configuration", "scripts": { - "test": "node --test tests/*.test.cjs actions/*/*.test.cjs .github/actions/*/*.test.cjs", - "test:ci": "node --test" + "test": "node --test tests/*.test.cjs actions/*/*.test.cjs", + "test:ci": "node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml", + "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', {recursive:true})\"" }, "devDependencies": { "yaml": "2.9.1" diff --git a/tests/config.test.cjs b/tests/config.test.cjs index 52342b4..137781e 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -61,17 +61,17 @@ test("disables checks and preserves explicitly supplied command bytes", async () } const command = 'printf "%s\n" "$VALUE"\nexit 17'; const result = await parse({ - TEST: JSON.stringify({ command, coverage: "" }), + TEST: JSON.stringify({ command, coverage: false }), }); assert.equal(JSON.parse(result.test).command, command); - assert.equal(JSON.parse(result.test).coverage, ""); + assert.equal(JSON.parse(result.test).coverage, false); assert.equal( JSON.parse((await parse({ LINT: "make lint" })).lint).command, "make lint", ); }); -test("rejects misspelled options, invalid types and unknown coverage providers", async () => { +test("rejects misspelled options, invalid types and non-boolean coverage options", async () => { for (const key of ["LINT", "TEST"]) { for (const value of [ "{", @@ -87,7 +87,7 @@ test("rejects misspelled options, invalid types and unknown coverage providers", ); } } - for (const coverage of ["unknown", false, null]) { + for (const coverage of ["unknown", "false", null]) { await assert.rejects(() => parse({ TEST: JSON.stringify({ coverage }) })); } }); @@ -118,8 +118,7 @@ test("rejects unsafe build artifact directories and empty commands", async () => test("preserves native coverage configuration and rejects ambiguous input types", async () => { const options = { - coverage: "github-code-quality", - "report-group": "backend", + coverage: true, "coverage-reports": [ { file: "custom.xml", language: "Go", label: "backend" }, ], From b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 19:12:15 +0100 Subject: [PATCH 05/35] fix(reports): align producer integration and generated usage --- .github/workflows/__shared-ci.yml | 2 +- ...__test-workflow-continuous-integration.yml | 2 +- .github/workflows/continuous-integration.md | 123 ++++++++++-------- .github/workflows/continuous-integration.yml | 2 +- actions/lint/README.md | 31 ++--- actions/lint/action.yml | 4 +- actions/test/README.md | 95 ++++---------- actions/test/action.yml | 4 +- 8 files changed, 115 insertions(+), 148 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 68b72b1..f6f8f54 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -5,7 +5,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) permissions: contents: read statuses: write diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index a04608b..044dd22 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -43,7 +43,7 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: fixture - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) permissions: contents: read pull-requests: write diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 455be28..951edc4 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -2,12 +2,6 @@ # GitHub Reusable Workflow: Go Continuous Integration -
- Go Continuous Integration -
- ---- - @@ -41,7 +35,6 @@ jobs: uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@main permissions: contents: read - id-token: write with: working-directory: . go-versions: '["1.26", "1.27"]' @@ -49,7 +42,7 @@ jobs: An empty versions input uses project detection once. The last matrix entry is the primary version: lint, audit and build checks run there, and only -that version publishes coverage. Tests run on every entry with fail-fast disabled. +that version contributes coverage. Tests run on every entry with fail-fast disabled. Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON array of Linux labels and applies to every job, including configuration. @@ -94,37 +87,55 @@ with: inside the checkout. Each invocation uses a unique artifact name. Build output is not published as a release. -### Reports and permissions - -Tests retain JUnit and supported coverage files for seven days, including after -command failures. Lint retains parsed SARIF/Checkstyle reports. Only report files -are uploaded, with unique names for parallel calls; a job producing no reports -returns an empty `report-artifact-id`. Summaries and annotations work without PR -write permissions. Individual PR comments are not created. - -Use the common -[ci-reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.yml) -for consolidated comments after standalone producer jobs; set `report-group` to -the outer calling job ID when required. Go coverage uses native `go tool cover` summaries and retains -`coverage.out` in separate `go-coverage-*` artifacts; the common parser handles -JUnit, not native Go coverage. Coverage details remain in each test job summary. - -`test: '{"coverage":"codecov"}'` enables OIDC upload. The expected coverage file is -`coverage.out`. A custom command must produce -the applicable file. `coverage` controls publication, not collection, and an -empty value still retains JUnit results. The reusable workflow declares -`id-token: write` for Codecov and callers must grant it, including for default -GitHub reports. Standalone GitHub reporting requires only read permissions. -No repository-specific bot secrets are required by the public actions or workflow. - -See [setup-go](../../actions/setup-go/README.md), [lint](../../actions/lint/README.md), -[test](../../actions/test/README.md) and [audit](../../actions/audit/README.md) -for standalone action usage. Pin the workflow to a reviewed commit SHA in production. +### Reports and coverage + +Lint and test jobs retain native diagnostics in one artifact per execution. +They post no PR comments and need no publication permissions. Configure native +test reports (JUnit or TAP) and lint reports (for example Checkstyle or SARIF). +Missing required reports fail even when the tool command exits successfully. +Available reports are retained after failures. + +Tests require Cobertura by default. The highest configured runtime contributes +coverage; every runtime retains its test results. Set `test: '{"coverage":false}'` +for tests that deliberately produce no Cobertura. The command still controls +instrumentation. Custom `test.coverage-reports` describes Cobertura file paths, +Linguist languages and stable component labels; it belongs beside the producer. +Separate components stay separate. Merge shards in the framework first. + +Call the common workflow once after producer workflows. It reads their complete +report plans from `needs`, regardless of calling job names: + +```yaml +reports: + needs: [checks] + if: ${{ always() }} + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@ + permissions: + contents: read + pull-requests: write + code-quality: write + id-token: write + with: + job-results: ${{ toJSON(needs) }} + coverage: github +``` + +Select `coverage: none` (default) for summaries, `github` for native GitHub +coverage, or `codecov`. Both publishers consume validated Cobertura. Native +GitHub coverage requires repository enablement and a default-branch baseline. +The reporting workflow owns one CI comment and the `CI reports complete` check. +Forks retain diagnostics without write operations. Partial reruns require +rerunning all producers. Producer workflows test the PR head or push revision. + +Standalone action jobs forward their `report-plan` output. Custom outer matrices +must forward a complete plan derived from their configuration; GitHub's last +successful matrix output does not describe all executions. See the common +[recording action](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/quality/record-ci-reports) +for the advanced contract. No collector-side coverage inventory is needed. ### Permissions - **`contents`**: `read` -- **`id-token`**: `write` @@ -144,10 +155,9 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage permissions: contents: read - id-token: write with: # JSON array of Linux runner labels for all jobs. # Default: `["ubuntu-latest"]` @@ -161,14 +171,14 @@ jobs: # Default: `.` working-directory: . - # JSON array of Go versions. The last entry runs lint, audit and build and publishes coverage. Empty runs project detection once. An empty entry uses the project version. + # JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. go-versions: "" # true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. # Default: `true` lint: "true" - # true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage. + # true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime. # Default: `true` test: "true" @@ -187,6 +197,9 @@ jobs: # Pinned golangci-lint v2 release used by the lint action. # Default: `v2.15.0` golangci-lint-version: v2.15.0 + + # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. + report-plan: "" ``` @@ -197,18 +210,19 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | -| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | -| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | -| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | -| **`go-versions`** | JSON array of Go versions. The last entry runs lint, audit and build and publishes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - | -| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` | -| **`test`** | true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, report-group, race). false, null or empty disables tests. Only the primary runtime publishes coverage. | **false** | **string** | `true` | -| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | -| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | -| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | +| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | +| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | +| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | +| **`go-versions`** | JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - | +| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime. | **false** | **string** | `true` | +| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | +| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | +| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | **string** | - | @@ -219,9 +233,10 @@ jobs: ## Outputs -| **Output** | **Description** | -| ----------------------- | ---------------------------------------------------- | -| **`build-artifact-id`** | Build artifact ID when build.artifact is configured. | +| **Output** | **Description** | +| ----------------------- | -------------------------------------------------------------------- | +| **`build-artifact-id`** | Build artifact ID when build.artifact is configured. | +| **`report-plan`** | Complete expected report plan, consumed automatically by ci-reports. | diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7b5eabb..febf6a9 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -234,7 +234,7 @@ jobs: } core.setOutput('report-producers', producers); - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) with: operation: plan producers: ${{ steps.config.outputs.report-producers }} diff --git a/actions/lint/README.md b/actions/lint/README.md index d5398f5..6fd833a 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Lint Go -
- Lint Go -
- ---- - @@ -56,7 +50,7 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@eac34b0e29b78265265a2021a9099f73ab699e0c # fix/consolidated-go-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -69,8 +63,8 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int # Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. command: "" - # Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. - report-group: "" + # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. + report-plan: "" ``` @@ -79,12 +73,12 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| --------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | -| **`command`** | Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. | **false** | - | -| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | +| **`command`** | Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. | **false** | - | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | - | @@ -95,9 +89,10 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Outputs -| **Output** | **Description** | -| ------------------------ | --------------------------------------------------------------- | -| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. | +| **Output** | **Description** | +| ------------------------ | ------------------------------------------------------------ | +| **`report-plan`** | Expected lint report metadata. Forward from standalone jobs. | +| **`report-artifact-id`** | Native lint report bundle. | diff --git a/actions/lint/action.yml b/actions/lint/action.yml index c646f16..ff0230d 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: with: working-directory: ${{ inputs.working-directory }} - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) with: operation: plan report-plan: ${{ inputs.report-plan }} @@ -91,7 +91,7 @@ runs: - id: reports name: Record lint results if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) with: working-directory: ${{ steps.directory.outputs.absolute-path }} report-plan: ${{ steps.report-plan.outputs.report-plan }} diff --git a/actions/test/README.md b/actions/test/README.md index cbbe98b..d48e48d 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test Go -
- Test Go -
- ---- - @@ -29,45 +23,15 @@ ## Overview -Run Go tests with gotestsum, JUnit output and atomic coverage. - -Defaults enable `-race`, `-count=1` and a five-minute package timeout. -The race detector requires CGO and a C compiler on a supported Linux runner; -set `race: "false"` when unavailable. A trusted Bash `command` replaces defaults -and must produce JUnit for test reporting and `coverage.out` for coverage. -GitHub coverage uses native `go tool cover` summaries and retains `coverage.out`; -the common report parser handles JUnit, not the native Go coverage format. -Native coverage is retained in a separate `go-coverage-*` artifact, so consolidated -CI reports receive only supported files. Coverage details remain in the test job summary. +Run Go tests and retain native test and coverage reports. - - - -Run [setup-go](../setup-go/README.md) first with the same `working-directory`. - - +Use the matching setup action first. Commands must generate JUnit reports. +Coverage collection requires Cobertura XML. The test command controls instrumentation. -`coverage: "github"` is the default. Set `coverage: "codecov"` and grant the -job `id-token: write` for OIDC upload of `coverage.out`. An empty coverage -value disables publication while retaining JUnit; collection is controlled by -the command. Custom commands must produce the applicable report files. - - - - -Native reports survive command failures and are retained for seven days. -See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions. - - - -Native `coverage: github-code-quality` prepares Cobertura artifacts for the common -[CI reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.md) -and its opt-in publication workflow. Set `report-group` to the outer calling job -and list every expected component in the collector. The default label is the -repository-relative working directory, or `root`. Multiple reports need explicit -stable labels. Reports must measure the PR head commit, not the PR merge commit. -Keep merge-result validation separately when required. No upload permission is -needed in this test action; only the publication job needs `code-quality: write`. +Forward report-plan from standalone jobs, or use the reusable CI workflow, which +exposes the complete expected plan automatically. Choose external coverage +publication once in the common ci-reports workflow. This action posts no comments +and needs no publication permissions. Available reports survive test failures. @@ -79,7 +43,7 @@ needed in this test action; only the publication job needs `code-quality: write` ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 +- uses: hoverkraft-tech/ci-github-go/actions/test@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -92,18 +56,15 @@ needed in this test action; only the publication job needs `code-quality: write` # Default: `true` race: "true" - # Native GitHub coverage reports as a JSON array of file, language and optional label. - # Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. - # Every file must be Cobertura XML produced by the test command. Paths are relative - # to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. + # Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. coverage-reports: "" - # Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command. - # Default: `github` - coverage: github + # Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. + # Default: `true` + coverage: "true" - # Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. - report-group: "" + # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. + report-plan: "" ``` @@ -112,17 +73,14 @@ needed in this test action; only the publication job needs `code-quality: write` ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`command`** | Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. | **false** | - | -| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | -| **`coverage-reports`** | Native GitHub coverage reports as a JSON array of file, language and optional label. | **false** | - | -| | Empty converts coverage.out to cobertura.xml with the pinned Go converter; multiple reports require explicit unique labels. | | | -| | Every file must be Cobertura XML produced by the test command. Paths are relative | | | -| | to working-directory. Example: [{"file":"coverage.xml","language":"Go","label":"backend"}]. | | | -| **`coverage`** | Publication only: `github` (native go tool cover summary), `github-code-quality` (Cobertura artifact), `codecov`, or empty. Collection is controlled by the test command. | **false** | `github` | -| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`command`** | Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. | **false** | - | +| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | +| **`coverage-reports`** | Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. | **false** | - | +| **`coverage`** | Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. | **false** | `true` | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | - | @@ -133,11 +91,10 @@ needed in this test action; only the publication job needs `code-quality: write` ## Outputs -| **Output** | **Description** | -| --------------------------------- | ----------------------------------------------------------------------------------------------- | -| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. | -| **`native-coverage-artifact-id`** | Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. | -| **`coverage-artifact-id`** | Native coverage.out artifact ID for GitHub coverage, or empty when unavailable. | +| **Output** | **Description** | +| ------------------------ | --------------------------------------------------------------------- | +| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | +| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | diff --git a/actions/test/action.yml b/actions/test/action.yml index 91d2937..012e95d 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -57,7 +57,7 @@ runs: case "$RACE" in true|false) ;; *) echo 'race must be true or false.' >&2; exit 1 ;; esac case "$COVERAGE" in true|false) ;; *) echo 'coverage must be true or false.' >&2; exit 1 ;; esac - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) with: operation: plan report-plan: ${{ inputs.report-plan }} @@ -99,7 +99,7 @@ runs: - name: Record test results id: reports if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@5ea25078a15fe361993382872c03a63fd667c11a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) with: working-directory: ${{ steps.directory.outputs.absolute-path }} report-plan: ${{ steps.report-plan.outputs.report-plan }} From 8245b03d3b26196e5d3d6ed3559f4a3e72fa24f5 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 02:09:21 +0100 Subject: [PATCH 06/35] feat(reports)!: validate native Go results before consolidated publication --- .github/workflows/__shared-ci.yml | 29 ++++- .github/workflows/__test-action-lint.yml | 37 ++---- .github/workflows/__test-action-setup-go.yml | 6 +- .github/workflows/__test-action-test.yml | 59 ++-------- ...__test-workflow-continuous-integration.yml | 21 +--- .github/workflows/continuous-integration.md | 103 ++++++---------- .github/workflows/continuous-integration.yml | 111 ++++++------------ actions/lint/README.md | 48 ++++---- actions/lint/action.yml | 77 ++++++------ actions/test/README.md | 50 ++++---- actions/test/action.test.cjs | 32 +++++ actions/test/action.yml | 98 +++++++++------- tests/config.test.cjs | 21 ++-- 13 files changed, 308 insertions(+), 384 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index f6f8f54..c4001db 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -1,11 +1,10 @@ ---- name: Internal - Common Continuous Integration tasks "on": workflow_call: null permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) permissions: contents: read statuses: write @@ -23,13 +22,13 @@ jobs: uses: $/.github/workflows/__test-workflow-continuous-integration.yml permissions: contents: read - pull-requests: write id-token: write - code-quality: write + actions: read test-action-setup-go: uses: $/.github/workflows/__test-action-setup-go.yml permissions: contents: read + actions: read test-action-lint: uses: $/.github/workflows/__test-action-lint.yml permissions: @@ -44,7 +43,29 @@ jobs: uses: $/.github/workflows/__test-action-audit.yml permissions: contents: read + actions: read test-action-build: uses: $/.github/workflows/__test-action-build.yml permissions: contents: read + actions: read + reports: + if: ${{ !cancelled() }} + needs: + - linter + - test + - test-action-setup-go + - test-action-lint + - test-action-test + - test-action-audit + - test-action-build + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + permissions: + actions: read + contents: read + pull-requests: write + code-quality: write + id-token: write + security-events: write + with: + job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index a4cacf5..b5b6b01 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -1,4 +1,3 @@ ---- name: Internal - Test lint action "on": workflow_call: null @@ -9,8 +8,9 @@ jobs: timeout-minutes: 20 permissions: contents: read + actions: read outputs: - artifact-id: ${{ steps.failed-lint.outputs.report-artifact-id }} + artifact-id: ${{ steps.check.outputs.report-artifact-id }} steps: - name: Arrange - Check out the repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -18,11 +18,12 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 with: command: test:ci arguments: '["actions/lint/action.test.cjs"]' - coverage: "false" + coverage: none + comment: "false" - name: Arrange - Install the project runtime and dependencies uses: $/actions/setup-go with: @@ -31,23 +32,7 @@ jobs: uses: $/actions/lint with: working-directory: tests/go-project - - name: Act - Retain diagnostics from a failing command - uses: $/actions/lint - with: - working-directory: tests/go-project - command: | - printf '%s\n' '' > checkstyle.xml - exit 23 - id: failed-lint - continue-on-error: true - - name: Assert - Failure propagates and reports survive - shell: bash - run: | - test "$OUTCOME" = failure - test -n "$ARTIFACT" - env: - OUTCOME: ${{ steps.failed-lint.outcome }} - ARTIFACT: ${{ steps.failed-lint.outputs.report-artifact-id }} + id: check verify: needs: lint runs-on: ubuntu-latest @@ -61,11 +46,11 @@ jobs: with: github-token: ${{ github.token }} artifact-ids: ${{ needs.lint.outputs.artifact-id }} - path: ${{ runner.temp }}/lint-reports - - name: Assert - Retained report contains the diagnostic + path: ${{ runner.temp }}/retained-reports + - name: Assert - Native reports and validation result are retained shell: bash run: | - test -f "$REPORT_DIRECTORY/ci-report.json" - grep -rq 'message="expected lint failure"' "$REPORT_DIRECTORY/reports" + test -f "$REPORT_DIRECTORY/result.json" + test -s "$REPORT_DIRECTORY/reports/golangci-lint.sarif" env: - REPORT_DIRECTORY: ${{ runner.temp }}/lint-reports + REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index c053dc9..97ea9d2 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -1,4 +1,3 @@ ---- name: Internal - Test setup-go action "on": workflow_call: null @@ -16,11 +15,12 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 with: command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' - coverage: "false" + coverage: none + comment: "false" - name: Act - Detect the runtime and install dependencies uses: $/actions/setup-go with: diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 55b279a..670488e 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -1,4 +1,3 @@ ---- name: Internal - Test test action "on": workflow_call: null @@ -9,9 +8,9 @@ jobs: timeout-minutes: 20 permissions: contents: read + actions: read outputs: - artifact-id: ${{ steps.failed-test.outputs.report-artifact-id }} - success-artifact-id: ${{ steps.test.outputs.report-artifact-id }} + artifact-id: ${{ steps.check.outputs.report-artifact-id }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -19,43 +18,22 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 with: command: test:ci arguments: '["actions/test/action.test.cjs"]' - coverage: "false" + coverage: none + comment: "false" - uses: $/actions/setup-go with: working-directory: tests/go-project name: Arrange - Install dependencies - - id: test + - id: check uses: $/actions/test with: working-directory: tests/go-project - name: Act - Run default tests - - id: failed-test - continue-on-error: true - uses: $/actions/test - with: - working-directory: tests/go-project - command: |- - printf '%s' 'failure' > junit.xml - exit 17 coverage: "false" - name: Act - Run a failing test command - - name: Assert failures and reports - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - SUCCESS_ARTIFACT: ${{ steps.test.outputs.report-artifact-id }} - FAILURE_ARTIFACT: ${{ steps.failed-test.outputs.report-artifact-id }} - TEST_OUTCOME: ${{ steps.failed-test.outcome }} - with: - script: | - const assert = require('node:assert/strict'); - assert.equal(process.env.TEST_OUTCOME, 'failure'); - assert.ok(process.env.SUCCESS_ARTIFACT, 'Successful tests retain reports'); - assert.ok(process.env.FAILURE_ARTIFACT, 'Failed tests retain reports'); - assert.notEqual(process.env.SUCCESS_ARTIFACT, process.env.FAILURE_ARTIFACT); + name: Act - Run default tests verify: needs: test runs-on: ubuntu-latest @@ -68,24 +46,11 @@ jobs: with: github-token: ${{ github.token }} artifact-ids: ${{ needs.test.outputs.artifact-id }} - path: ${{ runner.temp }}/failed-reports - - name: Verify retained failure report + path: ${{ runner.temp }}/retained-reports + - name: Assert - Native reports and validation result are retained shell: bash env: - REPORT_DIRECTORY: ${{ runner.temp }}/failed-reports + REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports run: | - test -f "$REPORT_DIRECTORY/ci-report.json" - grep -rq 'message="expected"' "$REPORT_DIRECTORY/reports" - - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - github-token: ${{ github.token }} - artifact-ids: ${{ needs.test.outputs.success-artifact-id }} - path: ${{ runner.temp }}/successful-reports - - name: Verify consolidated reports parse every retained file - uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@33462c06bcbbd9144d7f661929e61953604b444d # 4.3.2 - with: - working-directory: ${{ runner.temp }}/successful-reports - report-paths: "reports/**/*.xml - - coverage/report-*.xml" - output-format: summary + test -f "$REPORT_DIRECTORY/result.json" + test -s "$REPORT_DIRECTORY/reports/junit.xml" diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 044dd22..fe4118a 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -1,4 +1,3 @@ ---- name: Internal - Test continuous integration workflow "on": workflow_call: null @@ -14,16 +13,18 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@11636b817040a2a7d61b389c28fa1b401c37a2fa # unified reports (PR #624, unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 with: command: test:ci arguments: '["tests/config.test.cjs"]' - coverage: "false" + coverage: none + comment: "false" fixture: uses: $/.github/workflows/continuous-integration.yml permissions: contents: read id-token: write + actions: read with: working-directory: tests/go-project test: '{"coverage":true}' @@ -34,21 +35,9 @@ jobs: permissions: contents: read id-token: write + actions: read with: checks: false working-directory: must-not-exist lint: exit 99 test: exit 99 - - collect-native-coverage: - name: Verify coverage from the primary runtime - needs: fixture - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) - permissions: - contents: read - pull-requests: write - code-quality: write - id-token: write - with: - comment: false - job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 951edc4..b46ff7b 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -40,7 +40,7 @@ jobs: go-versions: '["1.26", "1.27"]' ``` -An empty versions input uses project detection once. The last matrix entry is +An empty versions input uses project detection once. The highest configured version is the primary version: lint, audit and build checks run there, and only that version contributes coverage. Tests run on every entry with fail-fast disabled. Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON @@ -87,54 +87,25 @@ with: inside the checkout. Each invocation uses a unique artifact name. Build output is not published as a release. -### Reports and coverage +### Reports and permissions -Lint and test jobs retain native diagnostics in one artifact per execution. -They post no PR comments and need no publication permissions. Configure native -test reports (JUnit or TAP) and lint reports (for example Checkstyle or SARIF). -Missing required reports fail even when the tool command exits successfully. -Available reports are retained after failures. +Every runtime retains validated JUnit test results. Lint and coverage run once +on the highest configured version; the default command disables instrumentation +on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. +Go coverage remains a native profile with its statement-weighted measurement. +Line-oriented publication formats are prepared only for selected destinations. -Tests require Cobertura by default. The highest configured runtime contributes -coverage; every runtime retains its test results. Set `test: '{"coverage":false}'` -for tests that deliberately produce no Cobertura. The command still controls -instrumentation. Custom `test.coverage-reports` describes Cobertura file paths, -Linguist languages and stable component labels; it belongs beside the producer. -Separate components stay separate. Merge shards in the framework first. - -Call the common workflow once after producer workflows. It reads their complete -report plans from `needs`, regardless of calling job names: - -```yaml -reports: - needs: [checks] - if: ${{ always() }} - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@ - permissions: - contents: read - pull-requests: write - code-quality: write - id-token: write - with: - job-results: ${{ toJSON(needs) }} - coverage: github -``` - -Select `coverage: none` (default) for summaries, `github` for native GitHub -coverage, or `codecov`. Both publishers consume validated Cobertura. Native -GitHub coverage requires repository enablement and a default-branch baseline. -The reporting workflow owns one CI comment and the `CI reports complete` check. -Forks retain diagnostics without write operations. Partial reruns require -rerunning all producers. Producer workflows test the PR head or push revision. - -Standalone action jobs forward their `report-plan` output. Custom outer matrices -must forward a complete plan derived from their configuration; GitHub's last -successful matrix output does not describe all executions. See the common -[recording action](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/quality/record-ci-reports) -for the advanced contract. No collector-side coverage inventory is needed. +Call common ci-reports.yml once after all jobs with job-results: toJSON(needs). +No report plans or artifact IDs need forwarding. Producer calls require actions: +read and contents: read. The reporting caller grants actions: read, contents: read, +pull-requests: write, code-quality: write, id-token: write and security-events: write. +Lint and tests default to annotations; coverage uses GitHub when available and +a comment or summary otherwise. Select destinations once using lint-reporters, +test-results-reporters and test-coverage-reporters. ### Permissions +- **`actions`**: `read` - **`contents`**: `read` @@ -155,8 +126,9 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage permissions: + actions: read contents: read with: # JSON array of Linux runner labels for all jobs. @@ -171,14 +143,14 @@ jobs: # Default: `.` working-directory: . - # JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. + # JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. go-versions: "" - # true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. + # true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. # Default: `true` lint: "true" - # true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime. + # true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests. # Default: `true` test: "true" @@ -197,9 +169,6 @@ jobs: # Pinned golangci-lint v2 release used by the lint action. # Default: `v2.15.0` golangci-lint-version: v2.15.0 - - # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. - report-plan: "" ``` @@ -210,19 +179,18 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | -| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | -| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | -| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | -| **`go-versions`** | JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - | -| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` | -| **`test`** | true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime. | **false** | **string** | `true` | -| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | -| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | -| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | **string** | - | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | ------------------- | +| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | +| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | +| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | +| **`go-versions`** | JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. | **false** | **string** | - | +| **`lint`** | true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests. | **false** | **string** | `true` | +| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | +| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | +| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | @@ -233,10 +201,9 @@ jobs: ## Outputs -| **Output** | **Description** | -| ----------------------- | -------------------------------------------------------------------- | -| **`build-artifact-id`** | Build artifact ID when build.artifact is configured. | -| **`report-plan`** | Complete expected report plan, consumed automatically by ci-reports. | +| **Output** | **Description** | +| ----------------------- | ---------------------------------------------------- | +| **`build-artifact-id`** | Build artifact ID when build.artifact is configured. | diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index febf6a9..1ea7a53 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -16,7 +16,7 @@ # go-versions: '["1.26", "1.27"]' # ``` # -# An empty versions input uses project detection once. The last matrix entry is +# An empty versions input uses project detection once. The highest configured version is # the primary version: lint, audit and build checks run there, and only # that version contributes coverage. Tests run on every entry with fail-fast disabled. # Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON @@ -63,51 +63,21 @@ # inside the checkout. Each invocation uses a unique artifact name. # Build output is not published as a release. # -# ### Reports and coverage +# ### Reports and permissions # -# Lint and test jobs retain native diagnostics in one artifact per execution. -# They post no PR comments and need no publication permissions. Configure native -# test reports (JUnit or TAP) and lint reports (for example Checkstyle or SARIF). -# Missing required reports fail even when the tool command exits successfully. -# Available reports are retained after failures. +# Every runtime retains validated JUnit test results. Lint and coverage run once +# on the highest configured version; the default command disables instrumentation +# on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. +# Go coverage remains a native profile with its statement-weighted measurement. +# Line-oriented publication formats are prepared only for selected destinations. # -# Tests require Cobertura by default. The highest configured runtime contributes -# coverage; every runtime retains its test results. Set `test: '{"coverage":false}'` -# for tests that deliberately produce no Cobertura. The command still controls -# instrumentation. Custom `test.coverage-reports` describes Cobertura file paths, -# Linguist languages and stable component labels; it belongs beside the producer. -# Separate components stay separate. Merge shards in the framework first. -# -# Call the common workflow once after producer workflows. It reads their complete -# report plans from `needs`, regardless of calling job names: -# -# ```yaml -# reports: -# needs: [checks] -# if: ${{ always() }} -# uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@ -# permissions: -# contents: read -# pull-requests: write -# code-quality: write -# id-token: write -# with: -# job-results: ${{ toJSON(needs) }} -# coverage: github -# ``` -# -# Select `coverage: none` (default) for summaries, `github` for native GitHub -# coverage, or `codecov`. Both publishers consume validated Cobertura. Native -# GitHub coverage requires repository enablement and a default-branch baseline. -# The reporting workflow owns one CI comment and the `CI reports complete` check. -# Forks retain diagnostics without write operations. Partial reruns require -# rerunning all producers. Producer workflows test the PR head or push revision. -# -# Standalone action jobs forward their `report-plan` output. Custom outer matrices -# must forward a complete plan derived from their configuration; GitHub's last -# successful matrix output does not describe all executions. See the common -# [recording action](https://github.com/hoverkraft-tech/ci-github-common/tree/main/actions/quality/record-ci-reports) -# for the advanced contract. No collector-side coverage inventory is needed. +# Call common ci-reports.yml once after all jobs with job-results: toJSON(needs). +# No report plans or artifact IDs need forwarding. Producer calls require actions: +# read and contents: read. The reporting caller grants actions: read, contents: read, +# pull-requests: write, code-quality: write, id-token: write and security-events: write. +# Lint and tests default to annotations; coverage uses GitHub when available and +# a comment or summary otherwise. Select destinations once using lint-reporters, +# test-results-reporters and test-coverage-reporters. # name: Go Continuous Integration "on": @@ -126,15 +96,15 @@ name: Go Continuous Integration type: string default: . go-versions: - description: JSON array of Go versions. The last entry runs lint, audit and build and contributes coverage. Empty runs project detection once. An empty entry uses the project version. + description: JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. type: string default: "" lint: - description: true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. + description: true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. type: string default: "true" test: - description: "true for defaults, a Bash command, or JSON options (command, coverage, coverage-reports, race). false, null or empty disables tests. Coverage is collected once, on the primary runtime." + description: "true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests." type: string default: "true" audit: @@ -153,17 +123,10 @@ name: Go Continuous Integration description: Pinned golangci-lint v2 release used by the lint action. type: string default: v2.15.0 - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. - default: "" - type: string outputs: build-artifact-id: description: Build artifact ID when build.artifact is configured. value: ${{ jobs.build.outputs.artifact-id }} - report-plan: - description: Complete expected report plan, consumed automatically by ci-reports. - value: ${{ jobs.configuration.outputs.report-plan }} permissions: {} jobs: configuration: @@ -175,8 +138,6 @@ jobs: lint: ${{ steps.config.outputs.lint }} test: ${{ steps.config.outputs.test }} build: ${{ steps.config.outputs.build }} - report-plan: ${{ steps.report-plan.outputs.report-plan }} - report-selections: ${{ steps.report-plan.outputs.selections }} steps: - id: config uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -211,8 +172,8 @@ jobs: } return config; } - const lint = options('lint', process.env.LINT, {command: ''}); - const test = options('test', process.env.TEST, {"command": "", "coverage": true, "race": true, "coverage-reports": []}); + const lint = options('lint', process.env.LINT, {command: '', 'lint-results':'golangci-lint.sarif'}); + const test = options('test', process.env.TEST, {command:'', coverage:true, race:true, 'test-results':'junit.xml', 'test-coverage':'coverage.out'}); const build = options('build', process.env.BUILD, {command: 'go build -mod=readonly -trimpath ./...', artifact: ''}); const artifact = build?.artifact; if (artifact && (artifact === '.' || artifact.startsWith('/') || artifact.includes('\\') || artifact.split('/').includes('..') || /[\r\n*?]/.test(artifact))) { @@ -221,24 +182,18 @@ jobs: if (build && !build.command.trim()) throw new Error('build.command must not be empty.'); core.setOutput('build', JSON.stringify(build)); core.setOutput('versions', versions); - core.setOutput('primary-version', versions.at(-1)); + if (versions.length > 1 && versions.includes('')) throw new Error('Project detection cannot be mixed with explicit versions.'); + const primary = [...versions].sort((a, b) => { + const left = a.split('.').map(Number); const right = b.split('.').map(Number); + for (let index = 0; index < 3; index++) { + const difference = (left[index] || 0) - (right[index] || 0); + if (difference) return difference; + } + return 0; + }).at(-1); + core.setOutput('primary-version', primary); core.setOutput('lint', JSON.stringify(lint)); core.setOutput('test', JSON.stringify(test)); - - const directory = process.env.DIRECTORY || '.'; - const producers = []; - if (process.env.CHECKS === 'true' && lint) producers.push({key:'lint',type:'lint',directory,coverage:[]}); - if (process.env.CHECKS === 'true' && test) for (const version of versions) { - producers.push({key:'test-'+(version || 'project'),type:'test',directory, - coverage:version === versions.at(-1) && test.coverage ? (test['coverage-reports'].length ? test['coverage-reports'] : [{file:'cobertura.xml',language:'Go'}]) : []}); - } - core.setOutput('report-producers', producers); - - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) - with: - operation: plan - producers: ${{ steps.config.outputs.report-producers }} - report-plan: ${{ inputs.report-plan }} dependency-review: if: inputs.checks && inputs.dependency-review && github.event_name == 'pull_request' runs-on: ${{ fromJSON(inputs.runs-on) }} @@ -258,6 +213,7 @@ jobs: timeout-minutes: 20 permissions: contents: read + actions: read steps: - *checkout - &setup-primary @@ -270,7 +226,7 @@ jobs: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} golangci-lint-version: ${{ inputs.golangci-lint-version }} - report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections).lint) }} + lint-results: ${{ fromJSON(needs.configuration.outputs.lint).lint-results }} test: if: inputs.checks && needs.configuration.outputs.test != 'null' needs: configuration @@ -278,6 +234,7 @@ jobs: timeout-minutes: 20 permissions: contents: read + actions: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -291,10 +248,10 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.test).command }} - coverage-reports: ${{ fromJSON(needs.configuration.outputs.test).coverage-reports[0] && toJSON(fromJSON(needs.configuration.outputs.test).coverage-reports) || '' }} coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} race: ${{ fromJSON(needs.configuration.outputs.test).race }} - report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections)[format('test-{0}', matrix.version || 'project')]) }} + test-results: ${{ fromJSON(needs.configuration.outputs.test).test-results }} + test-coverage: ${{ fromJSON(needs.configuration.outputs.test).test-coverage }} strategy: fail-fast: false matrix: diff --git a/actions/lint/README.md b/actions/lint/README.md index 6fd833a..09c08fe 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -25,20 +25,12 @@ Check gofmt, module tidiness and golangci-lint v2 diagnostics. -Put project rules in `.golangci.yml`; the default is the standard linter set. -The pinned golangci-lint release must support the selected Go version. -Use `command` to replace defaults with a trusted Bash program. -Custom commands should emit SARIF or Checkstyle for annotations. - - - - -Run [setup-go](../setup-go/README.md) first with the same `working-directory`. - -Native reports survive command failures and are retained for seven days. -See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions. - - +Run setup-go first. Project rules belong in .golangci.yml. All default checks +execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. +Custom commands must write the declared native reports under CI_REPORTS_DIR. +Reports are registered before execution and validated afterward, including after +failure. Call common ci-reports once after all jobs for annotations and summaries. +Producer jobs require actions: read and contents: read. @@ -50,7 +42,7 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -60,11 +52,12 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int # Default: `v2.15.0` golangci-lint-version: v2.15.0 - # Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. + # Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. command: "" - # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. - report-plan: "" + # Required native report paths relative to CI_REPORTS_DIR, one per line. + # Default: `golangci-lint.sarif` + lint-results: golangci-lint.sarif ``` @@ -73,12 +66,12 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | -| **`command`** | Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. | **false** | - | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | +| **`command`** | Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | +| **`lint-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `golangci-lint.sarif` | @@ -89,10 +82,9 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int ## Outputs -| **Output** | **Description** | -| ------------------------ | ------------------------------------------------------------ | -| **`report-plan`** | Expected lint report metadata. Forward from standalone jobs. | -| **`report-artifact-id`** | Native lint report bundle. | +| **Output** | **Description** | +| ------------------------ | -------------------------- | +| **`report-artifact-id`** | Native lint report bundle. | diff --git a/actions/lint/action.yml b/actions/lint/action.yml index ff0230d..a4aee57 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -3,20 +3,12 @@ name: Lint Go description: | Check gofmt, module tidiness and golangci-lint v2 diagnostics. - Put project rules in `.golangci.yml`; the default is the standard linter set. - The pinned golangci-lint release must support the selected Go version. - Use `command` to replace defaults with a trusted Bash program. - Custom commands should emit SARIF or Checkstyle for annotations. - - - - - Run [setup-go](../setup-go/README.md) first with the same `working-directory`. - - Native reports survive command failures and are retained for seven days. - See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions. - - + Run setup-go first. Project rules belong in .golangci.yml. All default checks + execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. + Custom commands must write the declared native reports under CI_REPORTS_DIR. + Reports are registered before execution and validated afterward, including after + failure. Call common ci-reports once after all jobs for annotations and summaries. + Producer jobs require actions: read and contents: read. author: hoverkraft branding: icon: package @@ -29,15 +21,12 @@ inputs: description: Pinned golangci-lint v2 release. default: v2.15.0 command: - description: Trusted Bash command replacing the default formatting and lint checks. Project configuration remains authoritative. - default: "" - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. + description: Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. default: "" + lint-results: + description: Required native report paths relative to CI_REPORTS_DIR, one per line. + default: golangci-lint.sarif outputs: - report-plan: - description: Expected lint report metadata. Forward from standalone jobs. - value: ${{ steps.report-plan.outputs.report-plan }} report-artifact-id: description: Native lint report bundle. value: ${{ steps.reports.outputs.artifact-id }} @@ -48,12 +37,6 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 with: working-directory: ${{ inputs.working-directory }} - - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) - with: - operation: plan - report-plan: ${{ inputs.report-plan }} - producers: '[{"key":"lint","type":"lint","directory":${{ toJSON(steps.directory.outputs.workspace-relative-path || ''.'') }},"coverage":[]}]' - id: golangci if: inputs.command == '' uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 @@ -61,6 +44,31 @@ runs: version: ${{ inputs.golangci-lint-version }} install-only: true working-directory: ${{ steps.directory.outputs.workspace-relative-path }} + - id: definition + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + DIRECTORY: ${{ steps.directory.outputs.workspace-relative-path || '.' }} + WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} + GOTOOLCHAIN: local + GOWORK: off + RESULTS: ${{ inputs.lint-results }} + with: + script: | + const paths = value => { + const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean); + if (!result.length) throw new Error('Required report paths must not be empty.'); + return result; + }; + const reports = paths(process.env.RESULTS).map(pattern => ({kind: 'lint', pattern})); + const options = {cwd:process.env.WORKING_DIRECTORY,silent:true}; + const runtime = await exec.getExecOutput('go', ['env','GOVERSION'], options); + const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); + core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); + - id: prepare + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + with: + operation: prepare + definition: ${{ steps.definition.outputs.definition }} - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -68,6 +76,7 @@ runs: COMMAND: ${{ inputs.command }} GOTOOLCHAIN: local GOWORK: "off" + CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }} run: | if [ -n "$COMMAND" ] && ! [[ "$COMMAND" =~ [^[:space:]] ]]; then echo "command must not contain only whitespace." >&2 @@ -86,13 +95,13 @@ runs: fi done < <(find . -type d \( -name vendor -o -name .git -o -name .cache \) -prune -o -type f -name '*.go' -print0) go mod tidy -diff || status=1 - golangci-lint run --timeout=5m --output.sarif.path=golangci-lint.sarif || status=1 + golangci-lint run --timeout=5m --output.sarif.path="$CI_REPORTS_DIR/golangci-lint.sarif" || status=1 exit "$status" - id: reports - name: Record lint results - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + name: Validate and retain native reports + if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # unified reports (PR #683, unreleased) with: - working-directory: ${{ steps.directory.outputs.absolute-path }} - report-plan: ${{ steps.report-plan.outputs.report-plan }} - report-paths: auto:lint + operation: finalize + recording: ${{ steps.prepare.outputs.recording }} + outcome: ${{ steps.run.outcome }} diff --git a/actions/test/README.md b/actions/test/README.md index d48e48d..92caf1a 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -23,15 +23,16 @@ ## Overview -Run Go tests and retain native test and coverage reports. +Run Go tests with detailed JUnit results on every runtime and optional native coverage. -Use the matching setup action first. Commands must generate JUnit reports. -Coverage collection requires Cobertura XML. The test command controls instrumentation. +Run setup-go first. Defaults write junit.xml and coverage.out into a fresh +CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. +Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -Forward report-plan from standalone jobs, or use the reusable CI workflow, which -exposes the complete expected plan automatically. Choose external coverage -publication once in the common ci-reports workflow. This action posts no comments -and needs no publication permissions. Available reports survive test failures. +Required outputs are registered before execution and validated after success or +failure. The Go profile retains native statement counts. Select publication once +in common ci-reports after all jobs; no report outputs need forwarding. +Producer jobs require actions: read and contents: read. @@ -43,28 +44,30 @@ and needs no publication permissions. Available reports survive test failures. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@0814116d658bad2bf0f56c9e61b492a46b43dd88 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage with: # Go module directory. # Default: `.` working-directory: . - # Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. + # Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. command: "" # Enable the race detector for the default command. Requires CGO and a C compiler. # Default: `true` race: "true" - # Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. - coverage-reports: "" - - # Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. + # Collect native Go coverage. The default command disables instrumentation when false. # Default: `true` coverage: "true" - # Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. - report-plan: "" + # Required native report paths relative to CI_REPORTS_DIR, one per line. + # Default: `junit.xml` + test-results: junit.xml + + # Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. + # Default: `coverage.out` + test-coverage: coverage.out ``` @@ -73,14 +76,14 @@ and needs no publication permissions. Available reports survive test failures. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`command`** | Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. | **false** | - | -| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | -| **`coverage-reports`** | Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. | **false** | - | -| **`coverage`** | Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. | **false** | `true` | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`command`** | Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | +| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | +| **`coverage`** | Collect native Go coverage. The default command disables instrumentation when false. | **false** | `true` | +| **`test-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` | +| **`test-coverage`** | Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. | **false** | `coverage.out` | @@ -93,7 +96,6 @@ and needs no publication permissions. Available reports survive test failures. | **Output** | **Description** | | ------------------------ | --------------------------------------------------------------------- | -| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | | **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | diff --git a/actions/test/action.test.cjs b/actions/test/action.test.cjs index 2ca357f..8274eaf 100644 --- a/actions/test/action.test.cjs +++ b/actions/test/action.test.cjs @@ -42,3 +42,35 @@ test("test configuration rejects non-boolean coverage configuration", (t) => { 0, ); }); + +test("the default command only instruments the primary runtime and writes fresh native outputs", (t) => { + const directory = createWorkspace(t); + const log = path.join(directory, "arguments.json"); + fs.writeFileSync( + path.join(directory, "go"), + `#!/usr/bin/env node\nrequire("node:fs").writeFileSync(process.env.ARGUMENT_LOG,JSON.stringify(process.argv.slice(2)));\n`, + { mode: 0o700 }, + ); + for (const coverage of ["true", "false"]) { + const result = runActionStep(actionFile, "run", directory, { + COMMAND: "", + RACE: "true", + GOTESTSUM_VERSION: "v1.13.0", + CI_TEST_COVERAGE: coverage, + CI_REPORTS_DIR: path.join(directory, "fresh reports"), + PATH: `${directory}:${process.env.PATH}`, + ARGUMENT_LOG: log, + }); + assert.equal(result.status, 0, result.stderr); + const args = JSON.parse(fs.readFileSync(log, "utf8")); + assert.ok( + args.includes(`--junitfile=${directory}/fresh reports/junit.xml`), + ); + assert.equal( + args.includes(`-coverprofile=${directory}/fresh reports/coverage.out`), + coverage === "true", + ); + assert.equal(args.includes("-covermode=atomic"), coverage === "true"); + assert.ok(args.includes("-race")); + } +}); diff --git a/actions/test/action.yml b/actions/test/action.yml index 012e95d..0d2e6ff 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -1,15 +1,16 @@ --- name: Test Go description: | - Run Go tests and retain native test and coverage reports. + Run Go tests with detailed JUnit results on every runtime and optional native coverage. - Use the matching setup action first. Commands must generate JUnit reports. - Coverage collection requires Cobertura XML. The test command controls instrumentation. + Run setup-go first. Defaults write junit.xml and coverage.out into a fresh + CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. + Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. - Forward report-plan from standalone jobs, or use the reusable CI workflow, which - exposes the complete expected plan automatically. Choose external coverage - publication once in the common ci-reports workflow. This action posts no comments - and needs no publication permissions. Available reports survive test failures. + Required outputs are registered before execution and validated after success or + failure. The Go profile retains native statement counts. Select publication once + in common ci-reports after all jobs; no report outputs need forwarding. + Producer jobs require actions: read and contents: read. author: hoverkraft branding: icon: package @@ -19,25 +20,21 @@ inputs: description: Go module directory. default: . command: - description: Trusted Bash command replacing the default test command. Generate junit.xml and coverage.out for reporting. + description: Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. default: "" race: description: Enable the race detector for the default command. Requires CGO and a C compiler. default: "true" - coverage-reports: - description: |- - Optional JSON array of Cobertura file, language and label. Empty uses cobertura.xml and the project directory as its stable label. - default: "" coverage: - description: Require and collect Cobertura coverage. Set false to retain only available native diagnostics. Instrumentation is controlled by the test command. + description: Collect native Go coverage. The default command disables instrumentation when false. default: "true" - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for a standalone invocation. - default: "" + test-results: + description: Required native report paths relative to CI_REPORTS_DIR, one per line. + default: junit.xml + test-coverage: + description: Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. + default: coverage.out outputs: - report-plan: - description: Expected report metadata. Forward from standalone jobs. - value: ${{ steps.report-plan.outputs.report-plan }} report-artifact-id: description: Native report bundle, including available diagnostics after failures. value: ${{ steps.reports.outputs.artifact-id }} @@ -56,12 +53,34 @@ runs: run: | case "$RACE" in true|false) ;; *) echo 'race must be true or false.' >&2; exit 1 ;; esac case "$COVERAGE" in true|false) ;; *) echo 'coverage must be true or false.' >&2; exit 1 ;; esac - - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + - id: definition + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + DIRECTORY: ${{ steps.directory.outputs.workspace-relative-path || '.' }} + WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} + GOTOOLCHAIN: local + GOWORK: off + RESULTS: ${{ inputs.test-results }} + COVERAGE: ${{ inputs.coverage }} + COVERAGE_PATHS: ${{ inputs.test-coverage }} + with: + script: | + const paths = value => { + const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean); + if (!result.length) throw new Error('Required report paths must not be empty.'); + return result; + }; + const reports = paths(process.env.RESULTS).map(pattern => ({kind: 'test', pattern})); + if (process.env.COVERAGE === 'true') reports.push(...paths(process.env.COVERAGE_PATHS).map(pattern => ({kind:'coverage',pattern,language:'Go'}))); + const options = {cwd:process.env.WORKING_DIRECTORY,silent:true}; + const runtime = await exec.getExecOutput('go', ['env','GOVERSION'], options); + const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); + core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); + - id: prepare + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) with: - operation: plan - report-plan: ${{ inputs.report-plan }} - producers: '[{"key":"test","type":"test","directory":${{ toJSON(steps.directory.outputs.workspace-relative-path || ''.'') }},"coverage":${{ inputs.coverage == ''true'' && (inputs.coverage-reports || ''[{"file":"cobertura.xml","language":"Go"}]'') || ''[]'' }}}]' + operation: prepare + definition: ${{ steps.definition.outputs.definition }} - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -72,6 +91,8 @@ runs: GOTOOLCHAIN: local GOWORK: "off" CI: "true" + CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }} + CI_TEST_COVERAGE: ${{ inputs.coverage }} run: | if [ -n "$COMMAND" ] && ! [[ "$COMMAND" =~ [^[:space:]] ]]; then echo "command must not contain only whitespace." >&2 @@ -81,26 +102,15 @@ runs: bash --noprofile --norc -e -u -o pipefail -c "$COMMAND" exit fi - args=(-mod=readonly -count=1 -timeout=5m -covermode=atomic -coverprofile=coverage.out) + args=(-mod=readonly -count=1 -timeout=5m) + if [ "$CI_TEST_COVERAGE" = true ]; then args+=(-covermode=atomic "-coverprofile=$CI_REPORTS_DIR/coverage.out"); fi if [ "$RACE" = true ]; then args+=(-race); fi - go run "gotest.tools/gotestsum@$GOTESTSUM_VERSION" --junitfile=junit.xml --format=testname -- "${args[@]}" ./... - - name: Convert native Go coverage to Cobertura - id: cobertura - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'true' && inputs.coverage-reports == '' }} - shell: bash - working-directory: ${{ steps.directory.outputs.absolute-path }} - env: - GOCOVER_COBERTURA_VERSION: v1.5.0 - GOTOOLCHAIN: local - GOWORK: "off" - run: | - test -s coverage.out || { echo 'Native coverage requires coverage.out.' >&2; exit 1; } - go run "github.com/boumenot/gocover-cobertura@$GOCOVER_COBERTURA_VERSION" < coverage.out > cobertura.xml - - name: Record test results + go run "gotest.tools/gotestsum@$GOTESTSUM_VERSION" --junitfile="$CI_REPORTS_DIR/junit.xml" --format=testname -- "${args[@]}" ./... + - name: Validate and retain native reports id: reports - if: ${{ !cancelled() && steps.run.outcome != 'skipped' && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # unified reports (PR #683, unreleased) with: - working-directory: ${{ steps.directory.outputs.absolute-path }} - report-plan: ${{ steps.report-plan.outputs.report-plan }} - report-paths: auto:test + operation: finalize + recording: ${{ steps.prepare.outputs.recording }} + outcome: ${{ steps.run.outcome }} diff --git a/tests/config.test.cjs b/tests/config.test.cjs index 137781e..213a7e6 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -31,16 +31,17 @@ async function parse(env = {}) { return outputs; } -test("uses project detection by default and the last explicit version as primary", async () => { +test("uses project detection by default and the highest explicit version as primary", async () => { const automatic = await parse(); assert.deepEqual(automatic.versions, [""]); assert.equal(automatic["primary-version"], ""); - const explicit = await parse({ VERSIONS: '["1.26", "1.27"]' }); - assert.equal(explicit["primary-version"], explicit.versions.at(-1)); + const explicit = await parse({ VERSIONS: '["1.27", "1.26"]' }); + assert.equal(explicit["primary-version"], "1.27"); }); test("rejects ambiguous or unbounded version matrices", async () => { for (const value of [ + '["", "1.27"]', "[]", '["1.2", "1.2"]', "[1.2]", @@ -116,22 +117,16 @@ test("rejects unsafe build artifact directories and empty commands", async () => ); }); -test("preserves native coverage configuration and rejects ambiguous input types", async () => { +test("preserves native report paths and rejects ambiguous input types", async () => { const options = { coverage: true, - "coverage-reports": [ - { file: "custom.xml", language: "Go", label: "backend" }, - ], + "test-coverage": "coverage.out", + "test-results": "junit.xml", }; const actual = JSON.parse( (await parse({ TEST: JSON.stringify(options) })).test, ); for (const [key, value] of Object.entries(options)) assert.deepEqual(actual[key], value); - for (const invalid of [ - { "coverage-reports": {} }, - { "report-group": "bad/group" }, - ]) { - await assert.rejects(() => parse({ TEST: JSON.stringify(invalid) })); - } + await assert.rejects(() => parse({ TEST: '{"test-coverage":{}}' })); }); From 1616ee35e22f857dfd3003245cd37313428e6f01 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:08:03 +0100 Subject: [PATCH 07/35] refactor: consolidate native reports and require an independent CI gate --- .github/workflows/__shared-ci.yml | 36 ++++++++++++++----- .github/workflows/__test-action-lint.yml | 9 ++--- .github/workflows/__test-action-setup-go.yml | 8 +++-- .github/workflows/__test-action-test.yml | 9 ++--- ...__test-workflow-continuous-integration.yml | 12 ++++--- actions/lint/README.md | 2 +- actions/lint/action.yml | 4 +-- actions/test/README.md | 2 +- actions/test/action.yml | 4 +-- docs/development/README.md | 16 ++++++--- package.json | 3 +- 11 files changed, 68 insertions(+), 37 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index c4001db..eaaf10b 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,14 +4,14 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) permissions: + actions: read contents: read statuses: write issues: write packages: read pull-requests: write - actions: read security-events: write with: linter-env: | @@ -21,14 +21,14 @@ jobs: test: uses: $/.github/workflows/__test-workflow-continuous-integration.yml permissions: + actions: read contents: read id-token: write - actions: read test-action-setup-go: uses: $/.github/workflows/__test-action-setup-go.yml permissions: - contents: read actions: read + contents: read test-action-lint: uses: $/.github/workflows/__test-action-lint.yml permissions: @@ -42,15 +42,16 @@ jobs: test-action-audit: uses: $/.github/workflows/__test-action-audit.yml permissions: - contents: read actions: read + contents: read test-action-build: uses: $/.github/workflows/__test-action-build.yml permissions: - contents: read actions: read + contents: read + reports: - if: ${{ !cancelled() }} + if: always() needs: - linter - test @@ -59,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) permissions: actions: read contents: read @@ -69,3 +70,22 @@ jobs: security-events: write with: job-results: ${{ toJSON(needs) }} + + complete: + name: CI complete + if: always() + needs: + - linter + - test + - test-action-setup-go + - test-action-lint + - test-action-test + - test-action-audit + - test-action-build + - reports + runs-on: ubuntu-latest + permissions: {} + steps: + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + with: + job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index b5b6b01..de26ec7 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -7,8 +7,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 permissions: - contents: read actions: read + contents: read outputs: artifact-id: ${{ steps.check.outputs.report-artifact-id }} steps: @@ -18,12 +18,13 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) with: + test-results: junit.xml + test-coverage: lcov.info command: test:ci arguments: '["actions/lint/action.test.cjs"]' - coverage: none - comment: "false" + coverage: "false" - name: Arrange - Install the project runtime and dependencies uses: $/actions/setup-go with: diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 97ea9d2..c874f07 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -7,6 +7,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 permissions: + actions: read contents: read steps: - name: Arrange - Check out the repository @@ -15,12 +16,13 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) with: + test-results: junit.xml + test-coverage: lcov.info command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' - coverage: none - comment: "false" + coverage: "false" - name: Act - Detect the runtime and install dependencies uses: $/actions/setup-go with: diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 670488e..26191f1 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -7,8 +7,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 permissions: - contents: read actions: read + contents: read outputs: artifact-id: ${{ steps.check.outputs.report-artifact-id }} steps: @@ -18,12 +18,13 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) with: + test-results: junit.xml + test-coverage: lcov.info command: test:ci arguments: '["actions/test/action.test.cjs"]' - coverage: none - comment: "false" + coverage: "false" - uses: $/actions/setup-go with: working-directory: tests/go-project diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index fe4118a..315b87b 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -6,6 +6,7 @@ jobs: configuration: runs-on: ubuntu-latest permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -13,18 +14,19 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@191d7230d57982bfc11d57f68b005f386a6d7fbf # 3.1.1 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) with: + test-results: junit.xml + test-coverage: lcov.info command: test:ci arguments: '["tests/config.test.cjs"]' - coverage: none - comment: "false" + coverage: "true" fixture: uses: $/.github/workflows/continuous-integration.yml permissions: + actions: read contents: read id-token: write - actions: read with: working-directory: tests/go-project test: '{"coverage":true}' @@ -33,9 +35,9 @@ jobs: checks-disabled: uses: $/.github/workflows/continuous-integration.yml permissions: + actions: read contents: read id-token: write - actions: read with: checks: false working-directory: must-not-exist diff --git a/actions/lint/README.md b/actions/lint/README.md index 09c08fe..81b6bc6 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -42,7 +42,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@8245b03d3b26196e5d3d6ed3559f4a3e72fa24f5 # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index a4aee57..f30adf3 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/README.md b/actions/test/README.md index 92caf1a..6592ab8 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -44,7 +44,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@8245b03d3b26196e5d3d6ed3559f4a3e72fa24f5 # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 0d2e6ff..53832e0 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@57ec4a8bf0ab9ea52beea725b5e59895ed39f4f2 # unified reports (PR #683, unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/docs/development/README.md b/docs/development/README.md index c779a66..b00b2e0 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -2,9 +2,8 @@ Install Node.js from `.node-version`, npm, Go, a C compiler and golangci-lint v2, and Docker. Node.js and the development-only `yaml` dependency exercise the actual inline -Actions configuration scripts. Lint and test actions share the internal -[parse-ci-reports action](../../.github/actions/parse-ci-reports/README.md), which owns -file selection, unique artifact naming and uploads. +Actions configuration scripts. Lint and test actions use common `record-ci-reports` for fresh-file validation, +execution identity and retention. Native parsers and publication live only in common. ```sh make setup @@ -42,8 +41,7 @@ The Node tests execute workflow configuration directly to check matrix selection disable switches and invalid input. Action contract tests live beside each action as `action.test.cjs`, including [setup](../../actions/setup-go/action.test.cjs), -[lint](../../actions/lint/action.test.cjs), [test](../../actions/test/action.test.cjs) -and [report parsing](../../.github/actions/parse-ci-reports/action.test.cjs). +[lint](../../actions/lint/action.test.cjs) and [test](../../actions/test/action.test.cjs). They execute the actual Bash and JavaScript from adjacent action metadata to check quoting, failure propagation, setup preconditions and artifact selection. `make test` discovers these files and the workflow configuration tests. @@ -112,3 +110,11 @@ The shared linter uses its bundled Go compiler (`GOTOOLCHAIN=local`) with the fixture configuration. This keeps its precompiled golangci-lint compatible with the compiler export format. Dedicated action tests also lint with the project toolchain and the action's pinned golangci-lint release. + +## Reporting boundary + +One outer `ci-reports` job publishes all evidence. A separate required `CI complete` +job checks every producer and reporting with `check-jobs`. Failed native tests +fail the producer, while valid reports can still be published successfully. +Unexpected skips fail the gate. Configure explicitly allowed conditional skips +in the caller; the reporting workflow owns no skip policy. diff --git a/package.json b/package.json index 50b1493..e3998b1 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "description": "Development-only tests for GitHub Actions configuration", "scripts": { "test": "node --test tests/*.test.cjs actions/*/*.test.cjs", - "test:ci": "node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=coverage/junit.xml", - "pretest:ci": "node -e \"require('node:fs').mkdirSync('coverage', {recursive:true})\"" + "test:ci": "node $(test \"$CI_TEST_COVERAGE\" = true && printf %s --experimental-test-coverage) --test-reporter=lcov --test-reporter-destination=\"$CI_REPORTS_DIR/lcov.info\" --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=\"$CI_REPORTS_DIR/junit.xml\"" }, "devDependencies": { "yaml": "2.9.1" From f2ed9ef40233d98c37ee775334e07a790e7b2183 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:18:22 +0100 Subject: [PATCH 08/35] fix: retain contract results without empty coverage measurements --- .github/workflows/__shared-ci.yml | 1 + .github/workflows/__test-workflow-continuous-integration.yml | 2 +- docs/development/README.md | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index eaaf10b..15e0d57 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -84,6 +84,7 @@ jobs: - test-action-build - reports runs-on: ubuntu-latest + timeout-minutes: 5 permissions: {} steps: - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 315b87b..2019759 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -20,7 +20,7 @@ jobs: test-coverage: lcov.info command: test:ci arguments: '["tests/config.test.cjs"]' - coverage: "true" + coverage: "false" fixture: uses: $/.github/workflows/continuous-integration.yml permissions: diff --git a/docs/development/README.md b/docs/development/README.md index b00b2e0..97a9af1 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -118,3 +118,7 @@ job checks every producer and reporting with `check-jobs`. Failed native tests fail the producer, while valid reports can still be published successfully. Unexpected skips fail the gate. Configure explicitly allowed conditional skips in the caller; the reporting workflow owns no skip policy. + +The Node contract suites execute inline workflow scripts; they retain JUnit results +without requesting an empty JavaScript coverage measurement. The language fixture +collects application coverage on its primary runtime. From ea195d7103a4269e4fa8dc5b1c8ae8debab325a6 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:25:38 +0100 Subject: [PATCH 09/35] fix: use validated common reporting contracts --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 15e0d57..5a2bde7 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index f30adf3..ce60977 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 53832e0..3b515de 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@85351002dc2303c4a70233197edcadb20b1cb90e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 37b2f0252f62b352ca7423a31c1f8cef80eab1fb Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 18:06:27 +0100 Subject: [PATCH 10/35] ci: validate the final shared reporting contract --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 5a2bde7..d49c316 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index de26ec7..973902e 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index c874f07..6d287aa 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 26191f1..143d156 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 2019759..42923b6 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@64899fdf0e6164bf96c679ed574b5c9cd13f2a99 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/action.yml b/actions/lint/action.yml index ce60977..6014da1 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 3b515de..60c0b25 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From f36399d565bbbfadde7d00d15c30c15534fb5972 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 18:11:57 +0100 Subject: [PATCH 11/35] docs: preserve branding in generated action references --- .github/workflows/continuous-integration.md | 6 ++++++ actions/lint/README.md | 6 ++++++ actions/test/README.md | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index b46ff7b..0532428 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -2,6 +2,12 @@ # GitHub Reusable Workflow: Go Continuous Integration +
+ Go Continuous Integration +
+ +--- + diff --git a/actions/lint/README.md b/actions/lint/README.md index 81b6bc6..7c8323d 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,6 +2,12 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Lint Go +
+ Lint Go +
+ +--- + diff --git a/actions/test/README.md b/actions/test/README.md index 6592ab8..f98b6be 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,6 +2,12 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test Go +
+ Test Go +
+ +--- + From 59c4c924c0fa50a642a6d6e1fe67589718189ec0 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 09:46:20 +0100 Subject: [PATCH 12/35] fix(ci): adopt external coverage comment ownership --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index d49c316..5c0173a 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 6014da1..829fcf2 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 60c0b25..9010841 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 8e2e477caf708eee2c058814812e07d03c64c2e1 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 11:11:53 +0100 Subject: [PATCH 13/35] ci: adopt actionable reports and stable coverage project flags --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 5c0173a..568a3d6 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 829fcf2..44aa0fb 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 9010841..e188322 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 2da6b0dff28ab755a1b415f81a4093bf63f1d07a Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 11:21:35 +0100 Subject: [PATCH 14/35] ci: update validated reporting implementation --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 568a3d6..d51bf9d 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 44aa0fb..4eb9c57 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index e188322..11865e4 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 083780d5c64880744977bf0b4a5af8b6676b9be3 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:21:07 +0100 Subject: [PATCH 15/35] ci: use the corrected Common reporting actions --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index d51bf9d..547d08c 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 4eb9c57..5a742d2 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 11865e4..a7699c4 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 6360277eef5e33f526a37edccb66d8290b37949a Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:21:08 +0100 Subject: [PATCH 16/35] docs: refresh reporting action references --- actions/lint/README.md | 2 +- actions/test/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/lint/README.md b/actions/lint/README.md index 7c8323d..cb7ece0 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -48,7 +48,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@8245b03d3b26196e5d3d6ed3559f4a3e72fa24f5 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 with: # Go module directory. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index f98b6be..ac9772a 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -50,7 +50,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@8245b03d3b26196e5d3d6ed3559f4a3e72fa24f5 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 with: # Go module directory. # Default: `.` From 42f41cc8651bf9cd95114a689580a7d006728108 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:34:35 +0100 Subject: [PATCH 17/35] docs: pin generated examples to the reporting preview --- actions/lint/README.md | 2 +- actions/test/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/lint/README.md b/actions/lint/README.md index cb7ece0..7a8c521 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -48,7 +48,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 +- uses: hoverkraft-tech/ci-github-go/actions/lint@6360277eef5e33f526a37edccb66d8290b37949a with: # Go module directory. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index ac9772a..b3a833c 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -50,7 +50,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 +- uses: hoverkraft-tech/ci-github-go/actions/test@6360277eef5e33f526a37edccb66d8290b37949a with: # Go module directory. # Default: `.` From 3c517da9708ff6d61c884d98d6f3fc99f7c4cc94 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 20:47:13 +0100 Subject: [PATCH 18/35] ci: use bundled Node.js coverage conversion --- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 547d08c..f579799 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 5a742d2..9d709c3 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index a7699c4..b964364 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 34e09a186a6f8c40c0c3da55649f21deed16acd3 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 12:13:44 +0100 Subject: [PATCH 19/35] ci: validate composed report actions --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index f579799..e9b4160 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 973902e..f2a8a80 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 6d287aa..a2871d1 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 143d156..9fa6b1b 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 42923b6..672b3ff 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@570c8389e95924c64933ea1e95f555ad7739a46f # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 9d709c3..bac3bf8 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index b964364..94c1680 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 653d1d7ed61df3481712ade5a779c7bbc3ba1d09 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 13:43:16 +0100 Subject: [PATCH 20/35] refactor(ci): adopt standalone report publication actions --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- .github/workflows/continuous-integration.md | 4 ++-- .github/workflows/continuous-integration.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index e9b4160..4f5cd14 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index f2a8a80..b7b7a52 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index a2871d1..f7838a8 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 9fa6b1b..70c71e3 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 672b3ff..c98a7da 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7da271bac658d21bb41f11c262410c0f8d2b239b # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 0532428..af70a19 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -101,7 +101,7 @@ on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. Go coverage remains a native profile with its statement-weighted measurement. Line-oriented publication formats are prepared only for selected destinations. -Call common ci-reports.yml once after all jobs with job-results: toJSON(needs). +Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). No report plans or artifact IDs need forwarding. Producer calls require actions: read and contents: read. The reporting caller grants actions: read, contents: read, pull-requests: write, code-quality: write, id-token: write and security-events: write. @@ -132,7 +132,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@b529d39b7c3b358eb6f3ed52fadd5b6ae5438ece # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 permissions: actions: read contents: read diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1ea7a53..14bef2b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -71,7 +71,7 @@ # Go coverage remains a native profile with its statement-weighted measurement. # Line-oriented publication formats are prepared only for selected destinations. # -# Call common ci-reports.yml once after all jobs with job-results: toJSON(needs). +# Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). # No report plans or artifact IDs need forwarding. Producer calls require actions: # read and contents: read. The reporting caller grants actions: read, contents: read, # pull-requests: write, code-quality: write, id-token: write and security-events: write. diff --git a/actions/lint/action.yml b/actions/lint/action.yml index bac3bf8..9954f07 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 94c1680..76c55f2 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From b361a0ee4e306bfb8e0f903645b6e437468fcd01 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 14:01:23 +0100 Subject: [PATCH 21/35] refactor(ci): adopt standalone report publication actions --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 4f5cd14..c077df1 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index b7b7a52..6d1190f 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index f7838a8..6a7b88b 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 70c71e3..8029c18 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index c98a7da..76fcb4c 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@e83767d00d66b692aafa5a5d697fbf8aaba3b444 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 9954f07..581d25c 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -65,7 +65,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -100,7 +100,7 @@ runs: - id: reports name: Validate and retain native reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 76c55f2..f910d39 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -77,7 +77,7 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -109,7 +109,7 @@ runs: - name: Validate and retain native reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 4fab364ace884571012b31473f30adc9a34daaf9 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 17:15:21 +0100 Subject: [PATCH 22/35] refactor(reports)!: compose common report preparation --- .github/workflows/__shared-ci.yml | 6 +- .github/workflows/__test-action-lint.yml | 4 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 6 +- ...__test-workflow-continuous-integration.yml | 2 +- .github/workflows/continuous-integration.md | 28 +--------- .github/workflows/continuous-integration.yml | 4 +- actions/lint/README.md | 30 +--------- actions/lint/action.yml | 27 +++++---- actions/test/README.md | 42 +++----------- actions/test/action.yml | 56 +++++++++++++------ docs/development/README.md | 2 +- tests/config.test.cjs | 2 +- 13 files changed, 85 insertions(+), 126 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index c077df1..b5a5f43 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 6d1190f..2a677c0 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info @@ -51,7 +51,7 @@ jobs: - name: Assert - Native reports and validation result are retained shell: bash run: | - test -f "$REPORT_DIRECTORY/result.json" + test -f "$REPORT_DIRECTORY/report.json" test -s "$REPORT_DIRECTORY/reports/golangci-lint.sarif" env: REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 6a7b88b..d3765fd 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 8029c18..1a4b0e2 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info @@ -53,5 +53,5 @@ jobs: env: REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports run: | - test -f "$REPORT_DIRECTORY/result.json" - test -s "$REPORT_DIRECTORY/reports/junit.xml" + test -f "$REPORT_DIRECTORY/report.json" + test -s "$REPORT_DIRECTORY/native/1-junit.xml" diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 76fcb4c..f7869ad 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3f3820f46c01e8782de7166ae3fff5a67341ba44 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index af70a19..82479f4 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -2,12 +2,6 @@ # GitHub Reusable Workflow: Go Continuous Integration -
- Go Continuous Integration -
- ---- - @@ -16,9 +10,7 @@ [![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-go)](https://github.com/hoverkraft-tech/ci-github-go/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-go)](http://choosealicense.com/licenses/mit/) [![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) @@ -98,7 +90,7 @@ Build output is not published as a release. Every runtime retains validated JUnit test results. Lint and coverage run once on the highest configured version; the default command disables instrumentation on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -Go coverage remains a native profile with its statement-weighted measurement. +The Go provider converts its native profile to standard line coverage with gocover-cobertura. Line-oriented publication formats are prepared only for selected destinations. Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). @@ -132,7 +124,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@dcc9e10f1938e4496a40edc4e90eb0a6294a8bb2 # 0.0.1 + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage permissions: actions: read contents: read @@ -222,28 +214,12 @@ jobs: - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) for more details. - - -## License - -This project is licensed under the MIT License. - -SPDX-License-Identifier: MIT - -Copyright © 2026 hoverkraft-tech - -For more details, see the [license](http://choosealicense.com/licenses/mit/). - diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 14bef2b..9ea3711 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -68,7 +68,7 @@ # Every runtime retains validated JUnit test results. Lint and coverage run once # on the highest configured version; the default command disables instrumentation # on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -# Go coverage remains a native profile with its statement-weighted measurement. +# The Go provider converts its native profile to standard line coverage with gocover-cobertura. # Line-oriented publication formats are prepared only for selected destinations. # # Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). @@ -173,7 +173,7 @@ jobs: return config; } const lint = options('lint', process.env.LINT, {command: '', 'lint-results':'golangci-lint.sarif'}); - const test = options('test', process.env.TEST, {command:'', coverage:true, race:true, 'test-results':'junit.xml', 'test-coverage':'coverage.out'}); + const test = options('test', process.env.TEST, {command:'', coverage:true, race:true, 'test-results':'junit.xml', 'test-coverage':'coverage.xml'}); const build = options('build', process.env.BUILD, {command: 'go build -mod=readonly -trimpath ./...', artifact: ''}); const artifact = build?.artifact; if (artifact && (artifact === '.' || artifact.startsWith('/') || artifact.includes('\\') || artifact.split('/').includes('..') || /[\r\n*?]/.test(artifact))) { diff --git a/actions/lint/README.md b/actions/lint/README.md index 7a8c521..6a53782 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Lint Go -
- Lint Go -
- ---- - @@ -17,9 +11,7 @@ [![Marketplace](https://img.shields.io/badge/Marketplace-lint--go-blue?logo=github-actions)](https://github.com/marketplace/actions/lint-go) [![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-go)](https://github.com/hoverkraft-tech/ci-github-go/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-go)](http://choosealicense.com/licenses/mit/) [![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) @@ -34,8 +26,8 @@ Check gofmt, module tidiness and golangci-lint v2 diagnostics. Run setup-go first. Project rules belong in .golangci.yml. All default checks execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. Custom commands must write the declared native reports under CI_REPORTS_DIR. -Reports are registered before execution and validated afterward, including after -failure. Call common ci-reports once after all jobs for annotations and summaries. +Reports are validated after execution, including after +failure. Call common publish-ci-reports once after all jobs for annotations and summaries. Producer jobs require actions: read and contents: read. @@ -48,7 +40,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@6360277eef5e33f526a37edccb66d8290b37949a +- uses: hoverkraft-tech/ci-github-go/actions/lint@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -103,28 +95,12 @@ Producer jobs require actions: read and contents: read. - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) for more details. - - -## License - -This project is licensed under the MIT License. - -SPDX-License-Identifier: MIT - -Copyright © 2026 hoverkraft - -For more details, see the [license](http://choosealicense.com/licenses/mit/). - diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 581d25c..fb921de 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -6,8 +6,8 @@ description: | Run setup-go first. Project rules belong in .golangci.yml. All default checks execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. Custom commands must write the declared native reports under CI_REPORTS_DIR. - Reports are registered before execution and validated afterward, including after - failure. Call common ci-reports once after all jobs for annotations and summaries. + Reports are validated after execution, including after + failure. Call common publish-ci-reports once after all jobs for annotations and summaries. Producer jobs require actions: read and contents: read. author: hoverkraft branding: @@ -21,7 +21,9 @@ inputs: description: Pinned golangci-lint v2 release. default: v2.15.0 command: - description: Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. + description: Trusted Bash replacement for the default checks. Write declared + native reports under CI_REPORTS_DIR; test commands must honor + CI_TEST_COVERAGE. default: "" lint-results: description: Required native report paths relative to CI_REPORTS_DIR, one per line. @@ -65,10 +67,15 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go lint',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: - operation: prepare - definition: ${{ steps.definition.outputs.definition }} + script: | + const fs = require('node:fs'); + const path = require('node:path'); + core.setOutput('report-directory', fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'ci-reports-'))); + core.setOutput('definition', process.env.REPORT_DEFINITION); + env: + REPORT_DEFINITION: ${{ steps.definition.outputs.definition }} - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -98,10 +105,10 @@ runs: golangci-lint run --timeout=5m --output.sarif.path="$CI_REPORTS_DIR/golangci-lint.sarif" || status=1 exit "$status" - id: reports - name: Validate and retain native reports + name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) with: - operation: finalize - recording: ${{ steps.prepare.outputs.recording }} + definition: ${{ steps.prepare.outputs.definition }} + directory: ${{ steps.prepare.outputs.report-directory }} outcome: ${{ steps.run.outcome }} diff --git a/actions/test/README.md b/actions/test/README.md index b3a833c..3221dd4 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test Go -
- Test Go -
- ---- - @@ -17,9 +11,7 @@ [![Marketplace](https://img.shields.io/badge/Marketplace-test--go-blue?logo=github-actions)](https://github.com/marketplace/actions/test-go) [![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-go)](https://github.com/hoverkraft-tech/ci-github-go/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-go)](http://choosealicense.com/licenses/mit/) [![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-go?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) @@ -31,13 +23,13 @@ Run Go tests with detailed JUnit results on every runtime and optional native coverage. -Run setup-go first. Defaults write junit.xml and coverage.out into a fresh +Run setup-go first. Defaults write junit.xml and coverage.xml into a fresh CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -Required outputs are registered before execution and validated after success or -failure. The Go profile retains native statement counts. Select publication once -in common ci-reports after all jobs; no report outputs need forwarding. +Required outputs are validated after success or failure. The default command +converts Go coverage to Cobertura with gocover-cobertura. Select publication once +in common publish-ci-reports after all jobs; no report outputs need forwarding. Producer jobs require actions: read and contents: read. @@ -50,7 +42,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@6360277eef5e33f526a37edccb66d8290b37949a +- uses: hoverkraft-tech/ci-github-go/actions/test@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -71,9 +63,9 @@ Producer jobs require actions: read and contents: read. # Default: `junit.xml` test-results: junit.xml - # Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. - # Default: `coverage.out` - test-coverage: coverage.out + # Required coverage XML paths relative to CI_REPORTS_DIR when coverage is enabled. + # Default: `coverage.xml` + test-coverage: coverage.xml ``` @@ -89,7 +81,7 @@ Producer jobs require actions: read and contents: read. | **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | | **`coverage`** | Collect native Go coverage. The default command disables instrumentation when false. | **false** | `true` | | **`test-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` | -| **`test-coverage`** | Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. | **false** | `coverage.out` | +| **`test-coverage`** | Required coverage XML paths relative to CI_REPORTS_DIR when coverage is enabled. | **false** | `coverage.xml` | @@ -115,28 +107,12 @@ Producer jobs require actions: read and contents: read. - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-go/blob/main/CONTRIBUTING.md) for more details. - - -## License - -This project is licensed under the MIT License. - -SPDX-License-Identifier: MIT - -Copyright © 2026 hoverkraft - -For more details, see the [license](http://choosealicense.com/licenses/mit/). - diff --git a/actions/test/action.yml b/actions/test/action.yml index f910d39..9ef5b95 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -3,13 +3,13 @@ name: Test Go description: | Run Go tests with detailed JUnit results on every runtime and optional native coverage. - Run setup-go first. Defaults write junit.xml and coverage.out into a fresh + Run setup-go first. Defaults write junit.xml and coverage.xml into a fresh CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. - Required outputs are registered before execution and validated after success or - failure. The Go profile retains native statement counts. Select publication once - in common ci-reports after all jobs; no report outputs need forwarding. + Required outputs are validated after success or failure. The default command + converts Go coverage to Cobertura with gocover-cobertura. Select publication once + in common publish-ci-reports after all jobs; no report outputs need forwarding. Producer jobs require actions: read and contents: read. author: hoverkraft branding: @@ -20,20 +20,26 @@ inputs: description: Go module directory. default: . command: - description: Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. + description: Trusted Bash replacement for the default checks. Write declared + native reports under CI_REPORTS_DIR; test commands must honor + CI_TEST_COVERAGE. default: "" race: - description: Enable the race detector for the default command. Requires CGO and a C compiler. + description: + Enable the race detector for the default command. Requires CGO and + a C compiler. default: "true" coverage: - description: Collect native Go coverage. The default command disables instrumentation when false. + description: Collect native Go coverage. The default command disables + instrumentation when false. default: "true" test-results: description: Required native report paths relative to CI_REPORTS_DIR, one per line. default: junit.xml test-coverage: - description: Required native Go coverage profile paths relative to CI_REPORTS_DIR when coverage is enabled. - default: coverage.out + description: Required coverage XML paths relative to + CI_REPORTS_DIR when coverage is enabled. + default: coverage.xml outputs: report-artifact-id: description: Native report bundle, including available diagnostics after failures. @@ -77,10 +83,15 @@ runs: const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); core.setOutput('definition', {name:'Go tests',project:process.env.DIRECTORY,variant:{runtime:runtime.stdout.trim()},reports,'path-mapping':{[modulePath.stdout.trim()]:process.env.DIRECTORY}}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: - operation: prepare - definition: ${{ steps.definition.outputs.definition }} + script: | + const fs = require('node:fs'); + const path = require('node:path'); + core.setOutput('report-directory', fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'ci-reports-'))); + core.setOutput('definition', process.env.REPORT_DEFINITION); + env: + REPORT_DEFINITION: ${{ steps.definition.outputs.definition }} - id: run shell: bash working-directory: ${{ steps.directory.outputs.absolute-path }} @@ -106,11 +117,24 @@ runs: if [ "$CI_TEST_COVERAGE" = true ]; then args+=(-covermode=atomic "-coverprofile=$CI_REPORTS_DIR/coverage.out"); fi if [ "$RACE" = true ]; then args+=(-race); fi go run "gotest.tools/gotestsum@$GOTESTSUM_VERSION" --junitfile="$CI_REPORTS_DIR/junit.xml" --format=testname -- "${args[@]}" ./... - - name: Validate and retain native reports + - name: Convert Go coverage with gocover-cobertura + id: coverage-report + if: + ${{ !cancelled() && inputs.coverage == 'true' && inputs.command == '' && + steps.prepare.outcome == 'success' }} + shell: bash + working-directory: ${{ steps.directory.outputs.absolute-path }} + env: + REPORT_DIRECTORY: ${{ steps.prepare.outputs.report-directory }} + GOTOOLCHAIN: local + GOWORK: "off" + run: go run github.com/boumenot/gocover-cobertura@v1.5.0 < + "$REPORT_DIRECTORY/coverage.out" > "$REPORT_DIRECTORY/coverage.xml" + - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) with: - operation: finalize - recording: ${{ steps.prepare.outputs.recording }} + definition: ${{ steps.prepare.outputs.definition }} + directory: ${{ steps.prepare.outputs.report-directory }} outcome: ${{ steps.run.outcome }} diff --git a/docs/development/README.md b/docs/development/README.md index 97a9af1..6607580 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -2,7 +2,7 @@ Install Node.js from `.node-version`, npm, Go, a C compiler and golangci-lint v2, and Docker. Node.js and the development-only `yaml` dependency exercise the actual inline -Actions configuration scripts. Lint and test actions use common `record-ci-reports` for fresh-file validation, +Actions configuration scripts. Lint and test actions use common `prepare-ci-reports` for fresh-file validation, execution identity and retention. Native parsers and publication live only in common. ```sh diff --git a/tests/config.test.cjs b/tests/config.test.cjs index 213a7e6..888f7b2 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -120,7 +120,7 @@ test("rejects unsafe build artifact directories and empty commands", async () => test("preserves native report paths and rejects ambiguous input types", async () => { const options = { coverage: true, - "test-coverage": "coverage.out", + "test-coverage": "custom-coverage.xml", "test-results": "junit.xml", }; const actual = JSON.parse( From aed4177da04b4d2b6b28f0db54b561b2b15fca4b Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 18:31:03 +0100 Subject: [PATCH 23/35] fix(reports): align artifacts with validated common publication --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 4 ++-- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index b5a5f43..f5bf28d 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 2a677c0..c9f6483 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info @@ -52,6 +52,6 @@ jobs: shell: bash run: | test -f "$REPORT_DIRECTORY/report.json" - test -s "$REPORT_DIRECTORY/reports/golangci-lint.sarif" + test -s "$REPORT_DIRECTORY/native/1-golangci-lint.sarif" env: REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index d3765fd..ae40bf9 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 1a4b0e2..17f0d1d 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index f7869ad..9f8e7d9 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@ad95c2d3354cf5c0755a0325ba55f7615ff0d955 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/README.md b/actions/lint/README.md index 6a53782..be04c59 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -40,7 +40,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@4fab364ace884571012b31473f30adc9a34daaf9 # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index fb921de..e6f1fe5 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -107,7 +107,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/README.md b/actions/test/README.md index 3221dd4..04c2c7e 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -42,7 +42,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@4fab364ace884571012b31473f30adc9a34daaf9 # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 9ef5b95..9a04e9f 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -133,7 +133,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From f895bd98053ae246e41729fec2eb99fd002e99ea Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 18:57:38 +0100 Subject: [PATCH 24/35] fix(reports): adopt file-safe coverage and bounded publication --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index f5bf28d..3d10a59 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index c9f6483..cc14800 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index ae40bf9..6aa77a3 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 17f0d1d..b48f21a 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 9f8e7d9..7e1f893 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@fad361333873e1a2c66b90a4ded5d8b6b7c4f23d # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/README.md b/actions/lint/README.md index be04c59..a05d73b 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -40,7 +40,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@4fab364ace884571012b31473f30adc9a34daaf9 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@aed4177da04b4d2b6b28f0db54b561b2b15fca4b # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index e6f1fe5..03938c8 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -107,7 +107,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/README.md b/actions/test/README.md index 04c2c7e..33433e0 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -42,7 +42,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@4fab364ace884571012b31473f30adc9a34daaf9 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@aed4177da04b4d2b6b28f0db54b561b2b15fca4b # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 9a04e9f..7b26af8 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -133,7 +133,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From 8a5c7d1d4e0e0c0407bb2c4c77556bb803d0dcd7 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 19:27:28 +0100 Subject: [PATCH 25/35] fix(reports): update common reporting dependency --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 3d10a59..9d6e891 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) permissions: actions: read contents: read @@ -87,6 +87,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index cc14800..9ec231b 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 6aa77a3..6e38ead 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index b48f21a..1c74cbf 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 7e1f893..ac0111d 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@c1103859a3e760969aad47921da2174d19b68c92 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) with: test-results: junit.xml test-coverage: lcov.info diff --git a/actions/lint/README.md b/actions/lint/README.md index a05d73b..cfff06f 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -40,7 +40,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@aed4177da04b4d2b6b28f0db54b561b2b15fca4b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@f895bd98053ae246e41729fec2eb99fd002e99ea # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 03938c8..47db52b 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -107,7 +107,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/README.md b/actions/test/README.md index 33433e0..25697a0 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -42,7 +42,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@aed4177da04b4d2b6b28f0db54b561b2b15fca4b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@f895bd98053ae246e41729fec2eb99fd002e99ea # feat/native-github-coverage with: # Go module directory. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 7b26af8..e536457 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -133,7 +133,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From fc1787000abc84ce9a3e2737c3734c33dd82a572 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 09:26:33 +0100 Subject: [PATCH 26/35] refactor(ci): call shared completion workflow --- .github/workflows/__shared-ci.yml | 9 +++------ docs/development/README.md | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 9d6e891..1f09508 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -83,10 +83,7 @@ jobs: - test-action-audit - test-action-build - reports - runs-on: ubuntu-latest - timeout-minutes: 5 + uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@cb86863a77462f8837b38ad542b49ab36a825a85 # PR #683 (unreleased) permissions: {} - steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) - with: - job-results: ${{ toJSON(needs) }} + with: + job-results: ${{ toJSON(needs) }} diff --git a/docs/development/README.md b/docs/development/README.md index 6607580..a4e3a4d 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -114,7 +114,7 @@ toolchain and the action's pinned golangci-lint release. ## Reporting boundary One outer `ci-reports` job publishes all evidence. A separate required `CI complete` -job checks every producer and reporting with `check-jobs`. Failed native tests +job calls `check-jobs.yml` to check every producer and reporting. Failed native tests fail the producer, while valid reports can still be published successfully. Unexpected skips fail the gate. Configure explicitly allowed conditional skips in the caller; the reporting workflow owns no skip policy. From e53e65bd59c84cb29bff58c9358af3b8e5bb35f1 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 10:17:34 +0100 Subject: [PATCH 27/35] refactor(ci): clarify artifact-only language workflows --- .github/workflows/continuous-integration.md | 19 ++++++++----------- .github/workflows/continuous-integration.yml | 17 +++++++---------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 82479f4..4b7f546 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -85,21 +85,18 @@ with: inside the checkout. Each invocation uses a unique artifact name. Build output is not published as a release. -### Reports and permissions +### Report artifacts Every runtime retains validated JUnit test results. Lint and coverage run once on the highest configured version; the default command disables instrumentation on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -The Go provider converts its native profile to standard line coverage with gocover-cobertura. -Line-oriented publication formats are prepared only for selected destinations. - -Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). -No report plans or artifact IDs need forwarding. Producer calls require actions: -read and contents: read. The reporting caller grants actions: read, contents: read, -pull-requests: write, code-quality: write, id-token: write and security-events: write. -Lint and tests default to annotations; coverage uses GitHub when available and -a comment or summary otherwise. Select destinations once using lint-reporters, -test-results-reporters and test-coverage-reporters. +The test action converts its native profile to standard line coverage with gocover-cobertura. +The lint and test actions validate their outputs and upload report artifacts, +including after command failure. Missing or malformed required reports fail the action. +Producer calls require actions: read and contents: read. + +The caller publishes those artifacts once with `publish-ci-reports.yml`. +See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/44d42ca06b9f722d8ab79af4f588f30ad1e16bc5/docs/usage/ci-reports.md#consumer-workflow). ### Permissions diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9ea3711..c4ad647 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -63,21 +63,18 @@ # inside the checkout. Each invocation uses a unique artifact name. # Build output is not published as a release. # -# ### Reports and permissions +# ### Report artifacts # # Every runtime retains validated JUnit test results. Lint and coverage run once # on the highest configured version; the default command disables instrumentation # on other versions. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. -# The Go provider converts its native profile to standard line coverage with gocover-cobertura. -# Line-oriented publication formats are prepared only for selected destinations. +# The test action converts its native profile to standard line coverage with gocover-cobertura. +# The lint and test actions validate their outputs and upload report artifacts, +# including after command failure. Missing or malformed required reports fail the action. +# Producer calls require actions: read and contents: read. # -# Call common publish-ci-reports.yml once after all jobs with job-results: toJSON(needs). -# No report plans or artifact IDs need forwarding. Producer calls require actions: -# read and contents: read. The reporting caller grants actions: read, contents: read, -# pull-requests: write, code-quality: write, id-token: write and security-events: write. -# Lint and tests default to annotations; coverage uses GitHub when available and -# a comment or summary otherwise. Select destinations once using lint-reporters, -# test-results-reporters and test-coverage-reporters. +# The caller publishes those artifacts once with `publish-ci-reports.yml`. +# See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/44d42ca06b9f722d8ab79af4f588f30ad1e16bc5/docs/usage/ci-reports.md#consumer-workflow). # name: Go Continuous Integration "on": From 8eea0eff4ef23bbb9789190957dcfa37beb86917 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 15:44:13 +0100 Subject: [PATCH 28/35] feat(reports): discover Go report outputs automatically --- .github/workflows/__test-action-lint.yml | 4 +--- .github/workflows/__test-action-setup-go.yml | 4 +--- .github/workflows/__test-action-test.yml | 4 +--- ...__test-workflow-continuous-integration.yml | 4 +--- .github/workflows/continuous-integration.yml | 11 ++++----- actions/lint/action.yml | 19 +++++---------- actions/test/action.yml | 24 +++++-------------- tests/config.test.cjs | 14 ----------- 8 files changed, 20 insertions(+), 64 deletions(-) diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 9ec231b..21483e6 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,10 +18,8 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 with: - test-results: junit.xml - test-coverage: lcov.info command: test:ci arguments: '["actions/lint/action.test.cjs"]' coverage: "false" diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 6e38ead..faffcfc 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,10 +16,8 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 with: - test-results: junit.xml - test-coverage: lcov.info command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' coverage: "false" diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 1c74cbf..fae2456 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,10 +18,8 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 with: - test-results: junit.xml - test-coverage: lcov.info command: test:ci arguments: '["actions/test/action.test.cjs"]' coverage: "false" diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index ac0111d..9a03a7f 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,10 +14,8 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 with: - test-results: junit.xml - test-coverage: lcov.info command: test:ci arguments: '["tests/config.test.cjs"]' coverage: "false" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c4ad647..bd3affe 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -97,11 +97,11 @@ name: Go Continuous Integration type: string default: "" lint: - description: true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. + description: true for defaults, a Bash command or JSON options (command). false, null or empty disables lint. type: string default: "true" test: - description: "true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests." + description: "true for defaults, a Bash command or JSON options (command, race, coverage). Supported report files are discovered automatically under CI_REPORTS_DIR. false, null or empty disables tests." type: string default: "true" audit: @@ -169,8 +169,8 @@ jobs: } return config; } - const lint = options('lint', process.env.LINT, {command: '', 'lint-results':'golangci-lint.sarif'}); - const test = options('test', process.env.TEST, {command:'', coverage:true, race:true, 'test-results':'junit.xml', 'test-coverage':'coverage.xml'}); + const lint = options('lint', process.env.LINT, {command: ''}); + const test = options('test', process.env.TEST, {command:'', coverage:true, race:true}); const build = options('build', process.env.BUILD, {command: 'go build -mod=readonly -trimpath ./...', artifact: ''}); const artifact = build?.artifact; if (artifact && (artifact === '.' || artifact.startsWith('/') || artifact.includes('\\') || artifact.split('/').includes('..') || /[\r\n*?]/.test(artifact))) { @@ -223,7 +223,6 @@ jobs: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} golangci-lint-version: ${{ inputs.golangci-lint-version }} - lint-results: ${{ fromJSON(needs.configuration.outputs.lint).lint-results }} test: if: inputs.checks && needs.configuration.outputs.test != 'null' needs: configuration @@ -247,8 +246,6 @@ jobs: command: ${{ fromJSON(needs.configuration.outputs.test).command }} coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} race: ${{ fromJSON(needs.configuration.outputs.test).race }} - test-results: ${{ fromJSON(needs.configuration.outputs.test).test-results }} - test-coverage: ${{ fromJSON(needs.configuration.outputs.test).test-coverage }} strategy: fail-fast: false matrix: diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 47db52b..26883d5 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -5,7 +5,8 @@ description: | Run setup-go first. Project rules belong in .golangci.yml. All default checks execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. - Custom commands must write the declared native reports under CI_REPORTS_DIR. + Supported report files are discovered automatically. + Custom commands must write the supported native reports under CI_REPORTS_DIR. Reports are validated after execution, including after failure. Call common publish-ci-reports once after all jobs for annotations and summaries. Producer jobs require actions: read and contents: read. @@ -21,13 +22,11 @@ inputs: description: Pinned golangci-lint v2 release. default: v2.15.0 command: - description: Trusted Bash replacement for the default checks. Write declared + description: + Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. default: "" - lint-results: - description: Required native report paths relative to CI_REPORTS_DIR, one per line. - default: golangci-lint.sarif outputs: report-artifact-id: description: Native lint report bundle. @@ -53,15 +52,9 @@ runs: WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} GOTOOLCHAIN: local GOWORK: off - RESULTS: ${{ inputs.lint-results }} with: script: | - const paths = value => { - const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean); - if (!result.length) throw new Error('Required report paths must not be empty.'); - return result; - }; - const reports = paths(process.env.RESULTS).map(pattern => ({kind: 'lint', pattern})); + const reports = [{kind: 'lint'}]; const options = {cwd:process.env.WORKING_DIRECTORY,silent:true}; const runtime = await exec.getExecOutput('go', ['env','GOVERSION'], options); const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); @@ -107,7 +100,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d22d9532441a353f54431721affbf3ec7874034b # PR #683 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/action.yml b/actions/test/action.yml index e536457..f35c5b1 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -5,6 +5,7 @@ description: | Run setup-go first. Defaults write junit.xml and coverage.xml into a fresh CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. + Supported report files are discovered automatically; no filenames need declaring. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. Required outputs are validated after success or failure. The default command @@ -20,7 +21,8 @@ inputs: description: Go module directory. default: . command: - description: Trusted Bash replacement for the default checks. Write declared + description: + Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. default: "" @@ -33,13 +35,6 @@ inputs: description: Collect native Go coverage. The default command disables instrumentation when false. default: "true" - test-results: - description: Required native report paths relative to CI_REPORTS_DIR, one per line. - default: junit.xml - test-coverage: - description: Required coverage XML paths relative to - CI_REPORTS_DIR when coverage is enabled. - default: coverage.xml outputs: report-artifact-id: description: Native report bundle, including available diagnostics after failures. @@ -66,18 +61,11 @@ runs: WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} GOTOOLCHAIN: local GOWORK: off - RESULTS: ${{ inputs.test-results }} COVERAGE: ${{ inputs.coverage }} - COVERAGE_PATHS: ${{ inputs.test-coverage }} with: script: | - const paths = value => { - const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean); - if (!result.length) throw new Error('Required report paths must not be empty.'); - return result; - }; - const reports = paths(process.env.RESULTS).map(pattern => ({kind: 'test', pattern})); - if (process.env.COVERAGE === 'true') reports.push(...paths(process.env.COVERAGE_PATHS).map(pattern => ({kind:'coverage',pattern,language:'Go'}))); + const reports = [{kind: 'test'}]; + if (process.env.COVERAGE === 'true') reports.push({kind: 'coverage', language: 'Go'}); const options = {cwd:process.env.WORKING_DIRECTORY,silent:true}; const runtime = await exec.getExecOutput('go', ['env','GOVERSION'], options); const modulePath = await exec.getExecOutput('go', ['list','-m','-f','{{.Path}}'], options); @@ -133,7 +121,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d22d9532441a353f54431721affbf3ec7874034b # PR #683 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/tests/config.test.cjs b/tests/config.test.cjs index 888f7b2..49c262a 100644 --- a/tests/config.test.cjs +++ b/tests/config.test.cjs @@ -116,17 +116,3 @@ test("rejects unsafe build artifact directories and empty commands", async () => false, ); }); - -test("preserves native report paths and rejects ambiguous input types", async () => { - const options = { - coverage: true, - "test-coverage": "custom-coverage.xml", - "test-results": "junit.xml", - }; - const actual = JSON.parse( - (await parse({ TEST: JSON.stringify(options) })).test, - ); - for (const [key, value] of Object.entries(options)) - assert.deepEqual(actual[key], value); - await assert.rejects(() => parse({ TEST: '{"test-coverage":{}}' })); -}); From a2b37c1052f37da25fd2a39711f2d68550ad8fd2 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 15:48:08 +0100 Subject: [PATCH 29/35] docs(reports): regenerate automatic discovery references --- .github/workflows/continuous-integration.md | 30 ++++++++++----------- actions/lint/README.md | 22 +++++++-------- actions/test/README.md | 27 +++++++------------ 3 files changed, 33 insertions(+), 46 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 4b7f546..d866e23 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -121,7 +121,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@b361a0ee4e306bfb8e0f903645b6e437468fcd01 # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-go/.github/workflows/continuous-integration.yml@8eea0eff4ef23bbb9789190957dcfa37beb86917 # feat/native-github-coverage permissions: actions: read contents: read @@ -141,11 +141,11 @@ jobs: # JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. go-versions: "" - # true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. + # true for defaults, a Bash command or JSON options (command). false, null or empty disables lint. # Default: `true` lint: "true" - # true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests. + # true for defaults, a Bash command or JSON options (command, race, coverage). Supported report files are discovered automatically under CI_REPORTS_DIR. false, null or empty disables tests. # Default: `true` test: "true" @@ -174,18 +174,18 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | ------------------- | -| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | -| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | -| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | -| **`go-versions`** | JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. | **false** | **string** | - | -| **`lint`** | true for defaults, a Bash command or JSON options (command, lint-results). false, null or empty disables lint. | **false** | **string** | `true` | -| **`test`** | true for defaults, a Bash command or JSON options (command, race, coverage, test-results, test-coverage). Paths are relative to CI_REPORTS_DIR. false, null or empty disables tests. | **false** | **string** | `true` | -| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | -| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | -| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- | +| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` | +| **`checks`** | Enable all checks, including build. | **false** | **boolean** | `true` | +| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` | +| **`go-versions`** | JSON array of Go versions. Every version retains test results; the highest configured version runs lint, audit, build and coverage. Empty uses project detection once. | **false** | **string** | - | +| **`lint`** | true for defaults, a Bash command or JSON options (command). false, null or empty disables lint. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Bash command or JSON options (command, race, coverage). Supported report files are discovered automatically under CI_REPORTS_DIR. false, null or empty disables tests. | **false** | **string** | `true` | +| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` | +| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` | +| **`build`** | true for go build, a trusted Bash command, or a JSON object with command and artifact (one project-relative directory). false, null or empty disables build. | **false** | **string** | `true` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release used by the lint action. | **false** | **string** | `v2.15.0` | diff --git a/actions/lint/README.md b/actions/lint/README.md index cfff06f..9b577e6 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -25,7 +25,8 @@ Check gofmt, module tidiness and golangci-lint v2 diagnostics. Run setup-go first. Project rules belong in .golangci.yml. All default checks execute even after a failure; SARIF is written into a fresh CI_REPORTS_DIR. -Custom commands must write the declared native reports under CI_REPORTS_DIR. +Supported report files are discovered automatically. +Custom commands must write the supported native reports under CI_REPORTS_DIR. Reports are validated after execution, including after failure. Call common publish-ci-reports once after all jobs for annotations and summaries. Producer jobs require actions: read and contents: read. @@ -40,7 +41,7 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/lint@f895bd98053ae246e41729fec2eb99fd002e99ea # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/lint@8eea0eff4ef23bbb9789190957dcfa37beb86917 # feat/native-github-coverage with: # Go module directory. # Default: `.` @@ -50,12 +51,8 @@ Producer jobs require actions: read and contents: read. # Default: `v2.15.0` golangci-lint-version: v2.15.0 - # Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. + # Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. command: "" - - # Required native report paths relative to CI_REPORTS_DIR, one per line. - # Default: `golangci-lint.sarif` - lint-results: golangci-lint.sarif ``` @@ -64,12 +61,11 @@ Producer jobs require actions: read and contents: read. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | -| **`command`** | Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | -| **`lint-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `golangci-lint.sarif` | +| **Input** | **Description** | **Required** | **Default** | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`golangci-lint-version`** | Pinned golangci-lint v2 release. | **false** | `v2.15.0` | +| **`command`** | Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | diff --git a/actions/test/README.md b/actions/test/README.md index 25697a0..893aa27 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -25,6 +25,7 @@ Run Go tests with detailed JUnit results on every runtime and optional native co Run setup-go first. Defaults write junit.xml and coverage.xml into a fresh CI_REPORTS_DIR. Coverage instrumentation is disabled when coverage is false. +Supported report files are discovered automatically; no filenames need declaring. Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE. Required outputs are validated after success or failure. The default command @@ -42,13 +43,13 @@ Producer jobs require actions: read and contents: read. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-go/actions/test@f895bd98053ae246e41729fec2eb99fd002e99ea # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-go/actions/test@8eea0eff4ef23bbb9789190957dcfa37beb86917 # feat/native-github-coverage with: # Go module directory. # Default: `.` working-directory: . - # Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. + # Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. command: "" # Enable the race detector for the default command. Requires CGO and a C compiler. @@ -58,14 +59,6 @@ Producer jobs require actions: read and contents: read. # Collect native Go coverage. The default command disables instrumentation when false. # Default: `true` coverage: "true" - - # Required native report paths relative to CI_REPORTS_DIR, one per line. - # Default: `junit.xml` - test-results: junit.xml - - # Required coverage XML paths relative to CI_REPORTS_DIR when coverage is enabled. - # Default: `coverage.xml` - test-coverage: coverage.xml ``` @@ -74,14 +67,12 @@ Producer jobs require actions: read and contents: read. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------- | -| **`working-directory`** | Go module directory. | **false** | `.` | -| **`command`** | Trusted Bash replacement for the default checks. Write declared native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | -| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | -| **`coverage`** | Collect native Go coverage. The default command disables instrumentation when false. | **false** | `true` | -| **`test-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` | -| **`test-coverage`** | Required coverage XML paths relative to CI_REPORTS_DIR when coverage is enabled. | **false** | `coverage.xml` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | +| **`working-directory`** | Go module directory. | **false** | `.` | +| **`command`** | Trusted Bash replacement for the default checks. Write supported native reports under CI_REPORTS_DIR; test commands must honor CI_TEST_COVERAGE. | **false** | - | +| **`race`** | Enable the race detector for the default command. Requires CGO and a C compiler. | **false** | `true` | +| **`coverage`** | Collect native Go coverage. The default command disables instrumentation when false. | **false** | `true` | From 67bdab4a232e14f8a45c5a0fc4f96048235b6290 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Wed, 2 Dec 2026 17:33:49 +0100 Subject: [PATCH 30/35] fix(reports): refresh Common and Node.js candidates --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/action.yml | 2 +- actions/test/action.yml | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 1f09508..89c912a 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) permissions: actions: read contents: read @@ -83,7 +83,7 @@ jobs: - test-action-audit - test-action-build - reports - uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@cb86863a77462f8837b38ad542b49ab36a825a85 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) permissions: {} with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 21483e6..f6bca55 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/lint/action.test.cjs"]' diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index faffcfc..3b1d930 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index fae2456..9972162 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/test/action.test.cjs"]' diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 9a03a7f..97db93d 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@7357a32ac2222654f1de2e28432f96d8e0a7670a # PR #624 + uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) with: command: test:ci arguments: '["tests/config.test.cjs"]' diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 26883d5..6efaf0a 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -100,7 +100,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d22d9532441a353f54431721affbf3ec7874034b # PR #683 + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/action.yml b/actions/test/action.yml index f35c5b1..1adbf36 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -121,7 +121,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d22d9532441a353f54431721affbf3ec7874034b # PR #683 + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From 4f63506f8e05ade7be4323af71d09562b1e46cba Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Wed, 2 Dec 2026 23:34:27 +0100 Subject: [PATCH 31/35] fix(reports): accept native Cobertura output through Common --- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- actions/lint/action.yml | 2 +- actions/test/action.yml | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 89c912a..85af50b 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) permissions: actions: read contents: read @@ -83,7 +83,7 @@ jobs: - test-action-audit - test-action-build - reports - uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) permissions: {} with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index f6bca55..4063464 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) with: command: test:ci arguments: '["actions/lint/action.test.cjs"]' diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 3b1d930..3ef8578 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) with: command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 9972162..256c9c1 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) with: command: test:ci arguments: '["actions/test/action.test.cjs"]' diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 97db93d..f77247c 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@2d41d1305877ae123c0287d950731e1a89da3905 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) with: command: test:ci arguments: '["tests/config.test.cjs"]' diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 6efaf0a..ab73c5c 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -100,7 +100,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 1adbf36..8d4c74b 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -121,7 +121,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@438cd28e5a79d5f7c49a54675f34df175b96f5c2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From 9f76bbcff9b4abd7cf1c50bcae980017107d246e Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 3 Dec 2026 14:13:45 +0100 Subject: [PATCH 32/35] ci: adopt separate test and lint report comments --- .github/workflows/__shared-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 85af50b..36dfb17 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) permissions: actions: read contents: read From aa48d9b0f472736d09f12584343ef3eb5e5634b1 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 3 Dec 2026 14:57:13 +0100 Subject: [PATCH 33/35] ci: display lint before tests in reports --- .github/workflows/__shared-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 36dfb17..cb7428c 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@0ad84c70926a266244e95a652034fb098a4d5399 # PR #683 (unreleased) permissions: actions: read contents: read From 388094568fd032e8745c061821d3f94ff9f791ad Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Fri, 4 Dec 2026 14:37:41 +0100 Subject: [PATCH 34/35] ci: refresh reporting providers after Common 5.0.0 --- .github/workflows/__semantic-pull-request.yml | 2 +- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-setup-go.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- .../workflows/__test-workflow-continuous-integration.yml | 2 +- .github/workflows/continuous-integration.md | 2 +- .github/workflows/continuous-integration.yml | 4 ++-- actions/audit/action.yml | 2 +- actions/build/action.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/setup-go/action.yml | 2 +- actions/test/action.yml | 4 ++-- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/__semantic-pull-request.yml b/.github/workflows/__semantic-pull-request.yml index 36b014f..2122f61 100644 --- a/.github/workflows/__semantic-pull-request.yml +++ b/.github/workflows/__semantic-pull-request.yml @@ -14,4 +14,4 @@ jobs: main: permissions: contents: read - uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index cb7428c..83f898e 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ name: Internal - Common Continuous Integration tasks permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: actions: read contents: read @@ -60,7 +60,7 @@ jobs: - test-action-test - test-action-audit - test-action-build - uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@0ad84c70926a266244e95a652034fb098a4d5399 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: actions: read contents: read @@ -83,7 +83,7 @@ jobs: - test-action-audit - test-action-build - reports - uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: {} with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 4063464..b299108 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/lint/action.test.cjs"]' diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 3ef8578..9b8cb35 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,7 +16,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/setup-go/action.test.cjs"]' diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 256c9c1..19f3d98 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,7 +18,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) with: command: test:ci arguments: '["actions/test/action.test.cjs"]' diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index f77247c..01bbaa9 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,7 +14,7 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@36be3d131d95b6a0987a8819b7846f52369b8aac # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) with: command: test:ci arguments: '["tests/config.test.cjs"]' diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index d866e23..5ba44f8 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -96,7 +96,7 @@ including after command failure. Missing or malformed required reports fail the Producer calls require actions: read and contents: read. The caller publishes those artifacts once with `publish-ci-reports.yml`. -See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/44d42ca06b9f722d8ab79af4f588f30ad1e16bc5/docs/usage/ci-reports.md#consumer-workflow). +See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/5.0.0/.github/workflows/publish-ci-reports.md#consumer-workflow). ### Permissions diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bd3affe..da4c272 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -74,7 +74,7 @@ # Producer calls require actions: read and contents: read. # # The caller publishes those artifacts once with `publish-ci-reports.yml`. -# See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/44d42ca06b9f722d8ab79af4f588f30ad1e16bc5/docs/usage/ci-reports.md#consumer-workflow). +# See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/5.0.0/.github/workflows/publish-ci-reports.md#consumer-workflow). # name: Go Continuous Integration "on": @@ -279,7 +279,7 @@ jobs: command: ${{ fromJSON(needs.configuration.outputs.build).command }} - id: artifact if: fromJSON(needs.configuration.outputs.build).artifact != '' - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }}/${{ fromJSON(needs.configuration.outputs.build).artifact }} - id: artifact-name diff --git a/actions/audit/action.yml b/actions/audit/action.yml index 399783a..c406a24 100644 --- a/actions/audit/action.yml +++ b/actions/audit/action.yml @@ -27,7 +27,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: audit diff --git a/actions/build/action.yml b/actions/build/action.yml index 0c38100..7aaa784 100644 --- a/actions/build/action.yml +++ b/actions/build/action.yml @@ -32,7 +32,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: run diff --git a/actions/lint/action.yml b/actions/lint/action.yml index ab73c5c..1f1ecad 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -35,7 +35,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: golangci @@ -100,7 +100,7 @@ runs: - id: reports name: Prepare and retain reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/setup-go/action.yml b/actions/setup-go/action.yml index e1e2f61..b2ab950 100644 --- a/actions/setup-go/action.yml +++ b/actions/setup-go/action.yml @@ -60,7 +60,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: validate diff --git a/actions/test/action.yml b/actions/test/action.yml index 8d4c74b..09483fc 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -43,7 +43,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: validate @@ -121,7 +121,7 @@ runs: - name: Prepare and retain reports id: reports if: ${{ !cancelled() && steps.prepare.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d2ffd56d454d76f14fef75ec9a3feeb0fb94843e # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} From 9b248dde45db638395022c82685ce497803b49b2 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 5 Dec 2026 09:07:25 +0100 Subject: [PATCH 35/35] refactor(devx): simplify action development commands --- .github/workflows/__test-action-lint.yml | 4 +-- .github/workflows/__test-action-setup-go.yml | 4 +-- .github/workflows/__test-action-test.yml | 4 +-- ...__test-workflow-continuous-integration.yml | 4 +-- Makefile | 11 ++++++-- actions/lint/action.test.cjs | 25 +++---------------- actions/test/action.test.cjs | 15 ++--------- docs/development/README.md | 4 ++- package.json | 3 +-- tests/action-test-helpers.cjs | 24 +++++++++++++++++- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index b299108..bf6d064 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -18,9 +18,9 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@133df96fa31a002107174959beafa09808597051 # PR #624 (unreleased) with: - command: test:ci + engine: node:test arguments: '["actions/lint/action.test.cjs"]' coverage: "false" - name: Arrange - Install the project runtime and dependencies diff --git a/.github/workflows/__test-action-setup-go.yml b/.github/workflows/__test-action-setup-go.yml index 9b8cb35..c8cce90 100644 --- a/.github/workflows/__test-action-setup-go.yml +++ b/.github/workflows/__test-action-setup-go.yml @@ -16,9 +16,9 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@133df96fa31a002107174959beafa09808597051 # PR #624 (unreleased) with: - command: test:ci + engine: node:test arguments: '["actions/setup-go/action.test.cjs"]' coverage: "false" - name: Act - Detect the runtime and install dependencies diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 19f3d98..d3cb0b1 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -18,9 +18,9 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.sha }} name: Arrange - Check out the repository - name: Assert - Action contract tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@133df96fa31a002107174959beafa09808597051 # PR #624 (unreleased) with: - command: test:ci + engine: node:test arguments: '["actions/test/action.test.cjs"]' coverage: "false" - uses: $/actions/setup-go diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 01bbaa9..8c3d669 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -14,9 +14,9 @@ jobs: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Assert - Workflow configuration tests pass - uses: hoverkraft-tech/ci-github-nodejs/actions/test@a52b36c38477c7e8419c6e8ac582bc51df906228 # PR #624 (unreleased) + uses: hoverkraft-tech/ci-github-nodejs/actions/test@133df96fa31a002107174959beafa09808597051 # PR #624 (unreleased) with: - command: test:ci + engine: node:test arguments: '["tests/config.test.cjs"]' coverage: "false" fixture: diff --git a/Makefile b/Makefile index 92e4492..756f6dd 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +GIT_COMMON_DIR := $(shell git rev-parse --path-format=absolute --git-common-dir) + .PHONY: help setup test test-fixture lint-fixture lint lint-fix docs ci LINTER_IMAGE := ci-github-go-linter:local @@ -27,9 +29,14 @@ lint-fix: ## Apply supported formatting fixes docs: ## Generate action and workflow references with CI Dokumentor docker run --rm --user $(shell id -u):$(shell id -g) -v "$(CURDIR):/workspace" -w /workspace -e GITHUB_TOKEN ghcr.io/hoverkraft-tech/ci-dokumentor/cli:0.6.0 generate --repository github --cicd github-actions --source 'actions/**/action.yml' '.github/actions/**/action.yml' '.github/workflows/[!_]*.yml' -ci: setup test lint-fixture test-fixture lint ## Run checks without rewriting source +ci: ## Run checks without rewriting source + $(MAKE) setup + $(MAKE) test + $(MAKE) lint-fixture + $(MAKE) test-fixture + $(MAKE) lint define run_linter docker build --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --tag $(LINTER_IMAGE) . - docker run --rm -v "$(CURDIR):$(CURDIR)" -e DEFAULT_WORKSPACE="$(CURDIR)" -e IGNORE_GITIGNORED_FILES=true $(1) $(LINTER_IMAGE) + docker run --rm -v "$(GIT_COMMON_DIR):$(GIT_COMMON_DIR):ro" -v "$(CURDIR):$(CURDIR)" -e DEFAULT_WORKSPACE="$(CURDIR)" -e DEFAULT_BRANCH="$$(git rev-parse --abbrev-ref HEAD)" -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=false -e IGNORE_GITIGNORED_FILES=true $(1) $(LINTER_IMAGE) endef diff --git a/actions/lint/action.test.cjs b/actions/lint/action.test.cjs index 2e6226f..c97af1f 100644 --- a/actions/lint/action.test.cjs +++ b/actions/lint/action.test.cjs @@ -1,26 +1,7 @@ -const assert = require("node:assert/strict"); -const fs = require("node:fs"); const path = require("node:path"); const test = require("node:test"); -const { - createWorkspace, - runActionStep, -} = require("../../tests/action-test-helpers.cjs"); +const { assertCustomCommand } = require("../../tests/action-test-helpers.cjs"); -const actionFile = path.join(__dirname, "action.yml"); - -test("custom commands retain quoting and fail without continuing to default tools", (t) => { - const directory = createWorkspace(t); - const output = path.join(directory, "command output.txt"); - const result = runActionStep(actionFile, "run", directory, { - COMMAND: 'printf "%s" "$VALUE" > "$OUTPUT"\nexit 17', - OUTPUT: output, - VALUE: 'quotes " and $(not-executed)', - }); - assert.equal(result.status, 17, result.stderr); - assert.notEqual( - runActionStep(actionFile, "run", directory, { COMMAND: " " }).status, - 0, - ); - assert.equal(fs.readFileSync(output, "utf8"), 'quotes " and $(not-executed)'); +test("custom lint commands preserve quoting and propagate failure", (t) => { + assertCustomCommand(path.join(__dirname, "action.yml"), t); }); diff --git a/actions/test/action.test.cjs b/actions/test/action.test.cjs index 8274eaf..6d0b108 100644 --- a/actions/test/action.test.cjs +++ b/actions/test/action.test.cjs @@ -3,6 +3,7 @@ const fs = require("node:fs"); const path = require("node:path"); const test = require("node:test"); const { + assertCustomCommand, createWorkspace, runActionStep, } = require("../../tests/action-test-helpers.cjs"); @@ -10,19 +11,7 @@ const { const actionFile = path.join(__dirname, "action.yml"); test("custom commands retain quoting and fail without continuing to default tools", (t) => { - const directory = createWorkspace(t); - const output = path.join(directory, "command output.txt"); - const result = runActionStep(actionFile, "run", directory, { - COMMAND: 'printf "%s" "$VALUE" > "$OUTPUT"\nexit 17', - OUTPUT: output, - VALUE: 'quotes " and $(not-executed)', - }); - assert.equal(result.status, 17, result.stderr); - assert.notEqual( - runActionStep(actionFile, "run", directory, { COMMAND: " " }).status, - 0, - ); - assert.equal(fs.readFileSync(output, "utf8"), 'quotes " and $(not-executed)'); + assertCustomCommand(actionFile, t); }); test("test configuration rejects non-boolean coverage configuration", (t) => { diff --git a/docs/development/README.md b/docs/development/README.md index a4e3a4d..e9ad0ed 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -54,7 +54,9 @@ Node tests and calls the public workflow with real fixture versions and checks disabled behavior. `__shared-ci.yml` calls all these test workflows. The [`ci-github-nodejs` test action](https://github.com/hoverkraft-tech/ci-github-nodejs/tree/main/actions/test) handles Node setup and dependency caching, installs locked dependencies with -lifecycle scripts disabled, and runs `test:ci` with the suite path from `arguments`. +lifecycle scripts disabled, and uses the `node:test` preset with the suite path +from `arguments`. The preset owns native reporters; packages keep only their +ordinary test command. These repositories do not generate action distributions. These GitHub runner/artifact boundaries cannot be covered by local unit tests. The fixture is deliberately small; it validates action wiring rather than the language's arithmetic implementation. diff --git a/package.json b/package.json index e3998b1..6978909 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,7 @@ "private": true, "description": "Development-only tests for GitHub Actions configuration", "scripts": { - "test": "node --test tests/*.test.cjs actions/*/*.test.cjs", - "test:ci": "node $(test \"$CI_TEST_COVERAGE\" = true && printf %s --experimental-test-coverage) --test-reporter=lcov --test-reporter-destination=\"$CI_REPORTS_DIR/lcov.info\" --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=\"$CI_REPORTS_DIR/junit.xml\"" + "test": "node --test tests/*.test.cjs actions/*/*.test.cjs" }, "devDependencies": { "yaml": "2.9.1" diff --git a/tests/action-test-helpers.cjs b/tests/action-test-helpers.cjs index ae8c8ca..462d13b 100644 --- a/tests/action-test-helpers.cjs +++ b/tests/action-test-helpers.cjs @@ -1,3 +1,4 @@ +const assert = require("node:assert/strict"); const fs = require("node:fs"); const os = require("node:os"); const path = require("node:path"); @@ -37,4 +38,25 @@ function runActionStep(actionFile, id, directory, env) { ); } -module.exports = { createWorkspace, loadActionStep, runActionStep }; +function assertCustomCommand(actionFile, t) { + const directory = createWorkspace(t); + const output = path.join(directory, "command output.txt"); + const result = runActionStep(actionFile, "run", directory, { + COMMAND: 'printf "%s" "$VALUE" > "$OUTPUT"\nexit 17', + OUTPUT: output, + VALUE: 'quotes " and $(not-executed)', + }); + assert.equal(result.status, 17, result.stderr); + assert.notEqual( + runActionStep(actionFile, "run", directory, { COMMAND: " " }).status, + 0, + ); + assert.equal(fs.readFileSync(output, "utf8"), 'quotes " and $(not-executed)'); +} + +module.exports = { + assertCustomCommand, + createWorkspace, + loadActionStep, + runActionStep, +};