From 5e42c4f349cd76641b0408794536d4fc50672af7 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 15:52:46 +0100 Subject: [PATCH 01/33] feat(coverage): support native GitHub Code Quality reports --- .github/workflows/__shared-ci.yml | 1 + ...__test-workflow-continuous-integration.yml | 24 +++++++-- .github/workflows/continuous-integration.yml | 34 +++++++++---- actions/test/action.yml | 49 ++++++++++++++++--- 4 files changed, 89 insertions(+), 19 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index af1e734..cafac0e 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-get-php-versions: uses: $/.github/workflows/__test-action-get-php-versions.yml diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 61e8023..bde9895 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -84,14 +84,14 @@ jobs: const defaults = await parse(); assert.deepEqual(defaults.lint, {command: 'lint:ci'}); assert.equal((await parse({LINT: '{"command":"lint:custom"}'})).lint.command, 'lint:custom'); - assert.deepEqual(defaults.test, {command: 'test:ci', coverage: 'github', cache: ''}); + assert.deepEqual(defaults.test, {command: 'test:ci', coverage: 'github', cache: '', 'coverage-reports': [], 'report-group': ''}); for (const value of ['', 'false', 'null']) { const config = await parse({LINT: value, TEST: value}); assert.equal(config.lint, null); assert.equal(config.test, null); } const configured = await parse({TEST: '{"command":"test:custom","coverage":"","cache":".cache"}', VERSIONS: '["8.2", "8.5"]'}); - assert.deepEqual(configured.test, {command: 'test:custom', coverage: '', cache: '.cache'}); + assert.deepEqual(configured.test, {command: 'test:custom', coverage: '', cache: '.cache', 'coverage-reports': [], 'report-group': ''}); assert.equal(configured['primary-version'], '8.5'); assert.equal((await parse({TEST: 'test:custom'})).test.command, 'test:custom'); for (const name of ['LINT', 'TEST']) { @@ -105,6 +105,12 @@ jobs: for (const versions of ['[]', '["8.2","8.2"]', '[8.2]', '["latest"]']) { await assert.rejects(() => parse({VERSIONS: versions})); } + const native = {coverage: 'github-code-quality', 'report-group': 'backend', 'coverage-reports': [{file: 'custom.xml', language: 'PHP', label: 'backend'}]}; + const nativeConfig = await parse({TEST: JSON.stringify(native)}); + for (const [key, value] of Object.entries(native)) assert.deepEqual(nativeConfig.test[key], value); + for (const invalid of [{'coverage-reports': {}}, {'report-group': 'bad/group'}]) { + await assert.rejects(() => parse({TEST: JSON.stringify(invalid)})); + } core.info('Lint/test configuration checks passed.'); act: @@ -115,7 +121,7 @@ jobs: id-token: write with: working-directory: tests/php-project - test: '{"cache":".phpunit.cache"}' + test: '{"cache":".phpunit.cache","coverage":"github-code-quality","report-group":"act"}' runs-on: '["ubuntu-24.04"]' dependency-review: false checks-disabled: @@ -130,3 +136,15 @@ jobs: lint: must-not-run test: must-not-run package: "true" + + collect-native-coverage: + name: Verify coverage from the primary runtime + needs: act + 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":"act","label":"tests/php-project"}]' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0f95328..61be04a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -198,6 +198,18 @@ # # Package checks run on the primary PHP version. The source test matrix remains # responsible for compatibility across every supported PHP version. Release callers should depend on successful validation with `needs`. +# +# ## 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: Continuous integration on: workflow_call: @@ -243,7 +255,7 @@ on: Run the Composer `test:ci` script unchanged, or provide another script name. Pass "false", "null" or an empty string to disable tests. A JSON object groups test options: `command` (default `test:ci`), - `coverage` (`github`, `codecov` or empty), and `cache` (one directory relative to working-directory). + `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). Configure report/coverage generation in the Composer script itself. Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. Example: `{"coverage":"codecov","cache":".cache"}`. @@ -334,14 +346,15 @@ jobs: if (unknown.length) throw new Error('Unknown ' + name + ' options: ' + unknown.join(', ') + '.'); config = {...defaults, ...config}; for (const [key, option] of Object.entries(config)) { - if (typeof option !== 'string') throw new Error(name + '.' + key + ' must be a string.'); + if (Array.isArray(defaults[key]) ? !Array.isArray(option) : typeof option !== 'string') throw new Error(name + '.' + key + ' must be a string.'); } if (!config.command.trim() || config.command.startsWith('-') || /\s/.test(config.command)) throw new Error(name + '.command must name a Composer script.'); return config; } const lint = options('lint', process.env.LINT, {command: 'lint:ci'}); - const test = options('test', process.env.TEST, {command: 'test:ci', coverage: 'github', cache: ''}); - 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: 'test:ci', coverage: 'github', cache: '', '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 cache = test?.cache; if (cache && (cache === '.' || cache.startsWith('/') || cache.includes('\\') || cache.split('/').includes('..') || /[\r\n*?]/.test(cache))) { throw new Error('test.cache must be one directory inside working-directory.'); @@ -356,10 +369,10 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec + - uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1 lint: if: inputs.checks && needs.configuration.outputs.lint != 'null' needs: configuration @@ -367,7 +380,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/actions/setup-php @@ -394,9 +407,10 @@ jobs: matrix: php-version: ${{ fromJSON(needs.configuration.outputs.versions) }} steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ fromJSON(needs.configuration.outputs.test).coverage == 'github-code-quality' && github.event.pull_request.head.sha || github.sha }} - uses: $/actions/setup-php with: working-directory: ${{ inputs.working-directory }} @@ -415,6 +429,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.php-version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage || '' }} package: if: inputs.checks && needs.configuration.outputs.package-enabled == 'true' @@ -423,7 +439,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/actions/setup-php diff --git a/actions/test/action.yml b/actions/test/action.yml index 28d2117..cc81d2f 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -6,6 +6,15 @@ description: | including after command failures. Only parsed report files are uploaded. Keep `comment: false` and call the common `ci-reports` workflow after producer jobs for consolidated comments with collapsed details. + + 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 @@ -28,15 +37,28 @@ inputs: Omit coverage arguments when collection is not needed. The coverage input controls publication only. See the [CI guide](../../.github/workflows/continuous-integration.md). default: test:ci + coverage-reports: + description: | + Native GitHub coverage reports as a JSON array of file, language and optional label. + Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. + default: "" coverage: - description: "Coverage destination: `github` for report parsing, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command." + description: "Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command." default: github + report-group: + description: Outer calling job ID for consolidated reports. Defaults to the current job ID. + default: "" comment: description: Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. default: "false" outputs: + 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 }} report-artifact-id: - description: Native report artifact ID, empty when no supported reports were parsed. Coverage is included only in GitHub mode. + description: Native report artifact ID, empty when no supported reports were parsed. Coverage is included for `github` and `github-code-quality`. value: ${{ steps.upload-reports.outputs.artifact-id }} runs: using: composite @@ -45,12 +67,12 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 with: working-directory: ${{ inputs.working-directory }} - - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: COVERAGE: ${{ inputs.coverage }} with: script: |- - if (!['', 'github', 'codecov'].includes(process.env.COVERAGE)) throw new Error('coverage must be github, codecov or empty.'); + if (!['', 'github', 'github-code-quality', 'codecov'].includes(process.env.COVERAGE)) throw new Error('coverage must be github, github-code-quality, codecov or empty.'); - id: run uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -68,11 +90,11 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 with: working-directory: ${{ steps.directory.outputs.absolute-path }} - report-paths: ${{ inputs.coverage == 'github' && 'auto:test,auto:coverage' || 'auto:test' }} + report-paths: ${{ (inputs.coverage == 'github' || inputs.coverage == 'github-code-quality') && 'auto:test,auto:coverage' || 'auto:test' }} report-name: PHP tests output-format: annotations,summary,markdown - name: Publish individual report comment - if: ${{ !cancelled() && inputs.comment == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (steps.reports.outputs.test-markdown != '' || steps.reports.outputs.coverage-markdown != '') }} + if: ${{ !cancelled() && inputs.comment == 'true' && inputs.coverage != 'github-code-quality' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (steps.reports.outputs.test-markdown != '' || steps.reports.outputs.coverage-markdown != '') }} uses: hoverkraft-tech/ci-github-common/actions/create-or-update-comment@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 with: title: PHP test results @@ -85,16 +107,20 @@ runs: uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: REPORT_FILES: ${{ steps.reports.outputs.parsed-files }} + REPORT_GROUP: ${{ inputs.report-group || github.job }} with: script: | core.setOutput('files', JSON.parse(process.env.REPORT_FILES).join('\n')); + const group = process.env.REPORT_GROUP; + if (!/^[\w-]+$/.test(group)) throw new Error('report-group must be a job ID.'); + core.setOutput('group', group); core.setOutput('id', require('node:crypto').randomUUID()); - name: Upload native test and coverage reports id: upload-reports if: ${{ !cancelled() && steps.report-artifact.outputs.files != '' }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: ci-reports-${{ github.run_attempt }}-${{ github.job }}-${{ steps.report-artifact.outputs.id }} + name: ci-reports-${{ github.run_attempt }}-${{ steps.report-artifact.outputs.group }}-${{ steps.report-artifact.outputs.id }} path: ${{ steps.report-artifact.outputs.files }} include-hidden-files: true if-no-files-found: error @@ -140,3 +166,12 @@ runs: working-directory: ${{ steps.directory.outputs.absolute-path }} files: ${{ steps.coverage-reports.outputs.files }} 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":"PHP"}]' }} From 2a282b83dbb75d25af77d1a3003e52c1cb63b293 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 15:57:23 +0100 Subject: [PATCH 02/33] docs(coverage): regenerate action and workflow references --- .github/workflows/continuous-integration.md | 19 ++++-- actions/test/README.md | 68 ++++++++++++++------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 87dc51d..221071b 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -3,7 +3,7 @@ # GitHub Reusable Workflow: Continuous integration
- Continuous integration + Continuous integration
--- @@ -214,6 +214,17 @@ the files GitHub will distribute, without adding a package publication step. Package checks run on the primary PHP version. The source test matrix remains responsible for compatibility across every supported PHP version. Release callers should depend on successful validation with `needs`. +## 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). + ### Permissions - **`contents`**: `read` @@ -233,7 +244,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@066aee0d473f892c897c35511393ebc54394a4f1 # 2.0.2 + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 permissions: contents: read id-token: write @@ -275,7 +286,7 @@ jobs: # Run the Composer `test:ci` script unchanged, or provide another script name. # Pass "false", "null" or an empty string to disable tests. # A JSON object groups test options: `command` (default `test:ci`), - # `coverage` (`github`, `codecov` or empty), and `cache` (one directory relative to working-directory). + # `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). # Configure report/coverage generation in the Composer script itself. # Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. # Example: `{"coverage":"codecov","cache":".cache"}`. @@ -319,7 +330,7 @@ jobs: | **`test`** | Run the Composer `test:ci` script unchanged, or provide another script name. | **false** | **string** | `true` | | | Pass "false", "null" or an empty string to disable tests. | | | | | | A JSON object groups test options: `command` (default `test:ci`), | | | | -| | `coverage` (`github`, `codecov` or empty), and `cache` (one directory relative to working-directory). | | | | +| | `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). | | | | | | Configure report/coverage generation in the Composer script itself. | | | | | | Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. | | | | | | Example: `{"coverage":"codecov","cache":".cache"}`. | | | | diff --git a/actions/test/README.md b/actions/test/README.md index e8d6679..2f4bc3b 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -3,7 +3,7 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test PHP
- Test PHP + Test PHP
--- @@ -20,13 +20,22 @@ including after command failures. Only parsed report files are uploaded. Keep `comment: false` and call the common `ci-reports` workflow after producer jobs for consolidated comments with collapsed details. +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`. + ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@066aee0d473f892c897c35511393ebc54394a4f1 # 2.0.2 +- uses: hoverkraft-tech/ci-github-php/actions/test@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 with: # Composer project directory. Run setup-php first to install its dependencies. # Default: `.` @@ -47,10 +56,19 @@ jobs for consolidated comments with collapsed details. # Default: `test:ci` command: test:ci - # Coverage destination: `github` for report parsing, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. + # Native GitHub coverage reports as a JSON array of file, language and optional label. + # Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. + coverage-reports: "" + + # Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. # Default: `github` coverage: github + # Outer calling job ID for consolidated reports. Defaults to the current job ID. + report-group: "" + # Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. # Default: `false` comment: "false" @@ -61,22 +79,27 @@ jobs for consolidated comments with collapsed details. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | -| **`command`** | Composer script to execute unchanged, normally `test:ci` in composer.json. | **false** | `test:ci` | -| | The project defines its test tool, preparation and report generation. Examples: | | | -| | | | | -| | - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | - Codeception: `codecept run --xml=junit.xml --coverage-xml=clover.xml`; | | | -| | enable coverage in codeception.yml and select `coverage: codecov` for its Clover XML. | | | -| | | | | -| | For Codecov, PHPUnit and Pest can use `--coverage-clover=clover.xml`. | | | -| | Omit coverage arguments when collection is not needed. The coverage input controls publication only. | | | -| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | -| **`coverage`** | Coverage destination: `github` for report parsing, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. | **false** | `github` | -| **`comment`** | Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. | **false** | `false` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | +| **`command`** | Composer script to execute unchanged, normally `test:ci` in composer.json. | **false** | `test:ci` | +| | The project defines its test tool, preparation and report generation. Examples: | | | +| | | | | +| | - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | +| | - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | +| | - Codeception: `codecept run --xml=junit.xml --coverage-xml=clover.xml`; | | | +| | enable coverage in codeception.yml and select `coverage: codecov` for its Clover XML. | | | +| | | | | +| | For Codecov, PHPUnit and Pest can use `--coverage-clover=clover.xml`. | | | +| | Omit coverage arguments when collection is not needed. The coverage input controls publication only. | | | +| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | +| **`coverage-reports`** | Native GitHub coverage reports as a JSON array of file, language and optional label. | **false** | - | +| | Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. | | | +| **`coverage`** | Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. | **false** | `github` | +| **`report-group`** | Outer calling job ID for consolidated reports. Defaults to the current job ID. | **false** | - | +| **`comment`** | Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. | **false** | `false` | @@ -85,9 +108,10 @@ jobs for consolidated comments with collapsed details. ## Outputs -| **Output** | **Description** | -| ------------------------ | ----------------------------------------------------------------------------------------------------------------- | -| **`report-artifact-id`** | Native report artifact ID, empty when no supported reports were parsed. Coverage is included only in GitHub mode. | +| **Output** | **Description** | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| **`native-coverage-artifact-id`** | Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. | +| **`report-artifact-id`** | Native report artifact ID, empty when no supported reports were parsed. Coverage is included for `github` and `github-code-quality`. | From 8e0e745f4c9f50803a28d719b5c4823bbc372c3b Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 16:07:55 +0100 Subject: [PATCH 03/33] 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 bde9895..91d3991 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -140,11 +140,12 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: act - 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-php-${{ github.run_id }}-${{ github.run_attempt }} job-results: ${{ toJSON(needs) }} coverage-reports: '[{"job":"act","label":"tests/php-project"}]' diff --git a/actions/test/action.yml b/actions/test/action.yml index cc81d2f..04cebfe 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -170,7 +170,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 3d2648eb2cf7587214c3b19b089a647f2fe530aa Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 18:59:26 +0100 Subject: [PATCH 04/33] feat(reports)!: adopt the shared CI report contract --- .github/linters/actionlint.yml | 15 ++ .../workflows/__assert-report-artifact.yml | 5 +- .github/workflows/__main-ci.yml | 1 + .github/workflows/__pull-request-ci.yml | 1 + .github/workflows/__release.yml | 1 + .github/workflows/__shared-ci.yml | 3 +- .../__test-action-get-php-versions.yml | 5 + .github/workflows/__test-action-lint.yml | 47 +---- .../workflows/__test-action-package-test.yml | 2 +- .github/workflows/__test-action-setup-php.yml | 2 +- .github/workflows/__test-action-test.yml | 54 +----- ...__test-workflow-continuous-integration.yml | 26 +-- .github/workflows/continuous-integration.yml | 183 +++++++----------- actions/lint/action.yml | 67 +++---- actions/test/action.yml | 162 ++++------------ tests/php-project/composer.json | 2 +- 16 files changed, 193 insertions(+), 383 deletions(-) create mode 100644 .github/linters/actionlint.yml 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/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index a08b71e..23dc748 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -33,7 +33,10 @@ jobs: const path = require('node:path'); const {createHash} = require('node:crypto'); const expected = JSON.parse(process.env.EXPECTED_REPORTS); - const files = await (await glob.create('downloaded-reports/**/*', {matchDirectories: false})).glob(); + const manifest=JSON.parse(fs.readFileSync('downloaded-reports/ci-report.json','utf8')); + const files=manifest.files.filter(file=>!['coverage','attachment'].includes(file.type)).map(file=>path.join('downloaded-reports',file.file)); + assert.equal(fs.existsSync('downloaded-reports/.private-fixture'),false); + assert.equal(manifest.errors.length > 0,Object.keys(expected).length === 0 || manifest.errors.some(error=>error.includes('parsing'))); assert.deepEqual(files.map(file => path.basename(file)).sort(), Object.keys(expected).sort()); for (const file of files) { assert.equal(createHash('sha256').update(fs.readFileSync(file)).digest('hex'), expected[path.basename(file)]); diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml index 83cb8e8..72a8265 100644 --- a/.github/workflows/__main-ci.yml +++ b/.github/workflows/__main-ci.yml @@ -24,6 +24,7 @@ jobs: issues: write packages: read pull-requests: write + code-quality: write release: needs: ci if: github.event_name != 'schedule' diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml index d80edfc..803905d 100644 --- a/.github/workflows/__pull-request-ci.yml +++ b/.github/workflows/__pull-request-ci.yml @@ -20,3 +20,4 @@ jobs: issues: write packages: read pull-requests: write + code-quality: write diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml index 2a18910..c057441 100644 --- a/.github/workflows/__release.yml +++ b/.github/workflows/__release.yml @@ -33,6 +33,7 @@ jobs: issues: write security-events: write statuses: write + code-quality: write release: name: Create and publish release diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index cafac0e..487cc5d 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + 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-get-php-versions: uses: $/.github/workflows/__test-action-get-php-versions.yml permissions: diff --git a/.github/workflows/__test-action-get-php-versions.yml b/.github/workflows/__test-action-get-php-versions.yml index fcc5217..7d75532 100644 --- a/.github/workflows/__test-action-get-php-versions.yml +++ b/.github/workflows/__test-action-get-php-versions.yml @@ -1,6 +1,10 @@ name: Internal - Test Composer PHP version discovery on: workflow_call: + outputs: + report-plan: + description: Expected native report plan. + value: ${{ jobs.unit.outputs.report-plan }} permissions: {} jobs: unit: @@ -20,6 +24,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Arrange - Composer is the only version declaration run: | rm .php-version diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 644acab..8adb01f 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -20,6 +20,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Arrange - Configure native PHPStan reports uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -30,7 +31,9 @@ jobs: await io.cp('tests/php-project', '.test-php-lint', {recursive: true}); const manifestPath = '.test-php-lint/composer.json'; const manifest = JSON.parse(await fs.readFile(manifestPath, 'utf8')); - if (process.env.SCENARIO !== 'no-reports') { + if (process.env.SCENARIO === 'no-reports') { + manifest.scripts['lint:ci'] = 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=github'; + } else { manifest.scripts['lint:ci'] = 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > phpstan-checkstyle.xml'; } if (process.env.SCENARIO === 'failure') { @@ -62,9 +65,10 @@ jobs: script: | const assert = require('node:assert/strict'); const fs = require('node:fs'); - assert.equal(process.env.OUTCOME, process.env.SCENARIO === 'failure' ? 'failure' : 'success'); + assert.equal(process.env.OUTCOME, ['failure','no-reports'].includes(process.env.SCENARIO) ? 'failure' : 'success'); if (process.env.SCENARIO === 'no-reports') { - assert.equal(process.env.ARTIFACT_ID, ''); + assert.match(process.env.ARTIFACT_ID, /^\d+$/); + core.setOutput('expected-reports',{}); return; } assert.match(process.env.ARTIFACT_ID, /^\d+$/); @@ -81,40 +85,3 @@ jobs: with: artifact-id: ${{ needs.lint.outputs.report-artifact-id }} expected-reports: ${{ needs.lint.outputs.expected-reports }} - - individual-comment: - if: inputs.scenario == 'success' - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - name: Arrange - Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - name: Arrange - Install the Composer fixture - uses: $/actions/setup-php - with: - working-directory: tests/php-project - coverage: none - - name: Arrange - Configure PHPStan report generation - working-directory: tests/php-project - run: composer config scripts.lint:ci 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > phpstan-checkstyle.xml' - - name: Act - Publish an individual lint report - uses: $/actions/lint - with: - working-directory: tests/php-project - comment: "true" - - name: Assert - One lint comment with collapsed details - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const assert = require('node:assert/strict'); - const pr = context.payload.pull_request; - if (context.eventName !== 'pull_request' || pr.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`) return; - const comments = await github.paginate(github.rest.issues.listComments, {...context.repo, issue_number: pr.number, per_page: 100}); - const reports = comments.filter(comment => comment.user.login === 'github-actions[bot]' && comment.body.startsWith('PHP lint results\n')); - assert.equal(reports.length, 1); - assert.match(reports[0].body, /
/); - assert.match(reports[0].body, /0 errors/); diff --git a/.github/workflows/__test-action-package-test.yml b/.github/workflows/__test-action-package-test.yml index 6d4287b..8132641 100644 --- a/.github/workflows/__test-action-package-test.yml +++ b/.github/workflows/__test-action-package-test.yml @@ -18,7 +18,7 @@ jobs: - failing-command - mutated-archive steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/actions/setup-php diff --git a/.github/workflows/__test-action-setup-php.yml b/.github/workflows/__test-action-setup-php.yml index e1d14e3..0fffb3f 100644 --- a/.github/workflows/__test-action-setup-php.yml +++ b/.github/workflows/__test-action-setup-php.yml @@ -8,7 +8,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Arrange - Copy a project without a lockfile diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index 8965c7b..35f76f4 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -17,12 +17,13 @@ jobs: report-artifact-id: ${{ steps.tests.outputs.report-artifact-id }} expected-reports: ${{ steps.assert.outputs.expected-reports }} steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Arrange - Project test script id: fixture - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: SCENARIO: ${{ inputs.scenario }} with: @@ -67,16 +68,16 @@ jobs: uses: $/actions/test with: working-directory: ${{ steps.fixture.outputs.directory }} - coverage: ${{ (inputs.scenario == 'reports' || inputs.scenario == 'failing-tests') && 'github' || '' }} + coverage: ${{ (inputs.scenario == 'reports' || inputs.scenario == 'failing-tests') && 'true' || 'false' }} - name: Assert - Reports and project preparation id: assert - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: DIRECTORY: ${{ steps.fixture.outputs.directory }} OUTCOME: ${{ steps.tests.outcome }} SCENARIO: ${{ inputs.scenario }} ARTIFACT_ID: ${{ steps.tests.outputs.report-artifact-id }} - COVERAGE: ${{ (inputs.scenario == 'reports' || inputs.scenario == 'failing-tests') && 'github' || '' }} + COVERAGE: ${{ (inputs.scenario == 'reports' || inputs.scenario == 'failing-tests') && 'true' || 'false' }} with: script: |- const assert = require('node:assert/strict'); @@ -84,14 +85,15 @@ jobs: const path = require('node:path'); const directory = process.env.DIRECTORY; const scenario = process.env.SCENARIO; - assert.equal(process.env.OUTCOME, scenario.startsWith('failing-') ? 'failure' : 'success'); + assert.equal(process.env.OUTCOME, (scenario.startsWith('failing-') || scenario === 'no-reports') ? 'failure' : 'success'); if (scenario === 'no-reports') { - assert.equal(process.env.ARTIFACT_ID, ''); + assert.match(process.env.ARTIFACT_ID, /^\d+$/); + core.setOutput('expected-reports',{}); return; } assert.match(process.env.ARTIFACT_ID, /^\d+$/); const {createHash} = require('node:crypto'); - const reportNames = process.env.COVERAGE === 'github' ? ['cobertura.xml', 'junit.xml'] : ['junit.xml']; + const reportNames = ['junit.xml']; core.setOutput('expected-reports', Object.fromEntries(reportNames.map(name => [name, createHash('sha256').update(fs.readFileSync(path.join(directory, name))).digest('hex')]))); const junit = fs.readFileSync(path.join(directory, 'junit.xml'), 'utf8'); assert.match(junit, / comment.user.login === 'github-actions[bot]' && comment.body.startsWith('PHP test results\n')); - assert.equal(reports.length, 1); - assert.match(reports[0].body, /
/); - assert.match(reports[0].body, /Test Results/); - assert.match(reports[0].body, /1 passed · 0 failed · 0 skipped/); - assert.match(reports[0].body, /Coverage/); diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index 91d3991..cf47498 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -12,6 +12,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | @@ -63,35 +64,36 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const assert = require('node:assert/strict'); const fs = require('node:fs'); const workflow = fs.readFileSync('.github/workflows/continuous-integration.yml', 'utf8'); - const step = workflow.split(' - id: config\n')[1]?.split('\n dependency-review:')[0]; - const script = step?.split(' script: |-\n')[1]?.replace(/^ {12}/gm, ''); + const step = workflow.split(' - id: config\n')[1]?.split('\n - id: report-plan')[0]; + const script = step?.split(/ script: \|[-+]?\n/)[1]?.replace(/^ {12}/gm, ''); assert.ok(script, 'Configuration script must exist'); const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; const configure = new AsyncFunction('core', 'process', script); async function parse(env = {}) { const outputs = {}; await configure({setOutput: (key, value) => { outputs[key] = value; }}, { - env: {VERSIONS: '', LINT: 'true', TEST: 'true', ...env} + env: {VERSIONS: '', LINT: 'true', TEST: 'true', DIRECTORY: '.', CHECKS: 'true', ...env} }); return {...outputs, lint: JSON.parse(outputs.lint), test: JSON.parse(outputs.test)}; } const defaults = await parse(); assert.deepEqual(defaults.lint, {command: 'lint:ci'}); assert.equal((await parse({LINT: '{"command":"lint:custom"}'})).lint.command, 'lint:custom'); - assert.deepEqual(defaults.test, {command: 'test:ci', coverage: 'github', cache: '', 'coverage-reports': [], 'report-group': ''}); + assert.deepEqual(defaults.test, {command: 'test:ci', coverage: true, cache: '', 'coverage-reports': []}); for (const value of ['', 'false', 'null']) { const config = await parse({LINT: value, TEST: value}); assert.equal(config.lint, null); assert.equal(config.test, null); } - const configured = await parse({TEST: '{"command":"test:custom","coverage":"","cache":".cache"}', VERSIONS: '["8.2", "8.5"]'}); - assert.deepEqual(configured.test, {command: 'test:custom', coverage: '', cache: '.cache', 'coverage-reports': [], 'report-group': ''}); + const configured = await parse({TEST: '{"command":"test:custom","coverage":false,"cache":".cache"}', VERSIONS: '["8.2", "8.5"]'}); + assert.deepEqual(configured.test, {command: 'test:custom', coverage: false, cache: '.cache', 'coverage-reports': []}); assert.equal(configured['primary-version'], '8.5'); assert.equal((await parse({TEST: 'test:custom'})).test.command, 'test:custom'); for (const name of ['LINT', 'TEST']) { @@ -99,13 +101,13 @@ jobs: await assert.rejects(() => parse({[name]: value}), undefined, name + '=' + value); } } - for (const test of [{coverage: false}, {coverage: 'unknown'}, {cache: '../vendor'}, {cache: '/tmp'}, {cache: '.'}]) { + for (const test of [{coverage: 'false'}, {coverage: 'unknown'}, {cache: '../vendor'}, {cache: '/tmp'}, {cache: '.'}]) { await assert.rejects(() => parse({TEST: JSON.stringify(test)})); } for (const versions of ['[]', '["8.2","8.2"]', '[8.2]', '["latest"]']) { await assert.rejects(() => parse({VERSIONS: versions})); } - const native = {coverage: 'github-code-quality', 'report-group': 'backend', 'coverage-reports': [{file: 'custom.xml', language: 'PHP', label: 'backend'}]}; + const native = {coverage: true, 'coverage-reports': [{file: 'custom.xml', language: 'PHP', label: 'backend'}]}; const nativeConfig = await parse({TEST: JSON.stringify(native)}); for (const [key, value] of Object.entries(native)) assert.deepEqual(nativeConfig.test[key], value); for (const invalid of [{'coverage-reports': {}}, {'report-group': 'bad/group'}]) { @@ -121,7 +123,7 @@ jobs: id-token: write with: working-directory: tests/php-project - test: '{"cache":".phpunit.cache","coverage":"github-code-quality","report-group":"act"}' + test: '{"cache":".phpunit.cache","coverage":true}' runs-on: '["ubuntu-24.04"]' dependency-review: false checks-disabled: @@ -140,12 +142,12 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: act - 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-php-${{ github.run_id }}-${{ github.run_attempt }} job-results: ${{ toJSON(needs) }} - coverage-reports: '[{"job":"act","label":"tests/php-project"}]' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 61be04a..fa90c50 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,7 +9,6 @@ # uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@ # permissions: # contents: read -# id-token: write # ``` # # Define `lint:ci` and `test:ci` in `composer.json`. These are explicit project commands; @@ -30,7 +29,7 @@ # It tests the newest compatible patch of every matching minor, including end-of-life # versions still allowed by the project. Prereleases are excluded. Missing or invalid # constraints and release-catalog failures stop discovery instead of choosing an arbitrary runtime. -# The highest discovered version runs lint and package checks and publishes coverage. +# The highest discovered version runs lint and package checks and contributes coverage. # Set `php-versions` explicitly to override the matrix, for example `'["8.2", "8.5"]'`. # The last explicit entry is primary; an empty entry delegates to the setup action, # which honors `.php-version` and Composer platform overrides before automatic discovery. @@ -55,102 +54,49 @@ # # ### Reports and coverage # -# The lint and test actions reuse `ci-github-common/actions/quality/parse-ci-reports` for -# GitHub annotations and job summaries. The test action runs your Composer script unchanged. The script selects its test tool, -# preparation, configuration and report formats. For PHPUnit, keep the everyday test -# command and add a CI script: +# 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. # -# ```json -# { -# "scripts": { -# "test": "phpunit --configuration tests/phpunit.xml", -# "test:ci": "@test --log-junit=junit.xml --coverage-cobertura=cobertura.xml" -# } -# } -# ``` -# -# The action sets `CI=true` and adds no test-runner arguments. JUnit reports are -# parsed even after the command fails. The same Composer command runs on every PHP -# version; only the last version publishes coverage. The `coverage` option controls -# publication, not collection. Set it to an empty string to skip coverage publication; -# omit coverage arguments from your script when collection is not needed. +# 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. # -# For Codecov, use `--coverage-clover=clover.xml` in the script and configure: -# -# ```yaml -# with: -# test: '{"coverage":"codecov"}' -# ``` -# -# Codecov requires `id-token: write` and repository access. The action discovers -# Clover reports, falling back to Cobertura. For GitHub coverage summaries, generate -# Cobertura. Add generated report files to `.gitignore`. Clean any retained report -# files in your project command if it reuses an existing workspace. -# -# The lint and test actions upload only parsed native reports, including after a -# failed command, and retain them for seven days. Their `report-artifact-id` -# output identifies the artifact; it is empty when no supported reports were -# found. Test artifacts include coverage only with `coverage: github`. -# Codecov upload remains separate. Console-only lint output creates no artifact; -# configure a supported file report such as PHPStan Checkstyle for consolidation. -# -# Individual comments are disabled by default, keeping producer jobs read-only. -# When calling an action directly, set `comment: true` and grant -# `pull-requests: write` to opt in. Human and bot actors follow the same rules; -# fork PRs keep summaries, annotations and artifacts without commenting. -# -# For custom producer jobs named `lint` and `test`, leave individual comments -# disabled and add one final job using the common reporting workflow: +# Call the common workflow once after producer workflows. It reads their complete +# report plans from `needs`, regardless of calling job names: # # ```yaml # reports: -# needs: [lint, test] -# if: always() -# uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 +# 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 # ``` # -# This updates one comment each for tests, coverage and lint, with details -# collapsed. Keep producer job IDs aligned with the shared reporter's contract; -# when wrapping producers in reusable workflows, use matching caller and inner -# job IDs. The full CI workflow uses inner `lint` and `test` jobs; use the -# individual actions when you need to compose them with this final reporter. -# Keep producer jobs as required checks: report publication does not replace them. -# -# Preparation belongs in the Composer script, with report arguments attached only -# to the test command: -# -# ```json -# { -# "scripts": { -# "test:ci": [ -# "@test:load-fixtures", -# "@test --log-junit=junit.xml --coverage-clover=clover.xml" -# ] -# } -# } -# ``` -# -# Pest and Codeception projects use the same contract; define their commands and -# report options in Composer. No test-runner selection is needed in the action. -# Use `command` for a script name other than `test:ci`. Group custom settings in one -# input, omitting fields that use defaults: +# 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. # -# ```yaml -# with: -# test: '{"coverage":"codecov","cache":".cache"}' -# ``` -# -# The test `cache` option can retain a directory of generated test fixtures or results. Do not -# cache `vendor`; Composer installation manages dependencies. -# -# Dependency review runs only on pull requests. PHP CodeQL analysis is not part of -# the workflow because PHP is not a supported CodeQL language. Run your PHP static -# analyzer through the lint script. +# 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. # # ### Generated application files and documentation # @@ -199,17 +145,6 @@ # Package checks run on the primary PHP version. The source test matrix remains # responsible for compatibility across every supported PHP version. Release callers should depend on successful validation with `needs`. # -# ## 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: Continuous integration on: workflow_call: @@ -227,7 +162,7 @@ on: type: string default: . php-versions: - description: Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and publishes coverage. An empty entry uses the setup action default. + description: Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and contributes coverage. An empty entry uses the setup action default. type: string default: "" extensions: @@ -251,14 +186,8 @@ on: type: string default: "true" test: - description: | - Run the Composer `test:ci` script unchanged, or provide another script name. - Pass "false", "null" or an empty string to disable tests. - A JSON object groups test options: `command` (default `test:ci`), - `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). - Configure report/coverage generation in the Composer script itself. - Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. - Example: `{"coverage":"codecov","cache":".cache"}`. + description: |- + true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. type: string default: "true" package: @@ -275,6 +204,14 @@ on: description: Review dependency changes on pull requests. type: boolean default: true + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. + default: "" + type: string + outputs: + report-plan: + description: Complete expected report plan, consumed automatically by ci-reports. + value: ${{ jobs.configuration.outputs.report-plan }} permissions: {} jobs: configuration: @@ -288,11 +225,14 @@ jobs: test: ${{ steps.config.outputs.test }} package-enabled: ${{ steps.package-config.outputs.enabled }} package-tests: ${{ steps.package-config.outputs.tests }} + report-plan: ${{ steps.report-plan.outputs.report-plan }} + report-selections: ${{ steps.report-plan.outputs.selections }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 if: inputs.checks && inputs.php-versions == '' with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - id: versions if: inputs.checks && inputs.php-versions == '' uses: $/actions/get-php-versions @@ -327,8 +267,10 @@ jobs: VERSIONS: ${{ inputs.php-versions || steps.versions.outputs.php-versions }} LINT: ${{ inputs.lint }} TEST: ${{ inputs.test }} + CHECKS: ${{ inputs.checks }} + DIRECTORY: ${{ inputs.working-directory }} with: - script: |- + script: | const versions = process.env.VERSIONS.trim() ? JSON.parse(process.env.VERSIONS) : ['']; if (!Array.isArray(versions) || !versions.length || versions.length > 20 || versions.some(version => typeof version !== 'string' || (version && !/^\d+\.\d+(?:\.\d+)?$/.test(version))) || new Set(versions).size !== versions.length) { throw new Error('php-versions must be a JSON array of unique numeric PHP versions.'); @@ -346,15 +288,13 @@ jobs: if (unknown.length) throw new Error('Unknown ' + name + ' options: ' + unknown.join(', ') + '.'); config = {...defaults, ...config}; for (const [key, option] of Object.entries(config)) { - if (Array.isArray(defaults[key]) ? !Array.isArray(option) : typeof option !== 'string') throw new Error(name + '.' + key + ' must be a string.'); + if (Array.isArray(defaults[key]) ? !Array.isArray(option) : typeof option !== typeof defaults[key]) throw new Error(name + '.' + key + ' has the wrong type.'); } if (!config.command.trim() || config.command.startsWith('-') || /\s/.test(config.command)) throw new Error(name + '.command must name a Composer script.'); return config; } const lint = options('lint', process.env.LINT, {command: 'lint:ci'}); - const test = options('test', process.env.TEST, {command: 'test:ci', coverage: 'github', cache: '', '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: 'test:ci', coverage: true, cache: '', 'coverage-reports': []}); const cache = test?.cache; if (cache && (cache === '.' || cache.startsWith('/') || cache.includes('\\') || cache.split('/').includes('..') || /[\r\n*?]/.test(cache))) { throw new Error('test.cache must be one directory inside working-directory.'); @@ -363,6 +303,18 @@ jobs: core.setOutput('test', JSON.stringify(test)); core.setOutput('versions', versions); core.setOutput('primary-version', versions.at(-1)); + 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:'PHP'}]) : []}); + 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 && github.event_name == 'pull_request' && inputs.dependency-review runs-on: ${{ fromJSON(inputs.runs-on) }} @@ -372,6 +324,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' @@ -383,6 +336,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: $/actions/setup-php with: working-directory: ${{ inputs.working-directory }} @@ -395,13 +349,13 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} + report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections).lint) }} test: if: inputs.checks && needs.configuration.outputs.test != 'null' needs: configuration runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: contents: read - id-token: write strategy: fail-fast: false matrix: @@ -410,7 +364,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - 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 }} - uses: $/actions/setup-php with: working-directory: ${{ inputs.working-directory }} @@ -429,9 +383,9 @@ 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.php-version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage || '' }} + coverage: ${{ matrix.php-version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} + report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections)[format('test-{0}', matrix.php-version || 'project')]) }} package: if: inputs.checks && needs.configuration.outputs.package-enabled == 'true' needs: configuration @@ -442,6 +396,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} - uses: $/actions/setup-php with: working-directory: ${{ inputs.working-directory }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 4157f1c..afc30cc 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -1,11 +1,12 @@ name: Lint PHP description: | - Run a project-defined Composer lint script and report results. + Run project lint commands and retain native reports for consolidated CI feedback. + The common ci-reports workflow owns comments and external coverage publication. + Forward report-plan from standalone jobs; reusable workflows do this automatically. + Required reports remain required after command failures. This action keeps local + diagnostics and never grants publication permissions to project code. - Native lint reports are retained for seven days, including after command - failures. Only parsed report files are uploaded. Keep `comment: false` and - call the common `ci-reports` workflow after producer jobs for consolidated - comments with collapsed details. + Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. author: hoverkraft branding: icon: package @@ -29,13 +30,16 @@ inputs: for separate tooling installations, prefix binaries with `tools/vendor/bin/`. See the [CI guide](../../.github/workflows/continuous-integration.md). default: lint:ci - comment: - description: Publish an individual lint PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. - default: "false" + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. + default: "" outputs: report-artifact-id: - description: Native lint report artifact ID, empty when no supported reports were parsed. - value: ${{ steps.upload-reports.outputs.artifact-id }} + description: Native report bundle, including available diagnostics after failures. + value: ${{ steps.reports.outputs.artifact-id }} + report-plan: + description: Expected report metadata. Forward from standalone jobs. + value: ${{ steps.report-plan.outputs.report-plan }} runs: using: composite steps: @@ -43,6 +47,12 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 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: run uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -55,38 +65,11 @@ runs: await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', command], { cwd: process.env.WORKING_DIRECTORY, }); - - name: Report lint results - id: reports - if: ${{ !cancelled() && steps.directory.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + - id: reports + name: Record lint results + if: ${{ !cancelled() && 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-plan: ${{ steps.report-plan.outputs.report-plan }} report-paths: auto:lint - report-name: PHP lint - output-format: annotations,summary,markdown - - name: Publish individual report comment - if: ${{ !cancelled() && inputs.comment == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && steps.reports.outputs.lint-markdown != '' }} - uses: hoverkraft-tech/ci-github-common/actions/create-or-update-comment@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 - with: - title: PHP lint results - body: ${{ steps.reports.outputs.lint-markdown }} - - name: Prepare native report artifact - id: report-artifact - if: ${{ !cancelled() && steps.reports.outputs.parsed-files != '' }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - REPORT_FILES: ${{ steps.reports.outputs.parsed-files }} - with: - script: | - core.setOutput('files', JSON.parse(process.env.REPORT_FILES).join('\n')); - core.setOutput('id', require('node:crypto').randomUUID()); - - name: Upload native lint reports - id: upload-reports - if: ${{ !cancelled() && steps.report-artifact.outputs.files != '' }} - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: ci-reports-${{ github.run_attempt }}-${{ github.job }}-${{ steps.report-artifact.outputs.id }} - path: ${{ steps.report-artifact.outputs.files }} - include-hidden-files: true - if-no-files-found: error - retention-days: 7 diff --git a/actions/test/action.yml b/actions/test/action.yml index 04cebfe..27d2443 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -1,20 +1,13 @@ name: Test PHP description: | - Run Composer tests and report results, optionally uploading coverage. + Run project test commands and retain native reports for consolidated CI feedback. + The common ci-reports workflow owns comments and external coverage publication. + Forward report-plan from standalone jobs; reusable workflows do this automatically. + Required reports remain required after command failures. This action keeps local + diagnostics and never grants publication permissions to project code. - Native test reports and GitHub coverage reports are retained for seven days, - including after command failures. Only parsed report files are uploaded. - Keep `comment: false` and call the common `ci-reports` workflow after producer - jobs for consolidated comments with collapsed details. - - 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`. + Coverage publication requires Cobertura XML generated by the test tool. Configure + JUnit or TAP for test results and merge framework shards before recording coverage. author: hoverkraft branding: icon: package @@ -30,36 +23,30 @@ inputs: - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - - Codeception: `codecept run --xml=junit.xml --coverage-xml=clover.xml`; - enable coverage in codeception.yml and select `coverage: codecov` for its Clover XML. - For Codecov, PHPUnit and Pest can use `--coverage-clover=clover.xml`. - Omit coverage arguments when collection is not needed. The coverage input controls publication only. + Generate Cobertura for the consolidated publishing path. A Clover-only + project must add Cobertura generation before enabling collection. + Set coverage to false for diagnostic-only tests. Instrumentation and report + generation remain controlled by the project command. See the [CI guide](../../.github/workflows/continuous-integration.md). default: test:ci coverage-reports: - description: | - Native GitHub coverage reports as a JSON array of file, language and optional label. - Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. + description: |- + Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. default: "" coverage: - description: "Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command." - default: github - report-group: - description: Outer calling job ID for consolidated reports. Defaults to the current job ID. + description: Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. + default: "true" + report-plan: + description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. default: "" - comment: - description: Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. - default: "false" outputs: - 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 }} report-artifact-id: - description: Native report artifact ID, empty when no supported reports were parsed. Coverage is included for `github` and `github-code-quality`. - value: ${{ steps.upload-reports.outputs.artifact-id }} + description: Native report bundle, including available diagnostics after failures. + value: ${{ steps.reports.outputs.artifact-id }} + report-plan: + description: Expected report metadata. Forward from standalone jobs. + value: ${{ steps.report-plan.outputs.report-plan }} runs: using: composite steps: @@ -71,8 +58,14 @@ runs: env: COVERAGE: ${{ inputs.coverage }} with: - script: |- - if (!['', 'github', 'github-code-quality', 'codecov'].includes(process.env.COVERAGE)) throw new Error('coverage must be github, github-code-quality, codecov or empty.'); + script: | + if (!['true','false'].includes(process.env.COVERAGE)) throw new Error('coverage must be true or false.'); + - 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":"PHP"}]'') || ''[]'' }}}]' - id: run uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -84,94 +77,11 @@ runs: if (!command || command.startsWith('-')) throw new Error('command must name a Composer script.'); const args = ['--no-interaction', 'run-script', '--timeout=0', command]; await exec.exec('composer', args, {cwd: process.env.WORKING_DIRECTORY, env: {...process.env, CI: 'true'}}); - - name: Report test results - id: reports - if: ${{ !cancelled() && steps.directory.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 - with: - working-directory: ${{ steps.directory.outputs.absolute-path }} - report-paths: ${{ (inputs.coverage == 'github' || inputs.coverage == 'github-code-quality') && 'auto:test,auto:coverage' || 'auto:test' }} - report-name: PHP tests - output-format: annotations,summary,markdown - - name: Publish individual report comment - if: ${{ !cancelled() && inputs.comment == 'true' && inputs.coverage != 'github-code-quality' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (steps.reports.outputs.test-markdown != '' || steps.reports.outputs.coverage-markdown != '') }} - uses: hoverkraft-tech/ci-github-common/actions/create-or-update-comment@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 - with: - title: PHP test results - body: | - ${{ steps.reports.outputs.test-markdown }} - ${{ steps.reports.outputs.coverage-markdown }} - - name: Prepare native report artifact - id: report-artifact - if: ${{ !cancelled() && steps.reports.outputs.parsed-files != '' }} - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - REPORT_FILES: ${{ steps.reports.outputs.parsed-files }} - REPORT_GROUP: ${{ inputs.report-group || github.job }} - with: - script: | - core.setOutput('files', JSON.parse(process.env.REPORT_FILES).join('\n')); - const group = process.env.REPORT_GROUP; - if (!/^[\w-]+$/.test(group)) throw new Error('report-group must be a job ID.'); - core.setOutput('group', group); - core.setOutput('id', require('node:crypto').randomUUID()); - - name: Upload native test and coverage reports - id: upload-reports - if: ${{ !cancelled() && steps.report-artifact.outputs.files != '' }} - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: ci-reports-${{ github.run_attempt }}-${{ steps.report-artifact.outputs.group }}-${{ steps.report-artifact.outputs.id }} - path: ${{ steps.report-artifact.outputs.files }} - include-hidden-files: true - if-no-files-found: error - retention-days: 7 - - name: Find coverage reports - id: coverage-reports - if: "!cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'codecov'" - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} - with: - script: |- - const fs = require('node:fs/promises'); - const directory = process.env.WORKING_DIRECTORY; - const reports = {clover: [], cobertura: []}; - const search = await glob.create([ - `${directory}/**/*.xml`, - `!${directory}/**/vendor/**`, - `!${directory}/**/node_modules/**`, - `!${directory}/**/.git/**`, - ].join('\n'), {followSymbolicLinks: false, matchDirectories: false}); - for await (const file of search.globGenerator()) { - const handle = await fs.open(file, 'r'); - let header; - try { - const {buffer, bytesRead} = await handle.read(Buffer.alloc(8192), 0, 8192, 0); - header = buffer.toString('utf8', 0, bytesRead); - } finally { - await handle.close(); - } - if (/]*>\s*]*\bline-rate=/.test(header)) reports.cobertura.push(file); - } - const files = reports.clover.length ? reports.clover : reports.cobertura; - if (!files.length) throw new Error('No Clover or Cobertura coverage reports found. Enable coverage in the Composer test script.'); - if (files.some(file => file.includes(','))) throw new Error('Coverage report paths must not contain commas.'); - core.info(`Uploading ${files.length} ${reports.clover.length ? 'Clover' : 'Cobertura'} coverage report(s).`); - core.setOutput('files', files.sort().join(',')); - - name: Upload coverage - if: "!cancelled() && steps.coverage-reports.outcome == 'success'" - uses: hoverkraft-tech/ci-github-common/actions/quality/codecov@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 - with: - working-directory: ${{ steps.directory.outputs.absolute-path }} - files: ${{ steps.coverage-reports.outputs.files }} - 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) + - id: reports + name: Record test results + if: ${{ !cancelled() && 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":"PHP"}]' }} + report-plan: ${{ steps.report-plan.outputs.report-plan }} + report-paths: auto:test diff --git a/tests/php-project/composer.json b/tests/php-project/composer.json index 8e064c6..d1439ed 100644 --- a/tests/php-project/composer.json +++ b/tests/php-project/composer.json @@ -19,7 +19,7 @@ } }, "scripts": { - "lint:ci": "tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=github", + "lint:ci": "tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > phpstan-checkstyle.xml", "test": "phpunit", "post-install-cmd": "@php -r \"file_put_contents('install-hook.txt', 'hook executed');\"", "post-update-cmd": "@post-install-cmd", From ac12295fad96f181c74d0f09344c5f5dbaa84546 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 26 Nov 2026 19:12:19 +0100 Subject: [PATCH 05/33] 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 | 203 ++++++------------ .github/workflows/continuous-integration.yml | 2 +- actions/lint/README.md | 63 +++--- actions/lint/action.yml | 4 +- actions/test/README.md | 102 ++++----- actions/test/action.yml | 4 +- 8 files changed, 139 insertions(+), 243 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 487cc5d..1834e02 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 cf47498..dc71a34 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -142,7 +142,7 @@ jobs: collect-native-coverage: name: Verify coverage from the primary runtime needs: act - 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 221071b..1093a07 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -2,12 +2,6 @@ # GitHub Reusable Workflow: Continuous integration -
- Continuous integration -
- ---- - @@ -24,7 +18,6 @@ jobs: uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@ permissions: contents: read - id-token: write ``` Define `lint:ci` and `test:ci` in `composer.json`. These are explicit project commands; @@ -45,7 +38,7 @@ Discovery runs in its own container without changing the runner's PHP installati It tests the newest compatible patch of every matching minor, including end-of-life versions still allowed by the project. Prereleases are excluded. Missing or invalid constraints and release-catalog failures stop discovery instead of choosing an arbitrary runtime. -The highest discovered version runs lint and package checks and publishes coverage. +The highest discovered version runs lint and package checks and contributes coverage. Set `php-versions` explicitly to override the matrix, for example `'["8.2", "8.5"]'`. The last explicit entry is primary; an empty entry delegates to the setup action, which honors `.php-version` and Composer platform overrides before automatic discovery. @@ -70,102 +63,49 @@ without installing the project, for example before isolated package checks. ### Reports and coverage -The lint and test actions reuse `ci-github-common/actions/quality/parse-ci-reports` for -GitHub annotations and job summaries. The test action runs your Composer script unchanged. The script selects its test tool, -preparation, configuration and report formats. For PHPUnit, keep the everyday test -command and add a CI script: - -```json -{ - "scripts": { - "test": "phpunit --configuration tests/phpunit.xml", - "test:ci": "@test --log-junit=junit.xml --coverage-cobertura=cobertura.xml" - } -} -``` +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. -The action sets `CI=true` and adds no test-runner arguments. JUnit reports are -parsed even after the command fails. The same Composer command runs on every PHP -version; only the last version publishes coverage. The `coverage` option controls -publication, not collection. Set it to an empty string to skip coverage publication; -omit coverage arguments from your script when collection is not needed. +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. -For Codecov, use `--coverage-clover=clover.xml` in the script and configure: - -```yaml -with: - test: '{"coverage":"codecov"}' -``` - -Codecov requires `id-token: write` and repository access. The action discovers -Clover reports, falling back to Cobertura. For GitHub coverage summaries, generate -Cobertura. Add generated report files to `.gitignore`. Clean any retained report -files in your project command if it reuses an existing workspace. - -The lint and test actions upload only parsed native reports, including after a -failed command, and retain them for seven days. Their `report-artifact-id` -output identifies the artifact; it is empty when no supported reports were -found. Test artifacts include coverage only with `coverage: github`. -Codecov upload remains separate. Console-only lint output creates no artifact; -configure a supported file report such as PHPStan Checkstyle for consolidation. - -Individual comments are disabled by default, keeping producer jobs read-only. -When calling an action directly, set `comment: true` and grant -`pull-requests: write` to opt in. Human and bot actors follow the same rules; -fork PRs keep summaries, annotations and artifacts without commenting. - -For custom producer jobs named `lint` and `test`, leave individual comments -disabled and add one final job using the common reporting workflow: +Call the common workflow once after producer workflows. It reads their complete +report plans from `needs`, regardless of calling job names: ```yaml reports: - needs: [lint, test] - if: always() - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@d606f77fad305ef07dfde3db5270f5e324019c97 # 4.2.4 + 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 ``` -This updates one comment each for tests, coverage and lint, with details -collapsed. Keep producer job IDs aligned with the shared reporter's contract; -when wrapping producers in reusable workflows, use matching caller and inner -job IDs. The full CI workflow uses inner `lint` and `test` jobs; use the -individual actions when you need to compose them with this final reporter. -Keep producer jobs as required checks: report publication does not replace them. - -Preparation belongs in the Composer script, with report arguments attached only -to the test command: - -```json -{ - "scripts": { - "test:ci": [ - "@test:load-fixtures", - "@test --log-junit=junit.xml --coverage-clover=clover.xml" - ] - } -} -``` - -Pest and Codeception projects use the same contract; define their commands and -report options in Composer. No test-runner selection is needed in the action. -Use `command` for a script name other than `test:ci`. Group custom settings in one -input, omitting fields that use defaults: +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. -```yaml -with: - test: '{"coverage":"codecov","cache":".cache"}' -``` - -The test `cache` option can retain a directory of generated test fixtures or results. Do not -cache `vendor`; Composer installation manages dependencies. - -Dependency review runs only on pull requests. PHP CodeQL analysis is not part of -the workflow because PHP is not a supported CodeQL language. Run your PHP static -analyzer through the lint script. +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. ### Generated application files and documentation @@ -214,21 +154,9 @@ the files GitHub will distribute, without adding a package publication step. Package checks run on the primary PHP version. The source test matrix remains responsible for compatibility across every supported PHP version. Release callers should depend on successful validation with `needs`. -## 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). - ### Permissions - **`contents`**: `read` -- **`id-token`**: `write` @@ -244,10 +172,9 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage permissions: contents: read - id-token: write with: # JSON array of Linux runner labels. Applies to every job, including the configuration job. # Default: `["ubuntu-latest"]` @@ -261,7 +188,7 @@ jobs: # Default: `.` working-directory: . - # Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and publishes coverage. An empty entry uses the setup action default. + # Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and contributes coverage. An empty entry uses the setup action default. php-versions: "" # PHP extensions forwarded to setup-php. @@ -283,14 +210,7 @@ jobs: # Default: `true` lint: "true" - # Run the Composer `test:ci` script unchanged, or provide another script name. - # Pass "false", "null" or an empty string to disable tests. - # A JSON object groups test options: `command` (default `test:ci`), - # `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). - # Configure report/coverage generation in the Composer script itself. - # Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. - # Example: `{"coverage":"codecov","cache":".cache"}`. - # + # true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. # Default: `true` test: "true" @@ -307,6 +227,9 @@ jobs: # Review dependency changes on pull requests. # Default: `true` dependency-review: true + + # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. + report-plan: "" ``` @@ -316,36 +239,38 @@ jobs: ### Workflow Call Inputs -| **Input** | **Description** | **Required** | **Type** | **Default** | -| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | ------------------------------------------------ | -| **`runs-on`** | JSON array of Linux runner labels. Applies to every job, including the configuration job. | **false** | **string** | `["ubuntu-latest"]` | -| **`checks`** | Enable lint, tests, dependency review and optional distribution checks. | **false** | **boolean** | `true` | -| **`working-directory`** | Composer project directory relative to the checkout. | **false** | **string** | `.` | -| **`php-versions`** | Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and publishes coverage. An empty entry uses the setup action default. | **false** | **string** | - | -| **`extensions`** | PHP extensions forwarded to setup-php. | **false** | **string** | `mbstring, dom, xml, xmlwriter, curl, zip, intl` | -| **`composer-directories`** | Optional JSON array of Composer directories relative to working-directory. Empty installs the root project and tools/composer.json when present, without recursive discovery. | **false** | **string** | - | -| **`ignore-scripts`** | Disable Composer installation scripts. Explicit project commands still run. | **false** | **boolean** | `true` | -| **`ignore-plugins`** | Disable Composer plugins during installation. When false, Composer allow-plugins configuration still applies. | **false** | **boolean** | `true` | -| **`lint`** | Composer lint script name or a JSON object with `command` (default `lint:ci`). Pass "false", "null" or an empty string to disable. | **false** | **string** | `true` | -| **`test`** | Run the Composer `test:ci` script unchanged, or provide another script name. | **false** | **string** | `true` | -| | Pass "false", "null" or an empty string to disable tests. | | | | -| | A JSON object groups test options: `command` (default `test:ci`), | | | | -| | `coverage` (`github`, `github-code-quality`, `codecov` or empty), `coverage-reports` (array), `report-group` (outer job ID), and `cache` (one directory relative to working-directory). | | | | -| | Configure report/coverage generation in the Composer script itself. | | | | -| | Coverage is published on the last PHP version only; the command controls collection on every version. Codecov requires id-token: write. | | | | -| | Example: `{"coverage":"codecov","cache":".cache"}`. | | | | -| **`package`** | Validate a public Composer source distribution from the Git repository root. | **false** | **string** | `false` | -| | Pass "false" (the default) to disable, "true" for archive and autoload checks, | | | | -| | or a JSON object with `tests` for additional commands in an isolated Composer consumer. | | | | -| | Quote booleans because this input has type string. Example: `{"tests":"my-cli --help"}`. | | | | -| | vendor/bin is on PATH; PACKAGE_NAME, PACKAGE_INSTALL_PATH and PACKAGE_ARCHIVE_PATH identify the package. | | | | -| | Unknown options and non-string tests are rejected before distribution checks. | | | | -| **`dependency-review`** | Review dependency changes on pull requests. | **false** | **boolean** | `true` | +| **Input** | **Description** | **Required** | **Type** | **Default** | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------------------------------------ | +| **`runs-on`** | JSON array of Linux runner labels. Applies to every job, including the configuration job. | **false** | **string** | `["ubuntu-latest"]` | +| **`checks`** | Enable lint, tests, dependency review and optional distribution checks. | **false** | **boolean** | `true` | +| **`working-directory`** | Composer project directory relative to the checkout. | **false** | **string** | `.` | +| **`php-versions`** | Optional JSON array overriding Composer-based PHP discovery. Empty discovers the newest stable compatible patch per minor. The last version runs lint/package checks and contributes coverage. An empty entry uses the setup action default. | **false** | **string** | - | +| **`extensions`** | PHP extensions forwarded to setup-php. | **false** | **string** | `mbstring, dom, xml, xmlwriter, curl, zip, intl` | +| **`composer-directories`** | Optional JSON array of Composer directories relative to working-directory. Empty installs the root project and tools/composer.json when present, without recursive discovery. | **false** | **string** | - | +| **`ignore-scripts`** | Disable Composer installation scripts. Explicit project commands still run. | **false** | **boolean** | `true` | +| **`ignore-plugins`** | Disable Composer plugins during installation. When false, Composer allow-plugins configuration still applies. | **false** | **boolean** | `true` | +| **`lint`** | Composer lint script name or a JSON object with `command` (default `lint:ci`). Pass "false", "null" or an empty string to disable. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. | **false** | **string** | `true` | +| **`package`** | Validate a public Composer source distribution from the Git repository root. | **false** | **string** | `false` | +| | Pass "false" (the default) to disable, "true" for archive and autoload checks, | | | | +| | or a JSON object with `tests` for additional commands in an isolated Composer consumer. | | | | +| | Quote booleans because this input has type string. Example: `{"tests":"my-cli --help"}`. | | | | +| | vendor/bin is on PATH; PACKAGE_NAME, PACKAGE_INSTALL_PATH and PACKAGE_ARCHIVE_PATH identify the package. | | | | +| | Unknown options and non-string tests are rejected before distribution checks. | | | | +| **`dependency-review`** | Review dependency changes on pull requests. | **false** | **boolean** | `true` | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | **string** | - | + +## Outputs + +| **Output** | **Description** | +| ----------------- | -------------------------------------------------------------------- | +| **`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 fa90c50..6814656 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -310,7 +310,7 @@ jobs: coverage:version === versions.at(-1) && test.coverage ? (test['coverage-reports'].length ? test['coverage-reports'] : [{file:'cobertura.xml',language:'PHP'}]) : []}); 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 fae0ed8..cc8c5e0 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,23 +2,18 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Lint PHP -
- Lint PHP -
- ---- - ## Overview -Run a project-defined Composer lint script and report results. +Run project lint commands and retain native reports for consolidated CI feedback. +The common ci-reports workflow owns comments and external coverage publication. +Forward report-plan from standalone jobs; reusable workflows do this automatically. +Required reports remain required after command failures. This action keeps local +diagnostics and never grants publication permissions to project code. -Native lint reports are retained for seven days, including after command -failures. Only parsed report files are uploaded. Keep `comment: false` and -call the common `ci-reports` workflow after producer jobs for consolidated -comments with collapsed details. +Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. @@ -26,7 +21,7 @@ comments with collapsed details. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@066aee0d473f892c897c35511393ebc54394a4f1 # 2.0.2 +- uses: hoverkraft-tech/ci-github-php/actions/lint@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage with: # Composer project directory. Run setup-php first to install its dependencies. # Default: `.` @@ -48,9 +43,8 @@ comments with collapsed details. # Default: `lint:ci` command: lint:ci - # Publish an individual lint PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. - # Default: `false` - comment: "false" + # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. + report-plan: "" ``` @@ -58,22 +52,22 @@ comments with collapsed details. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | -| **`command`** | Composer script to execute, normally `lint:ci` in composer.json. | **false** | `lint:ci` | -| | Define the tools and their configuration in that script. Examples: | | | -| | | | | -| | - PHPStan: `phpstan analyse --error-format=checkstyle > phpstan-checkstyle.xml` | | | -| | - Psalm: `psalm --output-format=checkstyle > psalm-checkstyle.xml` | | | -| | - PHP_CodeSniffer: `phpcs --report=checkstyle --report-file=phpcs-checkstyle.xml` | | | -| | - PHP CS Fixer: `php-cs-fixer check --format=checkstyle > php-cs-fixer-checkstyle.xml` | | | -| | | | | -| | Redirecting output preserves the tool's exit status. The action discovers | | | -| | Checkstyle reports for annotations and summaries. Use paths relative to the project; | | | -| | for separate tooling installations, prefix binaries with `tools/vendor/bin/`. | | | -| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | -| **`comment`** | Publish an individual lint PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. | **false** | `false` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------ | ------------ | ----------- | +| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | +| **`command`** | Composer script to execute, normally `lint:ci` in composer.json. | **false** | `lint:ci` | +| | Define the tools and their configuration in that script. Examples: | | | +| | | | | +| | - PHPStan: `phpstan analyse --error-format=checkstyle > phpstan-checkstyle.xml` | | | +| | - Psalm: `psalm --output-format=checkstyle > psalm-checkstyle.xml` | | | +| | - PHP_CodeSniffer: `phpcs --report=checkstyle --report-file=phpcs-checkstyle.xml` | | | +| | - PHP CS Fixer: `php-cs-fixer check --format=checkstyle > php-cs-fixer-checkstyle.xml` | | | +| | | | | +| | Redirecting output preserves the tool's exit status. The action discovers | | | +| | Checkstyle reports for annotations and summaries. Use paths relative to the project; | | | +| | for separate tooling installations, prefix binaries with `tools/vendor/bin/`. | | | +| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | - | @@ -82,9 +76,10 @@ comments with collapsed details. ## Outputs -| **Output** | **Description** | -| ------------------------ | ---------------------------------------------------------------------------- | -| **`report-artifact-id`** | Native lint report artifact ID, empty when no supported reports were parsed. | +| **Output** | **Description** | +| ------------------------ | --------------------------------------------------------------------- | +| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | +| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | diff --git a/actions/lint/action.yml b/actions/lint/action.yml index afc30cc..2eec451 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -48,7 +48,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 }} @@ -68,7 +68,7 @@ runs: - id: reports name: Record lint results if: ${{ !cancelled() && 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 2f4bc3b..ead6baa 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,32 +2,19 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test PHP -
- Test PHP -
- ---- - ## Overview -Run Composer tests and report results, optionally uploading coverage. +Run project test commands and retain native reports for consolidated CI feedback. +The common ci-reports workflow owns comments and external coverage publication. +Forward report-plan from standalone jobs; reusable workflows do this automatically. +Required reports remain required after command failures. This action keeps local +diagnostics and never grants publication permissions to project code. -Native test reports and GitHub coverage reports are retained for seven days, -including after command failures. Only parsed report files are uploaded. -Keep `comment: false` and call the common `ci-reports` workflow after producer -jobs for consolidated comments with collapsed details. - -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`. +Coverage publication requires Cobertura XML generated by the test tool. Configure +JUnit or TAP for test results and merge framework shards before recording coverage. @@ -35,7 +22,7 @@ needed in this test action; only the publication job needs `code-quality: write` ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 +- uses: hoverkraft-tech/ci-github-php/actions/test@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage with: # Composer project directory. Run setup-php first to install its dependencies. # Default: `.` @@ -46,32 +33,25 @@ needed in this test action; only the publication job needs `code-quality: write` # # - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` # - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - # - Codeception: `codecept run --xml=junit.xml --coverage-xml=clover.xml`; - # enable coverage in codeception.yml and select `coverage: codecov` for its Clover XML. # - # For Codecov, PHPUnit and Pest can use `--coverage-clover=clover.xml`. - # Omit coverage arguments when collection is not needed. The coverage input controls publication only. + # Generate Cobertura for the consolidated publishing path. A Clover-only + # project must add Cobertura generation before enabling collection. + # Set coverage to false for diagnostic-only tests. Instrumentation and report + # generation remain controlled by the project command. # See the [CI guide](../../.github/workflows/continuous-integration.md). # # Default: `test:ci` command: test:ci - # Native GitHub coverage reports as a JSON array of file, language and optional label. - # Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. + # Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. coverage-reports: "" - # Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. - # Default: `github` - coverage: github - - # Outer calling job ID for consolidated reports. Defaults to the current job ID. - report-group: "" + # Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. + # Default: `true` + coverage: "true" - # Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. - # Default: `false` - comment: "false" + # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. + report-plan: "" ``` @@ -79,27 +59,23 @@ needed in this test action; only the publication job needs `code-quality: write` ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | -| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | -| **`command`** | Composer script to execute unchanged, normally `test:ci` in composer.json. | **false** | `test:ci` | -| | The project defines its test tool, preparation and report generation. Examples: | | | -| | | | | -| | - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | - Codeception: `codecept run --xml=junit.xml --coverage-xml=clover.xml`; | | | -| | enable coverage in codeception.yml and select `coverage: codecov` for its Clover XML. | | | -| | | | | -| | For Codecov, PHPUnit and Pest can use `--coverage-clover=clover.xml`. | | | -| | Omit coverage arguments when collection is not needed. The coverage input controls publication only. | | | -| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | -| **`coverage-reports`** | Native GitHub coverage reports as a JSON array of file, language and optional label. | **false** | - | -| | Empty uses cobertura.xml; 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":"PHP","label":"backend"}]. | | | -| **`coverage`** | Coverage destination: `github` for summaries, `github-code-quality` for native coverage artifacts, `codecov` for OIDC upload, or empty to disable coverage publication. Coverage files must be produced by the test command. | **false** | `github` | -| **`report-group`** | Outer calling job ID for consolidated reports. Defaults to the current job ID. | **false** | - | -| **`comment`** | Publish an individual test and coverage PR comment. Requires pull-requests write permission. Fork comments are disabled. Leave false for consolidated reporting; annotations, summaries and artifacts remain enabled. | **false** | `false` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | +| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | +| **`command`** | Composer script to execute unchanged, normally `test:ci` in composer.json. | **false** | `test:ci` | +| | The project defines its test tool, preparation and report generation. Examples: | | | +| | | | | +| | - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | +| | - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | +| | | | | +| | Generate Cobertura for the consolidated publishing path. A Clover-only | | | +| | project must add Cobertura generation before enabling collection. | | | +| | Set coverage to false for diagnostic-only tests. Instrumentation and report | | | +| | generation remain controlled by the project command. | | | +| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | +| **`coverage-reports`** | Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. | **false** | - | +| **`coverage`** | Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. | **false** | `true` | +| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | - | @@ -108,10 +84,10 @@ needed in this test action; only the publication job needs `code-quality: write` ## Outputs -| **Output** | **Description** | -| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| **`native-coverage-artifact-id`** | Cobertura artifact for native GitHub publication, empty unless github-code-quality is selected. | -| **`report-artifact-id`** | Native report artifact ID, empty when no supported reports were parsed. Coverage is included for `github` and `github-code-quality`. | +| **Output** | **Description** | +| ------------------------ | --------------------------------------------------------------------- | +| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | +| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | diff --git a/actions/test/action.yml b/actions/test/action.yml index 27d2443..2577405 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -61,7 +61,7 @@ runs: script: | if (!['true','false'].includes(process.env.COVERAGE)) throw new Error('coverage must be true or false.'); - 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 }} @@ -80,7 +80,7 @@ runs: - id: reports name: Record test results if: ${{ !cancelled() && 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 d40c4f9ef2e5f6300801f8d739be49d61a40c56b Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:27:21 +0100 Subject: [PATCH 06/33] refactor!: adopt native CI reports and separate completion gate --- .github/linters/actionlint.yml | 2 - .../workflows/__assert-report-artifact.yml | 38 ++++++- .github/workflows/__main-ci.yml | 2 +- .github/workflows/__pull-request-ci.yml | 2 +- .github/workflows/__release.yml | 2 +- .github/workflows/__shared-ci.yml | 58 +++++++++- .../__test-action-get-php-versions.yml | 4 - .github/workflows/__test-action-lint.yml | 18 +-- .github/workflows/__test-action-test.yml | 30 ++--- ...__test-workflow-continuous-integration.yml | 29 ++--- .github/workflows/continuous-integration.md | 85 +++++---------- .github/workflows/continuous-integration.yml | 101 ++++++----------- .gitignore | 3 + Makefile | 3 +- actions/get-php-versions/composer.json | 2 +- actions/lint/README.md | 65 ++++------- actions/lint/action.yml | 94 ++++++++-------- actions/test/README.md | 75 +++++-------- actions/test/action.yml | 103 +++++++++--------- docs/development/README.md | 20 ++-- tests/php-project/composer.json | 4 +- 21 files changed, 339 insertions(+), 401 deletions(-) diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml index 1bb6ca0..cf843da 100644 --- a/.github/linters/actionlint.yml +++ b/.github/linters/actionlint.yml @@ -10,6 +10,4 @@ paths: { 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/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 23dc748..e0e9a62 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -10,14 +10,20 @@ on: description: JSON mapping of expected report filenames to their SHA-256 hashes. required: true type: string + discard-fixture: + description: Remove intentionally failing fixture evidence after validation, so it does not become a real CI finding. + type: boolean + default: false permissions: {} jobs: verify: runs-on: ubuntu-latest + permissions: + actions: write steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -33,11 +39,31 @@ jobs: const path = require('node:path'); const {createHash} = require('node:crypto'); const expected = JSON.parse(process.env.EXPECTED_REPORTS); - const manifest=JSON.parse(fs.readFileSync('downloaded-reports/ci-report.json','utf8')); - const files=manifest.files.filter(file=>!['coverage','attachment'].includes(file.type)).map(file=>path.join('downloaded-reports',file.file)); + const manifest = JSON.parse(fs.readFileSync('downloaded-reports/result.json','utf8')); + assert.equal(manifest.version, 2); + const files = manifest.assets.map(asset => path.join('downloaded-reports',asset.file)); assert.equal(fs.existsSync('downloaded-reports/.private-fixture'),false); - assert.equal(manifest.errors.length > 0,Object.keys(expected).length === 0 || manifest.errors.some(error=>error.includes('parsing'))); + assert.equal(manifest.errors.length > 0, Object.keys(expected).length === 0); assert.deepEqual(files.map(file => path.basename(file)).sort(), Object.keys(expected).sort()); - for (const file of files) { - assert.equal(createHash('sha256').update(fs.readFileSync(file)).digest('hex'), expected[path.basename(file)]); + for (const asset of manifest.assets) { + const bytes = fs.readFileSync(path.join('downloaded-reports',asset.file)); + assert.equal(createHash('sha256').update(bytes).digest('hex'), asset.sha256); + assert.equal(bytes.includes('Must not be uploaded'), false); } + - name: Cleanup - Remove verified negative fixture evidence + if: inputs.discard-fixture + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + ARTIFACT_ID: ${{ inputs.artifact-id }} + with: + script: | + const fs = require('node:fs'); + const assert = require('node:assert/strict'); + const result = JSON.parse(fs.readFileSync('downloaded-reports/result.json','utf8')); + assert.match(result.id, /^[a-f0-9-]{36}$/); + const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {...context.repo,run_id:context.runId,per_page:100}); + const names = [`ci-report-v2-registration-${result.id}`, `ci-report-v2-result-${result.id}`]; + const owned = artifacts.filter(artifact => names.includes(artifact.name)); + assert.equal(owned.length, 2); + assert.ok(owned.some(artifact => String(artifact.id) === process.env.ARTIFACT_ID)); + for (const artifact of owned) await github.rest.actions.deleteArtifact({...context.repo,artifact_id:artifact.id}); diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml index 72a8265..efadac8 100644 --- a/.github/workflows/__main-ci.yml +++ b/.github/workflows/__main-ci.yml @@ -16,7 +16,7 @@ jobs: ci: uses: $/.github/workflows/__shared-ci.yml permissions: - actions: read + actions: write contents: read id-token: write security-events: write diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml index 803905d..e5d49dc 100644 --- a/.github/workflows/__pull-request-ci.yml +++ b/.github/workflows/__pull-request-ci.yml @@ -12,7 +12,7 @@ jobs: ci: uses: $/.github/workflows/__shared-ci.yml permissions: - actions: read + actions: write contents: read id-token: write security-events: write diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml index c057441..625a4fa 100644 --- a/.github/workflows/__release.yml +++ b/.github/workflows/__release.yml @@ -24,7 +24,7 @@ jobs: if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch uses: $/.github/workflows/__shared-ci.yml permissions: - actions: read + actions: write attestations: write contents: read packages: write diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 1834e02..39c5445 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,14 +4,14 @@ on: 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@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # 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: |- @@ -22,6 +22,7 @@ jobs: test-workflow-continuous-integration: uses: $/.github/workflows/__test-workflow-continuous-integration.yml permissions: + actions: read contents: read pull-requests: write id-token: write @@ -29,19 +30,23 @@ jobs: test-action-get-php-versions: uses: $/.github/workflows/__test-action-get-php-versions.yml permissions: + actions: read contents: read id-token: write test-action-setup-php: uses: $/.github/workflows/__test-action-setup-php.yml permissions: + actions: read contents: read test-action-package-test: uses: $/.github/workflows/__test-action-package-test.yml permissions: + actions: read contents: read test-workflow-release: uses: $/.github/workflows/__test-workflow-release.yml permissions: + actions: read contents: read test-action-test: strategy: @@ -50,7 +55,6 @@ jobs: scenario: [ reports, - publication-disabled, preparation, composer-command, failing-command, @@ -61,6 +65,7 @@ jobs: with: scenario: ${{ matrix.scenario }} permissions: + actions: write contents: read pull-requests: write test-action-lint: @@ -72,9 +77,56 @@ jobs: with: scenario: ${{ matrix.scenario }} permissions: + actions: write contents: read pull-requests: write test-workflow-documentation: uses: $/.github/workflows/__test-workflow-documentation.yml permissions: + actions: read + contents: read + + reports: + if: always() + needs: + - linter + - test-workflow-continuous-integration + - test-action-get-php-versions + - test-action-setup-php + - test-action-package-test + - test-workflow-release + - test-action-test + - test-action-lint + - test-workflow-documentation + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # 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) }} + + complete: + name: CI complete + if: always() + needs: + - linter + - test-workflow-continuous-integration + - test-action-get-php-versions + - test-action-setup-php + - test-action-package-test + - test-workflow-release + - test-action-test + - test-action-lint + - test-workflow-documentation + - reports + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: {} + steps: + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + with: + job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-get-php-versions.yml b/.github/workflows/__test-action-get-php-versions.yml index 7d75532..0a63d12 100644 --- a/.github/workflows/__test-action-get-php-versions.yml +++ b/.github/workflows/__test-action-get-php-versions.yml @@ -1,10 +1,6 @@ name: Internal - Test Composer PHP version discovery on: workflow_call: - outputs: - report-plan: - description: Expected native report plan. - value: ${{ jobs.unit.outputs.report-plan }} permissions: {} jobs: unit: diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 8adb01f..7929b74 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -11,6 +11,7 @@ jobs: lint: runs-on: ubuntu-latest permissions: + actions: read contents: read outputs: report-artifact-id: ${{ steps.lint.outputs.report-artifact-id }} @@ -34,7 +35,7 @@ jobs: if (process.env.SCENARIO === 'no-reports') { manifest.scripts['lint:ci'] = 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=github'; } else { - manifest.scripts['lint:ci'] = 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > phpstan-checkstyle.xml'; + manifest.scripts['lint:ci'] = 'tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > "$CI_REPORTS_DIR/phpstan-checkstyle.xml"'; } if (process.env.SCENARIO === 'failure') { const source = '.test-php-lint/src/Sample.php'; @@ -64,24 +65,17 @@ jobs: with: script: | const assert = require('node:assert/strict'); - const fs = require('node:fs'); assert.equal(process.env.OUTCOME, ['failure','no-reports'].includes(process.env.SCENARIO) ? 'failure' : 'success'); - if (process.env.SCENARIO === 'no-reports') { - assert.match(process.env.ARTIFACT_ID, /^\d+$/); - core.setOutput('expected-reports',{}); - return; - } assert.match(process.env.ARTIFACT_ID, /^\d+$/); - const {createHash} = require('node:crypto'); - const report = fs.readFileSync('.test-php-lint/phpstan-checkstyle.xml', 'utf8'); - core.setOutput('expected-reports', {'phpstan-checkstyle.xml': createHash('sha256').update(report).digest('hex')}); - assert.match(report, /'); + file_put_contents(getenv('CI_REPORTS_DIR') . '/junit.xml', ''); `); manifest.scripts['test:ci'] = '@php custom.php'; } if (scenario === 'failing-command') { - manifest.scripts['test:ci'] = ['@test --log-junit=junit.xml --no-coverage', "@php -r 'exit(7);'"]; + manifest.scripts['test:ci'] = ['@test --log-junit="$CI_REPORTS_DIR/junit.xml" --no-coverage', "@php -r 'exit(7);'"]; } if (scenario === 'failing-tests') { const test = path.join(directory, 'tests/SampleTest.php'); @@ -86,24 +87,10 @@ jobs: const directory = process.env.DIRECTORY; const scenario = process.env.SCENARIO; assert.equal(process.env.OUTCOME, (scenario.startsWith('failing-') || scenario === 'no-reports') ? 'failure' : 'success'); - if (scenario === 'no-reports') { - assert.match(process.env.ARTIFACT_ID, /^\d+$/); - core.setOutput('expected-reports',{}); - return; - } assert.match(process.env.ARTIFACT_ID, /^\d+$/); - const {createHash} = require('node:crypto'); - const reportNames = ['junit.xml']; - core.setOutput('expected-reports', Object.fromEntries(reportNames.map(name => [name, createHash('sha256').update(fs.readFileSync(path.join(directory, name))).digest('hex')]))); - const junit = fs.readFileSync(path.join(directory, 'junit.xml'), 'utf8'); - assert.match(junit, /]*\bline-rate=/); - } else { - assert.equal(fs.existsSync(cobertura), false, 'Only the Composer script controls report generation.'); - } + const files = scenario === 'no-reports' ? [] : ['junit.xml']; + if (process.env.COVERAGE === 'true') files.push('cobertura.xml'); + core.setOutput('expected-reports', Object.fromEntries(files.map(name => [name, null]))); if (scenario === 'preparation') { assert.equal(fs.readFileSync(path.join(directory, 'prepared.txt'), 'utf8'), 'ready'); } @@ -112,6 +99,9 @@ jobs: needs: test if: needs.test.outputs.report-artifact-id != '' uses: $/.github/workflows/__assert-report-artifact.yml + permissions: + actions: write with: artifact-id: ${{ needs.test.outputs.report-artifact-id }} expected-reports: ${{ needs.test.outputs.expected-reports }} + discard-fixture: ${{ startsWith(inputs.scenario, 'failing-') || inputs.scenario == 'no-reports' }} diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index dc71a34..b8bd564 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -7,6 +7,7 @@ jobs: name: Assert - Package configuration runs-on: ubuntu-latest permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -59,6 +60,7 @@ jobs: name: Assert - Lint and test configuration runs-on: ubuntu-latest permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -71,7 +73,7 @@ jobs: const assert = require('node:assert/strict'); const fs = require('node:fs'); const workflow = fs.readFileSync('.github/workflows/continuous-integration.yml', 'utf8'); - const step = workflow.split(' - id: config\n')[1]?.split('\n - id: report-plan')[0]; + const step = workflow.split(' - id: config\n')[1]?.split('\n dependency-review:')[0]; const script = step?.split(/ script: \|[-+]?\n/)[1]?.replace(/^ {12}/gm, ''); assert.ok(script, 'Configuration script must exist'); const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; @@ -84,16 +86,16 @@ jobs: return {...outputs, lint: JSON.parse(outputs.lint), test: JSON.parse(outputs.test)}; } const defaults = await parse(); - assert.deepEqual(defaults.lint, {command: 'lint:ci'}); + assert.deepEqual(defaults.lint, {command: 'lint:ci', 'lint-results': '*-checkstyle.xml'}); assert.equal((await parse({LINT: '{"command":"lint:custom"}'})).lint.command, 'lint:custom'); - assert.deepEqual(defaults.test, {command: 'test:ci', coverage: true, cache: '', 'coverage-reports': []}); + assert.deepEqual(defaults.test, {command: 'test:ci', coverage: true, cache: '', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); for (const value of ['', 'false', 'null']) { const config = await parse({LINT: value, TEST: value}); assert.equal(config.lint, null); assert.equal(config.test, null); } const configured = await parse({TEST: '{"command":"test:custom","coverage":false,"cache":".cache"}', VERSIONS: '["8.2", "8.5"]'}); - assert.deepEqual(configured.test, {command: 'test:custom', coverage: false, cache: '.cache', 'coverage-reports': []}); + assert.deepEqual(configured.test, {command: 'test:custom', coverage: false, cache: '.cache', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); assert.equal(configured['primary-version'], '8.5'); assert.equal((await parse({TEST: 'test:custom'})).test.command, 'test:custom'); for (const name of ['LINT', 'TEST']) { @@ -107,10 +109,10 @@ jobs: for (const versions of ['[]', '["8.2","8.2"]', '[8.2]', '["latest"]']) { await assert.rejects(() => parse({VERSIONS: versions})); } - const native = {coverage: true, 'coverage-reports': [{file: 'custom.xml', language: 'PHP', label: 'backend'}]}; + const native = {coverage: true, 'test-coverage': 'custom.xml'}; const nativeConfig = await parse({TEST: JSON.stringify(native)}); for (const [key, value] of Object.entries(native)) assert.deepEqual(nativeConfig.test[key], value); - for (const invalid of [{'coverage-reports': {}}, {'report-group': 'bad/group'}]) { + for (const invalid of [{'test-coverage': {}}, {'report-plan': 'obsolete'}]) { await assert.rejects(() => parse({TEST: JSON.stringify(invalid)})); } core.info('Lint/test configuration checks passed.'); @@ -119,6 +121,7 @@ jobs: name: Act - Validate Composer project uses: $/.github/workflows/continuous-integration.yml permissions: + actions: read contents: read id-token: write with: @@ -130,6 +133,7 @@ jobs: name: Act - Disable checks uses: $/.github/workflows/continuous-integration.yml permissions: + actions: read contents: read id-token: write with: @@ -138,16 +142,3 @@ jobs: lint: must-not-run test: must-not-run package: "true" - - collect-native-coverage: - name: Verify coverage from the primary runtime - needs: act - 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 1093a07..fe9f8d9 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -63,49 +63,29 @@ without installing the project, for example before isolated package checks. ### 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. +Lint and test actions register their expected native reports before execution. +Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. +Tests default to junit.xml plus cobertura.xml. Configure test-results, +test-coverage and lint-results for other native paths. Missing or malformed +required reports fail the producer, including after a successful command. +The highest configured runtime collects coverage; all runtimes retain test results. + +Call common ci-reports once after all producer jobs, with if: always(), all +producers in needs and job-results: toJSON(needs). No report plan or artifact +inventory is forwarded. Publication defaults to annotations for lint and test +results, and GitHub coverage when available, with comment or summary fallback. +Select destinations through lint-reporters, test-results-reporters and +test-coverage-reporters on that one reporting workflow. + +Producers need contents: read and actions: read. The reporting caller needs +actions: read, contents: read, pull-requests: write, code-quality: write, +id-token: write and security-events: write. Publisher jobs receive only their +required permissions and never run project code. + +Add a required CI complete job with if: always(), direct needs on every required +producer and reports, and common actions/check-jobs with job-results: toJSON(needs). +Report completion validates evidence and publication. It can succeed while +displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. ### Generated application files and documentation @@ -156,6 +136,7 @@ responsible for compatibility across every supported PHP version. Release caller ### Permissions +- **`actions`**: `read` - **`contents`**: `read` @@ -172,8 +153,9 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage permissions: + actions: read contents: read with: # JSON array of Linux runner labels. Applies to every job, including the configuration job. @@ -210,7 +192,7 @@ jobs: # Default: `true` lint: "true" - # true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. + # true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. # Default: `true` test: "true" @@ -227,9 +209,6 @@ jobs: # Review dependency changes on pull requests. # Default: `true` dependency-review: true - - # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - report-plan: "" ``` @@ -250,7 +229,7 @@ jobs: | **`ignore-scripts`** | Disable Composer installation scripts. Explicit project commands still run. | **false** | **boolean** | `true` | | **`ignore-plugins`** | Disable Composer plugins during installation. When false, Composer allow-plugins configuration still applies. | **false** | **boolean** | `true` | | **`lint`** | Composer lint script name or a JSON object with `command` (default `lint:ci`). Pass "false", "null" or an empty string to disable. | **false** | **string** | `true` | -| **`test`** | true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. | **false** | **string** | `true` | | **`package`** | Validate a public Composer source distribution from the Git repository root. | **false** | **string** | `false` | | | Pass "false" (the default) to disable, "true" for archive and autoload checks, | | | | | | or a JSON object with `tests` for additional commands in an isolated Composer consumer. | | | | @@ -258,19 +237,11 @@ jobs: | | vendor/bin is on PATH; PACKAGE_NAME, PACKAGE_INSTALL_PATH and PACKAGE_ARCHIVE_PATH identify the package. | | | | | | Unknown options and non-string tests are rejected before distribution checks. | | | | | **`dependency-review`** | Review dependency changes on pull requests. | **false** | **boolean** | `true` | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | **string** | - | - -## Outputs - -| **Output** | **Description** | -| ----------------- | -------------------------------------------------------------------- | -| **`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 6814656..b7a7a63 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -54,49 +54,29 @@ # # ### 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. +# Lint and test actions register their expected native reports before execution. +# Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. +# Tests default to junit.xml plus cobertura.xml. Configure test-results, +# test-coverage and lint-results for other native paths. Missing or malformed +# required reports fail the producer, including after a successful command. +# The highest configured runtime collects coverage; all runtimes retain test results. # -# 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 common ci-reports once after all producer jobs, with if: always(), all +# producers in needs and job-results: toJSON(needs). No report plan or artifact +# inventory is forwarded. Publication defaults to annotations for lint and test +# results, and GitHub coverage when available, with comment or summary fallback. +# Select destinations through lint-reporters, test-results-reporters and +# test-coverage-reporters on that one reporting workflow. # -# Call the common workflow once after producer workflows. It reads their complete -# report plans from `needs`, regardless of calling job names: +# Producers need contents: read and actions: read. The reporting caller needs +# actions: read, contents: read, pull-requests: write, code-quality: write, +# id-token: write and security-events: write. Publisher jobs receive only their +# required permissions and never run project code. # -# ```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. +# Add a required CI complete job with if: always(), direct needs on every required +# producer and reports, and common actions/check-jobs with job-results: toJSON(needs). +# Report completion validates evidence and publication. It can succeed while +# displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. # # ### Generated application files and documentation # @@ -187,7 +167,7 @@ on: default: "true" test: description: |- - true for defaults, a Composer script, or JSON options (command, coverage boolean, coverage-reports array, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. + true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. type: string default: "true" package: @@ -204,19 +184,12 @@ on: description: Review dependency changes on pull requests. type: boolean default: true - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - default: "" - type: string - outputs: - report-plan: - description: Complete expected report plan, consumed automatically by ci-reports. - value: ${{ jobs.configuration.outputs.report-plan }} permissions: {} jobs: configuration: runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: + actions: read contents: read outputs: versions: ${{ steps.config.outputs.versions }} @@ -225,8 +198,6 @@ jobs: test: ${{ steps.config.outputs.test }} package-enabled: ${{ steps.package-config.outputs.enabled }} package-tests: ${{ steps.package-config.outputs.tests }} - report-plan: ${{ steps.report-plan.outputs.report-plan }} - report-selections: ${{ steps.report-plan.outputs.selections }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 if: inputs.checks && inputs.php-versions == '' @@ -293,8 +264,8 @@ jobs: if (!config.command.trim() || config.command.startsWith('-') || /\s/.test(config.command)) throw new Error(name + '.command must name a Composer script.'); return config; } - const lint = options('lint', process.env.LINT, {command: 'lint:ci'}); - const test = options('test', process.env.TEST, {command: 'test:ci', coverage: true, cache: '', 'coverage-reports': []}); + const lint = options('lint', process.env.LINT, {command: 'lint:ci', 'lint-results': '*-checkstyle.xml'}); + const test = options('test', process.env.TEST, {command: 'test:ci', coverage: true, cache: '', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); const cache = test?.cache; if (cache && (cache === '.' || cache.startsWith('/') || cache.includes('\\') || cache.split('/').includes('..') || /[\r\n*?]/.test(cache))) { throw new Error('test.cache must be one directory inside working-directory.'); @@ -302,23 +273,12 @@ jobs: core.setOutput('lint', JSON.stringify(lint)); core.setOutput('test', JSON.stringify(test)); core.setOutput('versions', versions); - core.setOutput('primary-version', versions.at(-1)); - 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:'PHP'}]) : []}); - 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 }} + core.setOutput('primary-version', [...versions].sort((a,b) => a.localeCompare(b, undefined, {numeric:true})).at(-1)); dependency-review: if: inputs.checks && github.event_name == 'pull_request' && inputs.dependency-review runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -331,6 +291,7 @@ jobs: needs: configuration runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -349,12 +310,13 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} - 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 runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: + actions: read contents: read strategy: fail-fast: false @@ -383,14 +345,15 @@ 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) || '' }} + test-results: ${{ fromJSON(needs.configuration.outputs.test).test-results }} + test-coverage: ${{ fromJSON(needs.configuration.outputs.test).test-coverage }} coverage: ${{ matrix.php-version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} - report-plan: ${{ toJSON(fromJSON(needs.configuration.outputs.report-selections)[format('test-{0}', matrix.php-version || 'project')]) }} package: if: inputs.checks && needs.configuration.outputs.package-enabled == 'true' needs: configuration runs-on: ${{ fromJSON(inputs.runs-on) }} permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.gitignore b/.gitignore index b25e815..e046a4d 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ Thumbs.db # Workflow self-reference self-workflow/ + +# Local CI report staging +.cache/ diff --git a/Makefile b/Makefile index 233fab1..2bac405 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ deps-audit: ## Audit action and fixture dependencies done test: ## Run fixture lint and Composer project tests - composer --working-dir=tests/php-project lint:ci + mkdir -p .cache/reports + CI_REPORTS_DIR="$(CURDIR)/.cache/reports" composer --working-dir=tests/php-project lint:ci @set -e; for directory in $(COMPOSER_DIRECTORIES); do \ if php -r 'exit(isset(json_decode(file_get_contents($$argv[1]), true)["scripts"]["test"]) ? 0 : 1);' "$$directory/composer.json"; then \ composer --working-dir="$$directory" test; \ diff --git a/actions/get-php-versions/composer.json b/actions/get-php-versions/composer.json index 57962d1..18bb102 100644 --- a/actions/get-php-versions/composer.json +++ b/actions/get-php-versions/composer.json @@ -17,7 +17,7 @@ }, "scripts": { "test": "phpunit --bootstrap vendor/autoload.php src/PhpVersionsTest.php", - "test:ci": "@test --log-junit=junit.xml --coverage-cobertura=cobertura.xml --coverage-filter=src" + "test:ci": "if [ \"$CI_TEST_COVERAGE\" = true ]; then phpunit --bootstrap vendor/autoload.php src/PhpVersionsTest.php --coverage-filter=src --log-junit=\"$CI_REPORTS_DIR/junit.xml\" --coverage-cobertura=\"$CI_REPORTS_DIR/cobertura.xml\"; else phpunit --bootstrap vendor/autoload.php src/PhpVersionsTest.php --log-junit=\"$CI_REPORTS_DIR/junit.xml\" --no-coverage; fi" }, "config": { "sort-packages": true, diff --git a/actions/lint/README.md b/actions/lint/README.md index cc8c5e0..b8d2332 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -1,19 +1,19 @@ -# ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Lint PHP +# ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Lint PHP ## Overview -Run project lint commands and retain native reports for consolidated CI feedback. -The common ci-reports workflow owns comments and external coverage publication. -Forward report-plan from standalone jobs; reusable workflows do this automatically. -Required reports remain required after command failures. This action keeps local -diagnostics and never grants publication permissions to project code. +Run PHP lint checks, fail on native errors and retain evidence for consolidated reporting. -Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. +Run the project's Composer script and retain validated native reports. +The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor +CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. +Requires actions: read and contents: read. Call ci-reports once after all jobs; +the separate CI complete gate decides whether the whole pipeline succeeded. @@ -21,30 +21,19 @@ Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage with: - # Composer project directory. Run setup-php first to install its dependencies. + # Composer project directory, with its dependencies installed. # Default: `.` working-directory: . - # Composer script to execute, normally `lint:ci` in composer.json. - # Define the tools and their configuration in that script. Examples: - # - # - PHPStan: `phpstan analyse --error-format=checkstyle > phpstan-checkstyle.xml` - # - Psalm: `psalm --output-format=checkstyle > psalm-checkstyle.xml` - # - PHP_CodeSniffer: `phpcs --report=checkstyle --report-file=phpcs-checkstyle.xml` - # - PHP CS Fixer: `php-cs-fixer check --format=checkstyle > php-cs-fixer-checkstyle.xml` - # - # Redirecting output preserves the tool's exit status. The action discovers - # Checkstyle reports for annotations and summaries. Use paths relative to the project; - # for separate tooling installations, prefix binaries with `tools/vendor/bin/`. - # See the [CI guide](../../.github/workflows/continuous-integration.md). - # + # Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. # Default: `lint:ci` command: lint:ci - # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - report-plan: "" + # Required native report paths relative to CI_REPORTS_DIR, one per line. + # Default: `*-checkstyle.xml` + lint-results: "*-checkstyle.xml" ``` @@ -52,22 +41,11 @@ Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------ | ------------ | ----------- | -| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | -| **`command`** | Composer script to execute, normally `lint:ci` in composer.json. | **false** | `lint:ci` | -| | Define the tools and their configuration in that script. Examples: | | | -| | | | | -| | - PHPStan: `phpstan analyse --error-format=checkstyle > phpstan-checkstyle.xml` | | | -| | - Psalm: `psalm --output-format=checkstyle > psalm-checkstyle.xml` | | | -| | - PHP_CodeSniffer: `phpcs --report=checkstyle --report-file=phpcs-checkstyle.xml` | | | -| | - PHP CS Fixer: `php-cs-fixer check --format=checkstyle > php-cs-fixer-checkstyle.xml` | | | -| | | | | -| | Redirecting output preserves the tool's exit status. The action discovers | | | -| | Checkstyle reports for annotations and summaries. Use paths relative to the project; | | | -| | for separate tooling installations, prefix binaries with `tools/vendor/bin/`. | | | -| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | -------------------------------------------------------------------------------- | ------------ | ------------------- | +| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | +| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `lint:ci` | +| **`lint-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `\*-checkstyle.xml` | @@ -76,10 +54,9 @@ Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. ## Outputs -| **Output** | **Description** | -| ------------------------ | --------------------------------------------------------------------- | -| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | -| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | +| **Output** | **Description** | +| ------------------------ | ------------------------------------------------------------------ | +| **`report-artifact-id`** | Native result artifact ID, automatically discovered by ci-reports. | diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 2eec451..27197a3 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -1,45 +1,28 @@ +# Run the project's Composer script and retain validated native reports. +# The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor +# CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. +# Requires actions: read and contents: read. Call ci-reports once after all jobs; +# the separate CI complete gate decides whether the whole pipeline succeeded. name: Lint PHP -description: | - Run project lint commands and retain native reports for consolidated CI feedback. - The common ci-reports workflow owns comments and external coverage publication. - Forward report-plan from standalone jobs; reusable workflows do this automatically. - Required reports remain required after command failures. This action keeps local - diagnostics and never grants publication permissions to project code. - - Generate supported lint reports such as SARIF, ESLint JSON or Checkstyle XML. +description: Run PHP lint checks, fail on native errors and retain evidence for consolidated reporting. author: hoverkraft branding: - icon: package + icon: check-square color: blue inputs: working-directory: - description: Composer project directory. Run setup-php first to install its dependencies. + description: Composer project directory, with its dependencies installed. default: . command: - description: | - Composer script to execute, normally `lint:ci` in composer.json. - Define the tools and their configuration in that script. Examples: - - - PHPStan: `phpstan analyse --error-format=checkstyle > phpstan-checkstyle.xml` - - Psalm: `psalm --output-format=checkstyle > psalm-checkstyle.xml` - - PHP_CodeSniffer: `phpcs --report=checkstyle --report-file=phpcs-checkstyle.xml` - - PHP CS Fixer: `php-cs-fixer check --format=checkstyle > php-cs-fixer-checkstyle.xml` - - Redirecting output preserves the tool's exit status. The action discovers - Checkstyle reports for annotations and summaries. Use paths relative to the project; - for separate tooling installations, prefix binaries with `tools/vendor/bin/`. - See the [CI guide](../../.github/workflows/continuous-integration.md). + description: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. default: lint:ci - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - default: "" + lint-results: + description: Required native report paths relative to CI_REPORTS_DIR, one per line. + default: "*-checkstyle.xml" outputs: report-artifact-id: - description: Native report bundle, including available diagnostics after failures. + description: Native result artifact ID, automatically discovered by ci-reports. value: ${{ steps.reports.outputs.artifact-id }} - report-plan: - description: Expected report metadata. Forward from standalone jobs. - value: ${{ steps.report-plan.outputs.report-plan }} runs: using: composite steps: @@ -47,29 +30,44 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 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) + - id: definition + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + PROJECT: ${{ steps.directory.outputs.workspace-relative-path || '.' }} + COMMAND: ${{ inputs.command }} + RESULTS: ${{ inputs.lint-results }} with: - operation: plan - report-plan: ${{ inputs.report-plan }} - producers: '[{"key":"lint","type":"lint","directory":${{ toJSON(steps.directory.outputs.workspace-relative-path || ''.'') }},"coverage":[]}]' + script: | + const command = process.env.COMMAND.trim(); + if (!command || command.startsWith('-') || /\s/.test(command)) throw new Error('command must name a Composer 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 runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); + core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); + - id: prepare + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + with: + operation: prepare + definition: ${{ steps.definition.outputs.definition }} - id: run uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} COMMAND: ${{ inputs.command }} + CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }} + CI: "true" with: - script: |- - const command = process.env.COMMAND.trim(); - if (!command || command.startsWith('-')) throw new Error('command must name a Composer script.'); - await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', command], { - cwd: process.env.WORKING_DIRECTORY, - }); - - id: reports - name: Record lint results - if: ${{ !cancelled() && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + script: | + await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', process.env.COMMAND.trim()], {cwd:process.env.WORKING_DIRECTORY}); + - 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) 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 ead6baa..591d56d 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -1,20 +1,19 @@ -# ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItcGFja2FnZSIgY29sb3I9ImJsdWUiPjxsaW5lIHgxPSIxNi41IiB5MT0iOS40IiB4Mj0iNy41IiB5Mj0iNC4yMSI+PC9saW5lPjxwYXRoIGQ9Ik0yMSAxNlY4YTIgMiAwIDAgMC0xLTEuNzNsLTctNGEyIDIgMCAwIDAtMiAwbC03IDRBMiAyIDAgMCAwIDMgOHY4YTIgMiAwIDAgMCAxIDEuNzNsNyA0YTIgMiAwIDAgMCAyIDBsNy00QTIgMiAwIDAgMCAyMSAxNnoiPjwvcGF0aD48cG9seWxpbmUgcG9pbnRzPSIzLjI3IDYuOTYgMTIgMTIuMDEgMjAuNzMgNi45NiI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIyMi4wOCIgeDI9IjEyIiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=) GitHub Action: Test PHP +# ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Test PHP ## Overview -Run project test commands and retain native reports for consolidated CI feedback. -The common ci-reports workflow owns comments and external coverage publication. -Forward report-plan from standalone jobs; reusable workflows do this automatically. -Required reports remain required after command failures. This action keeps local -diagnostics and never grants publication permissions to project code. +Run PHP tests, fail on native errors and retain evidence for consolidated reporting. -Coverage publication requires Cobertura XML generated by the test tool. Configure -JUnit or TAP for test results and merge framework shards before recording coverage. +Run the project's Composer script and retain validated native reports. +The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor +CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. +Requires actions: read and contents: read. Call ci-reports once after all jobs; +the separate CI complete gate decides whether the whole pipeline succeeded. @@ -22,36 +21,27 @@ JUnit or TAP for test results and merge framework shards before recording covera ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@f8d7617370279021ecf35ff6fe4e3a72598bc34b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage with: - # Composer project directory. Run setup-php first to install its dependencies. + # Composer project directory, with its dependencies installed. # Default: `.` working-directory: . - # Composer script to execute unchanged, normally `test:ci` in composer.json. - # The project defines its test tool, preparation and report generation. Examples: - # - # - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - # - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - # - # Generate Cobertura for the consolidated publishing path. A Clover-only - # project must add Cobertura generation before enabling collection. - # Set coverage to false for diagnostic-only tests. Instrumentation and report - # generation remain controlled by the project command. - # See the [CI guide](../../.github/workflows/continuous-integration.md). - # + # Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. # Default: `test:ci` command: test:ci - # Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. - coverage-reports: "" + # Required native report paths relative to CI_REPORTS_DIR, one per line. + # Default: `junit.xml` + test-results: junit.xml - # Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. + # Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. # Default: `true` coverage: "true" - # Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - report-plan: "" + # Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. + # Default: `cobertura.xml` + test-coverage: cobertura.xml ``` @@ -59,23 +49,13 @@ JUnit or TAP for test results and merge framework shards before recording covera ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ----------- | -| **`working-directory`** | Composer project directory. Run setup-php first to install its dependencies. | **false** | `.` | -| **`command`** | Composer script to execute unchanged, normally `test:ci` in composer.json. | **false** | `test:ci` | -| | The project defines its test tool, preparation and report generation. Examples: | | | -| | | | | -| | - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` | | | -| | | | | -| | Generate Cobertura for the consolidated publishing path. A Clover-only | | | -| | project must add Cobertura generation before enabling collection. | | | -| | Set coverage to false for diagnostic-only tests. Instrumentation and report | | | -| | generation remain controlled by the project command. | | | -| | See the [CI guide](../../.github/workflows/continuous-integration.md). | | | -| **`coverage-reports`** | Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. | **false** | - | -| **`coverage`** | Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. | **false** | `true` | -| **`report-plan`** | Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. | **false** | - | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------ | ------------ | --------------- | +| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | +| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `test:ci` | +| **`test-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` | +| **`coverage`** | Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. | **false** | `true` | +| **`test-coverage`** | Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. | **false** | `cobertura.xml` | @@ -84,10 +64,9 @@ JUnit or TAP for test results and merge framework shards before recording covera ## Outputs -| **Output** | **Description** | -| ------------------------ | --------------------------------------------------------------------- | -| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. | -| **`report-plan`** | Expected report metadata. Forward from standalone jobs. | +| **Output** | **Description** | +| ------------------------ | ------------------------------------------------------------------ | +| **`report-artifact-id`** | Native result artifact ID, automatically discovered by ci-reports. | diff --git a/actions/test/action.yml b/actions/test/action.yml index 2577405..671a425 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -1,52 +1,34 @@ +# Run the project's Composer script and retain validated native reports. +# The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor +# CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. +# Requires actions: read and contents: read. Call ci-reports once after all jobs; +# the separate CI complete gate decides whether the whole pipeline succeeded. name: Test PHP -description: | - Run project test commands and retain native reports for consolidated CI feedback. - The common ci-reports workflow owns comments and external coverage publication. - Forward report-plan from standalone jobs; reusable workflows do this automatically. - Required reports remain required after command failures. This action keeps local - diagnostics and never grants publication permissions to project code. - - Coverage publication requires Cobertura XML generated by the test tool. Configure - JUnit or TAP for test results and merge framework shards before recording coverage. +description: Run PHP tests, fail on native errors and retain evidence for consolidated reporting. author: hoverkraft branding: - icon: package + icon: check-square color: blue inputs: working-directory: - description: Composer project directory. Run setup-php first to install its dependencies. + description: Composer project directory, with its dependencies installed. default: . command: - description: | - Composer script to execute unchanged, normally `test:ci` in composer.json. - The project defines its test tool, preparation and report generation. Examples: - - - PHPUnit: `phpunit --configuration phpunit.xml --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - - Pest: `pest --ci --log-junit=junit.xml --coverage-cobertura=cobertura.xml` - - Generate Cobertura for the consolidated publishing path. A Clover-only - project must add Cobertura generation before enabling collection. - Set coverage to false for diagnostic-only tests. Instrumentation and report - generation remain controlled by the project command. - See the [CI guide](../../.github/workflows/continuous-integration.md). + description: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. default: test:ci - coverage-reports: - description: |- - Optional JSON array of Cobertura file, language and label. Empty uses the language default; labels default to the project directory. - default: "" + test-results: + description: Required native report paths relative to CI_REPORTS_DIR, one per line. + default: junit.xml coverage: - description: Require Cobertura coverage for consolidated publication. Set false to retain available diagnostics without requiring Cobertura. Configure instrumentation in the test command. + description: Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. default: "true" - report-plan: - description: Expected producer metadata supplied by reusable workflows. Leave empty for standalone use. - default: "" + test-coverage: + description: Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. + default: cobertura.xml outputs: report-artifact-id: - description: Native report bundle, including available diagnostics after failures. + description: Native result artifact ID, automatically discovered by ci-reports. value: ${{ steps.reports.outputs.artifact-id }} - report-plan: - description: Expected report metadata. Forward from standalone jobs. - value: ${{ steps.report-plan.outputs.report-plan }} runs: using: composite steps: @@ -54,34 +36,49 @@ runs: uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 with: working-directory: ${{ inputs.working-directory }} - - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + - id: definition + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: + PROJECT: ${{ steps.directory.outputs.workspace-relative-path || '.' }} + COMMAND: ${{ inputs.command }} + RESULTS: ${{ inputs.test-results }} COVERAGE: ${{ inputs.coverage }} + COVERAGE_PATHS: ${{ inputs.test-coverage }} with: script: | + const command = process.env.COMMAND.trim(); + if (!command || command.startsWith('-') || /\s/.test(command)) throw new Error('command must name a Composer 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 (!['true','false'].includes(process.env.COVERAGE)) throw new Error('coverage must be true or false.'); - - id: report-plan - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + if (process.env.COVERAGE === 'true') reports.push(...paths(process.env.COVERAGE_PATHS).map(pattern => ({kind:'coverage',pattern,language:'PHP'}))); + const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); + core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); + - id: prepare + uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # 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":"PHP"}]'') || ''[]'' }}}]' + operation: prepare + definition: ${{ steps.definition.outputs.definition }} - id: run uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }} COMMAND: ${{ inputs.command }} + CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }} + CI_TEST_COVERAGE: ${{ inputs.coverage }} + CI: "true" with: - script: |- - const command = process.env.COMMAND.trim(); - if (!command || command.startsWith('-')) throw new Error('command must name a Composer script.'); - const args = ['--no-interaction', 'run-script', '--timeout=0', command]; - await exec.exec('composer', args, {cwd: process.env.WORKING_DIRECTORY, env: {...process.env, CI: 'true'}}); - - id: reports - name: Record test results - if: ${{ !cancelled() && steps.report-plan.outcome == 'success' }} - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@11c842902d003cc4ee2fa1d42f6d80bc6828461a # unified reports (PR #683, unreleased) + script: | + await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', process.env.COMMAND.trim()], {cwd:process.env.WORKING_DIRECTORY}); + - 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) 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/docs/development/README.md b/docs/development/README.md index e89022f..63f0923 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -14,16 +14,18 @@ workflow validates Composer metadata and tag identity before publication. `__shared-ci.yml` runs lint, dedicated workflows for each action, and an end-to-end call to the public CI and documentation workflows. The Composer fixture covers automatic and explicit tool installation, lockfile and lockfile-free setup, installation hooks, PHPUnit reports, and PHPStan. -Test-action cases cover Composer-owned report generation, coverage publication, +Test-action cases cover Composer-owned report generation, primary-runtime coverage, preparation, custom commands, and failure propagation. Dedicated lint and test -workflows retrieve native artifacts in dependent jobs after successful or intentionally -failed commands finish. They compare report names and content hashes, check -that hidden project paths work without uploading unrelated files, and verify -empty artifact outputs when no reports are produced. Read-only jobs exercise -the default comment policy; separate jobs verify opt-in comments with collapsed -details. Package integration tests create independent Git -repositories and exercise distribution omissions, consumer commands, archive -immutability, and cleanup. +workflows retrieve native result artifacts after successful or intentionally +failed commands finish. They verify filenames, native checksums, validation errors +and exclusion of private project files. Verified negative fixture evidence is +removed before consolidated reporting; this cleanup is confined to the test harness. + +The actions use common `record-ci-reports`; they neither publish comments nor +forward report plans. One outer `ci-reports` publishes evidence and a separate +`CI complete` job gates every required dependency. Package integration tests create +independent Git repositories and exercise distribution omissions, consumer commands, +archive immutability, and cleanup. Release guard checks live in `__test-workflow-release.yml`. They exercise the actual preparation and publication scripts: event restrictions, no-change status, diff --git a/tests/php-project/composer.json b/tests/php-project/composer.json index d1439ed..7ef23d5 100644 --- a/tests/php-project/composer.json +++ b/tests/php-project/composer.json @@ -19,11 +19,11 @@ } }, "scripts": { - "lint:ci": "tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > phpstan-checkstyle.xml", + "lint:ci": "tools/vendor/bin/phpstan analyse src --level=max --no-progress --error-format=checkstyle > \"$CI_REPORTS_DIR/phpstan-checkstyle.xml\"", "test": "phpunit", "post-install-cmd": "@php -r \"file_put_contents('install-hook.txt', 'hook executed');\"", "post-update-cmd": "@post-install-cmd", - "test:ci": "@test --log-junit=junit.xml --coverage-cobertura=cobertura.xml" + "test:ci": "if [ \"$CI_TEST_COVERAGE\" = true ]; then phpunit --log-junit=\"$CI_REPORTS_DIR/junit.xml\" --coverage-cobertura=\"$CI_REPORTS_DIR/cobertura.xml\"; else phpunit --log-junit=\"$CI_REPORTS_DIR/junit.xml\" --no-coverage; fi" }, "license": "MIT" } From fc8b9101a279aeb2c890f4eac2162cd56ea4e17c Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:27:22 +0100 Subject: [PATCH 07/33] docs: regenerate PHP reporting contracts --- .github/workflows/continuous-integration.md | 2 +- actions/lint/README.md | 2 +- actions/test/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index fe9f8d9..e754638 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -153,7 +153,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage permissions: actions: read contents: read diff --git a/actions/lint/README.md b/actions/lint/README.md index b8d2332..6197916 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index 591d56d..27d6b31 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@c39ce9ed624003554e3fb2f75bd5f3fdf12ec4e6 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` From 98ee75963655434a06b1ffe45a414830e3df86b9 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:41:48 +0100 Subject: [PATCH 08/33] docs: regenerate rebased PHP reporting usage --- .github/workflows/continuous-integration.md | 2 +- actions/lint/README.md | 2 +- actions/test/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index e754638..f1b4d6a 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -153,7 +153,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage permissions: actions: read contents: read diff --git a/actions/lint/README.md b/actions/lint/README.md index 6197916..621310e 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index 27d6b31..c87819c 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@3965c6fe79856f40060609f3c314830c4f2f890b # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` From 352ade244a7f484c86cc8ee68e0f692a9896ee53 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 17:51:09 +0100 Subject: [PATCH 09/33] fix: validate report evidence with scoped fixture cleanup --- .../workflows/__assert-report-artifact.yml | 20 ++++--------------- .github/workflows/__main-ci.yml | 2 +- .github/workflows/__pull-request-ci.yml | 2 +- .github/workflows/__release.yml | 2 +- .github/workflows/__shared-ci.yml | 10 +++++----- .../__test-action-get-php-versions.yml | 2 ++ .github/workflows/__test-action-lint.yml | 2 +- .github/workflows/__test-action-test.yml | 2 +- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 10 files changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index e0e9a62..845b3f2 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -19,11 +19,11 @@ jobs: verify: runs-on: ubuntu-latest permissions: - actions: write + actions: read steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@c0b651dd3d5f9ce5eff49c3c675c1f5c7f2ca581 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,18 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - ARTIFACT_ID: ${{ inputs.artifact-id }} + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: - script: | - const fs = require('node:fs'); - const assert = require('node:assert/strict'); - const result = JSON.parse(fs.readFileSync('downloaded-reports/result.json','utf8')); - assert.match(result.id, /^[a-f0-9-]{36}$/); - const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {...context.repo,run_id:context.runId,per_page:100}); - const names = [`ci-report-v2-registration-${result.id}`, `ci-report-v2-result-${result.id}`]; - const owned = artifacts.filter(artifact => names.includes(artifact.name)); - assert.equal(owned.length, 2); - assert.ok(owned.some(artifact => String(artifact.id) === process.env.ARTIFACT_ID)); - for (const artifact of owned) await github.rest.actions.deleteArtifact({...context.repo,artifact_id:artifact.id}); + artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml index efadac8..72a8265 100644 --- a/.github/workflows/__main-ci.yml +++ b/.github/workflows/__main-ci.yml @@ -16,7 +16,7 @@ jobs: ci: uses: $/.github/workflows/__shared-ci.yml permissions: - actions: write + actions: read contents: read id-token: write security-events: write diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml index e5d49dc..803905d 100644 --- a/.github/workflows/__pull-request-ci.yml +++ b/.github/workflows/__pull-request-ci.yml @@ -12,7 +12,7 @@ jobs: ci: uses: $/.github/workflows/__shared-ci.yml permissions: - actions: write + actions: read contents: read id-token: write security-events: write diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml index 625a4fa..c057441 100644 --- a/.github/workflows/__release.yml +++ b/.github/workflows/__release.yml @@ -24,7 +24,7 @@ jobs: if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch uses: $/.github/workflows/__shared-ci.yml permissions: - actions: write + actions: read attestations: write contents: read packages: write diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 39c5445..2640141 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) permissions: actions: read contents: read @@ -65,7 +65,7 @@ jobs: with: scenario: ${{ matrix.scenario }} permissions: - actions: write + actions: read contents: read pull-requests: write test-action-lint: @@ -77,7 +77,7 @@ jobs: with: scenario: ${{ matrix.scenario }} permissions: - actions: write + actions: read contents: read pull-requests: write test-workflow-documentation: @@ -98,7 +98,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) permissions: actions: read contents: read @@ -127,6 +127,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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-get-php-versions.yml b/.github/workflows/__test-action-get-php-versions.yml index 0a63d12..ce7a1cc 100644 --- a/.github/workflows/__test-action-get-php-versions.yml +++ b/.github/workflows/__test-action-get-php-versions.yml @@ -6,6 +6,7 @@ jobs: unit: uses: $/.github/workflows/continuous-integration.yml permissions: + actions: read contents: read id-token: write with: @@ -15,6 +16,7 @@ jobs: integration: runs-on: ubuntu-latest permissions: + actions: read contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml index 7929b74..ee68a2b 100644 --- a/.github/workflows/__test-action-lint.yml +++ b/.github/workflows/__test-action-lint.yml @@ -74,7 +74,7 @@ jobs: if: needs.lint.outputs.report-artifact-id != '' uses: $/.github/workflows/__assert-report-artifact.yml permissions: - actions: write + actions: read with: artifact-id: ${{ needs.lint.outputs.report-artifact-id }} expected-reports: ${{ needs.lint.outputs.expected-reports }} diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index a8090d5..ea278b9 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -100,7 +100,7 @@ jobs: if: needs.test.outputs.report-artifact-id != '' uses: $/.github/workflows/__assert-report-artifact.yml permissions: - actions: write + actions: read with: artifact-id: ${{ needs.test.outputs.report-artifact-id }} expected-reports: ${{ needs.test.outputs.expected-reports }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 27197a3..c2ad0bf 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -66,7 +66,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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 671a425..a435f06 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: operation: prepare definition: ${{ steps.definition.outputs.definition }} @@ -77,7 +77,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@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) with: operation: finalize recording: ${{ steps.prepare.outputs.recording }} From 23dac6c2caf2e4c01b76eb95519b6e2a0d02d3b6 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 18:03:20 +0100 Subject: [PATCH 10/33] fix: expand report paths in Composer fixture commands --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- .github/workflows/__test-action-test.yml | 4 ++-- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 845b3f2..e9b3093 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 2640141..a5a125b 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) permissions: actions: read contents: read @@ -98,7 +98,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) permissions: actions: read contents: read @@ -127,6 +127,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@8bcd5c4a445628d0c5d21666bef3db2d494efd03 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml index ea278b9..000ea6e 100644 --- a/.github/workflows/__test-action-test.yml +++ b/.github/workflows/__test-action-test.yml @@ -38,7 +38,7 @@ jobs: const scenario = process.env.SCENARIO; if (scenario === 'preparation') { await fs.writeFile(path.join(directory, 'prepare.php'), ' Date: Sat, 28 Nov 2026 18:06:31 +0100 Subject: [PATCH 11/33] ci: validate the final shared reporting contract --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index e9b3093..9c18b29 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index a5a125b..b8f3206 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: permissions: {} jobs: linter: - uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) permissions: actions: read contents: read @@ -98,7 +98,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/workflows/ci-reports.yml@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) permissions: actions: read contents: read @@ -127,6 +127,6 @@ jobs: timeout-minutes: 5 permissions: {} steps: - - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@24f2afc2ecc7a7a70021600055217d25fc102f88 # PR #683 (unreleased) + - uses: hoverkraft-tech/ci-github-common/actions/check-jobs@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) with: job-results: ${{ toJSON(needs) }} diff --git a/actions/lint/action.yml b/actions/lint/action.yml index aaa5910..7a3b281 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@24f2afc2ecc7a7a70021600055217d25fc102f88 # 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 }} @@ -66,7 +66,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@24f2afc2ecc7a7a70021600055217d25fc102f88 # 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 33e6d11..71fa574 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - id: prepare - uses: hoverkraft-tech/ci-github-common/actions/quality/record-ci-reports@24f2afc2ecc7a7a70021600055217d25fc102f88 # 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 }} @@ -77,7 +77,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@24f2afc2ecc7a7a70021600055217d25fc102f88 # 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 abf347814ba6587e23db35c7517cd58d6fa6a6fe Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 18:09:44 +0100 Subject: [PATCH 12/33] docs: identify the pinned Composer cache action release --- actions/setup-php/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/setup-php/action.yml b/actions/setup-php/action.yml index 54d7688..576125c 100644 --- a/actions/setup-php/action.yml +++ b/actions/setup-php/action.yml @@ -108,7 +108,7 @@ runs: core.setOutput('directories', resolved); core.setOutput('cache', cache.stdout.trim()); core.setOutput('php-version', php.stdout.trim()); - - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ${{ steps.configuration.outputs.cache }} key: composer-${{ runner.os }}-${{ steps.configuration.outputs.php-version }}-${{ hashFiles(format('{0}/**/composer.json', inputs.working-directory), format('{0}/**/composer.lock', inputs.working-directory)) }} From d1d31ff5aee78ad29fb51c5afe7563d8ba3c385e Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sat, 28 Nov 2026 18:11:01 +0100 Subject: [PATCH 13/33] ci: remove obsolete test comment permissions --- .github/workflows/__shared-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index b8f3206..32ce713 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -67,7 +67,6 @@ jobs: permissions: actions: read contents: read - pull-requests: write test-action-lint: strategy: fail-fast: false @@ -79,7 +78,6 @@ jobs: permissions: actions: read contents: read - pull-requests: write test-workflow-documentation: uses: $/.github/workflows/__test-workflow-documentation.yml permissions: From 0c8344635d8ea2ac197cd88a1e3b2de6a79ebb72 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 09:46:25 +0100 Subject: [PATCH 14/33] fix(ci): adopt external coverage comment ownership --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 9c18b29..6fa2348 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@a0bdfab27afed208f3c105e4b543818b8388b80b # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 32ce713..678e5d0 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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 7a3b281..261e0fe 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 71fa574..ccfdd0d 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 03e4914101bd4a918bf1191e9e103792cd2a3883 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 11:11:58 +0100 Subject: [PATCH 15/33] ci: adopt actionable reports and stable coverage project flags --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 6fa2348..a1a041c 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@4043eb6a440b21812c3d92d78bd6d019713326b2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 678e5d0..568b11a 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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 261e0fe..568dd4e 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index ccfdd0d..3ef8f13 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 d654166036093bc6450bd83e24427d5666c90c7c Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 11:21:40 +0100 Subject: [PATCH 16/33] ci: update validated reporting implementation --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index a1a041c..1a8cb47 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@2a3dd6d8dd3627bd074c5dfe3228500be6b08892 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 568b11a..45fa612 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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 568dd4e..3623931 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 3ef8f13..d87f837 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 0babdc81767438579d4c758b17fbeb508a234fee Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:21:14 +0100 Subject: [PATCH 17/33] ci: use the corrected Common reporting actions --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 1a8cb47..a7d1ef1 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/.github/actions/discard-report-fixtures@c8399518df2fa64a6e163169a747765b9271e6c8 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 45fa612..d8f2006 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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 3623931..ea6e572 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index d87f837..ef55972 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 f62e2367ea27f284506486501ef4c040723136d9 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:21:16 +0100 Subject: [PATCH 18/33] docs: refresh reporting action references --- actions/lint/README.md | 8 +++++++- actions/test/README.md | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/actions/lint/README.md b/actions/lint/README.md index 621310e..6cc5587 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,6 +2,12 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Lint PHP +
+ Lint PHP +
+ +--- + @@ -21,7 +27,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index c87819c..8e7f7d8 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,6 +2,12 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Test PHP +
+ Test PHP +
+ +--- + @@ -21,7 +27,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 with: # Composer project directory, with its dependencies installed. # Default: `.` From 644ef6e161a00f5e7a124cef67d37e911e2d1639 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 19:34:39 +0100 Subject: [PATCH 19/33] 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 6cc5587..e01092f 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -27,7 +27,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 +- uses: hoverkraft-tech/ci-github-php/actions/lint@f62e2367ea27f284506486501ef4c040723136d9 with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/README.md b/actions/test/README.md index 8e7f7d8..540cc1d 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -27,7 +27,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@63aed766521b3b3bff31c4d36f59b2916e90a361 # 2.0.3 +- uses: hoverkraft-tech/ci-github-php/actions/test@f62e2367ea27f284506486501ef4c040723136d9 with: # Composer project directory, with its dependencies installed. # Default: `.` From 8ccc340e302f24ca922ddd30dfd0522dfc48f612 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Sun, 29 Nov 2026 20:47:18 +0100 Subject: [PATCH 20/33] ci: use bundled Node.js coverage conversion --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index a7d1ef1..2ecdf5a 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@0ac3dea66244dd619d6c80643958d60b886c4c02 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index d8f2006..f2cb089 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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 ea6e572..c55e793 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index ef55972..60f7047 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 779dfb4fcfd0c4c1a6ceb7cf819dfefe2dfac0d4 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 12:13:48 +0100 Subject: [PATCH 21/33] ci: validate composed report actions --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 2ecdf5a..a2d1b04 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@a34ef0cefdef3b1e68a61cea52aae223f06f35e7 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index f2cb089..f5217f9 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/action.yml b/actions/lint/action.yml index c55e793..b15b991 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 60f7047..5b70dd8 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 07564f97638fa81ca9f9912432c8c722b61a0282 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 13:43:21 +0100 Subject: [PATCH 22/33] refactor(ci): adopt standalone report publication actions --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index a2d1b04..67ec0a4 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@95dfb5620ba01b459bcca619eccd0acbad871a8a # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index f5217f9..26d9dad 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/action.yml b/actions/lint/action.yml index b15b991..7b10286 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 5b70dd8..65beaef 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 96efe75fae6609eba263d3bc6489f7a8173dbcee Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 14:01:27 +0100 Subject: [PATCH 23/33] refactor(ci): adopt standalone report publication actions --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/action.yml | 4 ++-- actions/test/action.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 67ec0a4..41ccc4a 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -52,6 +52,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@0dbf8c312048a8d354e1b0bab3e90627114c6faa # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 26d9dad..34dfb2a 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/action.yml b/actions/lint/action.yml index 7b10286..5f6073a 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -49,7 +49,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -66,7 +66,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 }} diff --git a/actions/test/action.yml b/actions/test/action.yml index 65beaef..34a95a7 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -59,7 +59,7 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 }} @@ -77,7 +77,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 8b029e1af12ad5662f94537dcdd4cfe5f5040e41 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 17:15:26 +0100 Subject: [PATCH 24/33] refactor(reports)!: compose common report preparation --- .../workflows/__assert-report-artifact.yml | 18 +++++------ .github/workflows/__shared-ci.yml | 6 ++-- actions/lint/README.md | 27 +--------------- actions/lint/action.yml | 26 +++++++++------ actions/test/README.md | 27 +--------------- actions/test/action.yml | 32 ++++++++++++------- docs/development/README.md | 2 +- 7 files changed, 52 insertions(+), 86 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 41ccc4a..408d493 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -37,21 +37,19 @@ jobs: const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); - const {createHash} = require('node:crypto'); const expected = JSON.parse(process.env.EXPECTED_REPORTS); - const manifest = JSON.parse(fs.readFileSync('downloaded-reports/result.json','utf8')); - assert.equal(manifest.version, 2); - const files = manifest.assets.map(asset => path.join('downloaded-reports',asset.file)); + const manifest = JSON.parse(fs.readFileSync('downloaded-reports/report.json','utf8')); + assert.equal(manifest.version, 1); + const files = fs.existsSync('downloaded-reports/native') ? fs.readdirSync('downloaded-reports/native').map(file => path.join('downloaded-reports/native', file)) : []; assert.equal(fs.existsSync('downloaded-reports/.private-fixture'),false); assert.equal(manifest.errors.length > 0, Object.keys(expected).length === 0); - assert.deepEqual(files.map(file => path.basename(file)).sort(), Object.keys(expected).sort()); - for (const asset of manifest.assets) { - const bytes = fs.readFileSync(path.join('downloaded-reports',asset.file)); - assert.equal(createHash('sha256').update(bytes).digest('hex'), asset.sha256); + assert.deepEqual(files.map(file => path.basename(file).replace(/^\d+-/, '')).sort(), Object.keys(expected).sort()); + for (const file of files) { + const bytes = fs.readFileSync(file); assert.equal(bytes.includes('Must not be uploaded'), false); } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@2d27a658505a68fba050c44cb6a6d4d08a45e8f2 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 34dfb2a..087ba0b 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/README.md b/actions/lint/README.md index e01092f..798eb60 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Lint PHP -
- Lint PHP -
- ---- - @@ -27,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@f62e2367ea27f284506486501ef4c040723136d9 +- uses: hoverkraft-tech/ci-github-php/actions/lint@96efe75fae6609eba263d3bc6489f7a8173dbcee # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` @@ -69,35 +63,16 @@ the separate CI complete gate decides whether the whole pipeline succeeded. [![Marketplace](https://img.shields.io/badge/Marketplace-lint--php-blue?logo=github-actions)](https://github.com/marketplace/actions/lint-php) [![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-php)](https://github.com/hoverkraft-tech/ci-github-php/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-php)](http://choosealicense.com/licenses/mit/) [![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-php?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-php?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-php/blob/main/CONTRIBUTING.md) -![GitHub Verified Creator](https://img.shields.io/badge/GitHub-Verified%20Creator-4493F8?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJyZ2IoNjgsIDE0NywgMjQ4KSI+CiAgPHBhdGggZD0ibTkuNTg1LjUyLjkyOS42OGMuMTUzLjExMi4zMzEuMTg2LjUxOC4yMTVsMS4xMzguMTc1YTIuNjc4IDIuNjc4IDAgMCAxIDIuMjQgMi4yNGwuMTc0IDEuMTM5Yy4wMjkuMTg3LjEwMy4zNjUuMjE1LjUxOGwuNjguOTI4YTIuNjc3IDIuNjc3IDAgMCAxIDAgMy4xN2wtLjY4LjkyOGExLjE3NCAxLjE3NCAwIDAgMC0uMjE1LjUxOGwtLjE3NSAxLjEzOGEyLjY3OCAyLjY3OCAwIDAgMS0yLjI0MSAyLjI0MWwtMS4xMzguMTc1YTEuMTcgMS4xNyAwIDAgMC0uNTE4LjIxNWwtLjkyOC42OGEyLjY3NyAyLjY3NyAwIDAgMS0zLjE3IDBsLS45MjgtLjY4YTEuMTc0IDEuMTc0IDAgMCAwLS41MTgtLjIxNUwzLjgzIDE0LjQxYTIuNjc4IDIuNjc4IDAgMCAxLTIuMjQtMi4yNGwtLjE3NS0xLjEzOGExLjE3IDEuMTcgMCAwIDAtLjIxNS0uNTE4bC0uNjgtLjkyOGEyLjY3NyAyLjY3NyAwIDAgMSAwLTMuMTdsLjY4LS45MjhjLjExMi0uMTUzLjE4Ni0uMzMxLjIxNS0uNTE4bC4xNzUtMS4xNGEyLjY3OCAyLjY3OCAwIDAgMSAyLjI0LTIuMjRsMS4xMzktLjE3NWMuMTg3LS4wMjkuMzY1LS4xMDMuNTE4LS4yMTVsLjkyOC0uNjhhMi42NzcgMi42NzcgMCAwIDEgMy4xNyAwWk03LjMwMyAxLjcyOGwtLjkyNy42OGEyLjY3IDIuNjcgMCAwIDEtMS4xOC40ODlsLTEuMTM3LjE3NGExLjE3OSAxLjE3OSAwIDAgMC0uOTg3Ljk4N2wtLjE3NCAxLjEzNmEyLjY3NyAyLjY3NyAwIDAgMS0uNDg5IDEuMThsLS42OC45MjhhMS4xOCAxLjE4IDAgMCAwIDAgMS4zOTRsLjY4LjkyN2MuMjU2LjM0OC40MjQuNzUzLjQ4OSAxLjE4bC4xNzQgMS4xMzdjLjA3OC41MDkuNDc4LjkwOS45ODcuOTg3bDEuMTM2LjE3NGEyLjY3IDIuNjcgMCAwIDEgMS4xOC40ODlsLjkyOC42OGMuNDE0LjMwNS45NzkuMzA1IDEuMzk0IDBsLjkyNy0uNjhhMi42NyAyLjY3IDAgMCAxIDEuMTgtLjQ4OWwxLjEzNy0uMTc0YTEuMTggMS4xOCAwIDAgMCAuOTg3LS45ODdsLjE3NC0xLjEzNmEyLjY3IDIuNjcgMCAwIDEgLjQ4OS0xLjE4bC42OC0uOTI4YTEuMTc2IDEuMTc2IDAgMCAwIDAtMS4zOTRsLS42OC0uOTI3YTIuNjg2IDIuNjg2IDAgMCAxLS40ODktMS4xOGwtLjE3NC0xLjEzN2ExLjE3OSAxLjE3OSAwIDAgMC0uOTg3LS45ODdsLTEuMTM2LS4xNzRhMi42NzcgMi42NzcgMCAwIDEtMS4xOC0uNDg5bC0uOTI4LS42OGExLjE3NiAxLjE3NiAwIDAgMC0xLjM5NCAwWk0xMS4yOCA2Ljc4bC0zLjc1IDMuNzVhLjc1Ljc1IDAgMCAxLTEuMDYgMEw0LjcyIDguNzhhLjc1MS43NTEgMCAwIDEgLjAxOC0xLjA0Mi43NTEuNzUxIDAgMCAxIDEuMDQyLS4wMThMNyA4Ljk0bDMuMjItMy4yMmEuNzUxLjc1MSAwIDAgMSAxLjA0Mi4wMTguNzUxLjc1MSAwIDAgMSAuMDE4IDEuMDQyWiI+PC9wYXRoPgo8L3N2Zz4K) - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-php/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 5f6073a..6f44385 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -4,7 +4,8 @@ # Requires actions: read and contents: read. Call ci-reports once after all jobs; # the separate CI complete gate decides whether the whole pipeline succeeded. name: Lint PHP -description: Run PHP lint checks, fail on native errors and retain evidence for consolidated reporting. +description: Run PHP lint checks, fail on native errors and retain evidence for + consolidated reporting. author: hoverkraft branding: icon: check-square @@ -14,7 +15,9 @@ inputs: description: Composer project directory, with its dependencies installed. default: . command: - description: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. + description: + Composer script to execute unchanged. Write native reports under + CI_REPORTS_DIR. default: lint:ci lint-results: description: Required native report paths relative to CI_REPORTS_DIR, one per line. @@ -49,10 +52,15 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -63,11 +71,11 @@ runs: with: script: | await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', process.env.COMMAND.trim()], {cwd:process.env.WORKING_DIRECTORY}); - - name: Validate and retain native reports + - 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/actions/test/README.md b/actions/test/README.md index 540cc1d..d57f71f 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -2,12 +2,6 @@ # ![Icon](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY2hlY2stc3F1YXJlIiBjb2xvcj0iYmx1ZSI+PHBvbHlsaW5lIHBvaW50cz0iOSAxMSAxMiAxNCAyMiA0Ij48L3BvbHlsaW5lPjxwYXRoIGQ9Ik0yMSAxMnY3YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjVhMiAyIDAgMCAxIDItMmgxMSI+PC9wYXRoPjwvc3ZnPg==) GitHub Action: Test PHP -
- Test PHP -
- ---- - @@ -27,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@f62e2367ea27f284506486501ef4c040723136d9 +- uses: hoverkraft-tech/ci-github-php/actions/test@96efe75fae6609eba263d3bc6489f7a8173dbcee # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` @@ -79,35 +73,16 @@ the separate CI complete gate decides whether the whole pipeline succeeded. [![Marketplace](https://img.shields.io/badge/Marketplace-test--php-blue?logo=github-actions)](https://github.com/marketplace/actions/test-php) [![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-php)](https://github.com/hoverkraft-tech/ci-github-php/releases) -[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-php)](http://choosealicense.com/licenses/mit/) [![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-php?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-php?style=social) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-php/blob/main/CONTRIBUTING.md) -![GitHub Verified Creator](https://img.shields.io/badge/GitHub-Verified%20Creator-4493F8?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJyZ2IoNjgsIDE0NywgMjQ4KSI+CiAgPHBhdGggZD0ibTkuNTg1LjUyLjkyOS42OGMuMTUzLjExMi4zMzEuMTg2LjUxOC4yMTVsMS4xMzguMTc1YTIuNjc4IDIuNjc4IDAgMCAxIDIuMjQgMi4yNGwuMTc0IDEuMTM5Yy4wMjkuMTg3LjEwMy4zNjUuMjE1LjUxOGwuNjguOTI4YTIuNjc3IDIuNjc3IDAgMCAxIDAgMy4xN2wtLjY4LjkyOGExLjE3NCAxLjE3NCAwIDAgMC0uMjE1LjUxOGwtLjE3NSAxLjEzOGEyLjY3OCAyLjY3OCAwIDAgMS0yLjI0MSAyLjI0MWwtMS4xMzguMTc1YTEuMTcgMS4xNyAwIDAgMC0uNTE4LjIxNWwtLjkyOC42OGEyLjY3NyAyLjY3NyAwIDAgMS0zLjE3IDBsLS45MjgtLjY4YTEuMTc0IDEuMTc0IDAgMCAwLS41MTgtLjIxNUwzLjgzIDE0LjQxYTIuNjc4IDIuNjc4IDAgMCAxLTIuMjQtMi4yNGwtLjE3NS0xLjEzOGExLjE3IDEuMTcgMCAwIDAtLjIxNS0uNTE4bC0uNjgtLjkyOGEyLjY3NyAyLjY3NyAwIDAgMSAwLTMuMTdsLjY4LS45MjhjLjExMi0uMTUzLjE4Ni0uMzMxLjIxNS0uNTE4bC4xNzUtMS4xNGEyLjY3OCAyLjY3OCAwIDAgMSAyLjI0LTIuMjRsMS4xMzktLjE3NWMuMTg3LS4wMjkuMzY1LS4xMDMuNTE4LS4yMTVsLjkyOC0uNjhhMi42NzcgMi42NzcgMCAwIDEgMy4xNyAwWk03LjMwMyAxLjcyOGwtLjkyNy42OGEyLjY3IDIuNjcgMCAwIDEtMS4xOC40ODlsLTEuMTM3LjE3NGExLjE3OSAxLjE3OSAwIDAgMC0uOTg3Ljk4N2wtLjE3NCAxLjEzNmEyLjY3NyAyLjY3NyAwIDAgMS0uNDg5IDEuMThsLS42OC45MjhhMS4xOCAxLjE4IDAgMCAwIDAgMS4zOTRsLjY4LjkyN2MuMjU2LjM0OC40MjQuNzUzLjQ4OSAxLjE4bC4xNzQgMS4xMzdjLjA3OC41MDkuNDc4LjkwOS45ODcuOTg3bDEuMTM2LjE3NGEyLjY3IDIuNjcgMCAwIDEgMS4xOC40ODlsLjkyOC42OGMuNDE0LjMwNS45NzkuMzA1IDEuMzk0IDBsLjkyNy0uNjhhMi42NyAyLjY3IDAgMCAxIDEuMTgtLjQ4OWwxLjEzNy0uMTc0YTEuMTggMS4xOCAwIDAgMCAuOTg3LS45ODdsLjE3NC0xLjEzNmEyLjY3IDIuNjcgMCAwIDEgLjQ4OS0xLjE4bC42OC0uOTI4YTEuMTc2IDEuMTc2IDAgMCAwIDAtMS4zOTRsLS42OC0uOTI3YTIuNjg2IDIuNjg2IDAgMCAxLS40ODktMS4xOGwtLjE3NC0xLjEzN2ExLjE3OSAxLjE3OSAwIDAgMC0uOTg3LS45ODdsLTEuMTM2LS4xNzRhMi42NzcgMi42NzcgMCAwIDEtMS4xOC0uNDg5bC0uOTI4LS42OGExLjE3NiAxLjE3NiAwIDAgMC0xLjM5NCAwWk0xMS4yOCA2Ljc4bC0zLjc1IDMuNzVhLjc1Ljc1IDAgMCAxLTEuMDYgMEw0LjcyIDguNzhhLjc1MS43NTEgMCAwIDEgLjAxOC0xLjA0Mi43NTEuNzUxIDAgMCAxIDEuMDQyLS4wMThMNyA4Ljk0bDMuMjItMy4yMmEuNzUxLjc1MSAwIDAgMSAxLjA0Mi4wMTguNzUxLjc1MSAwIDAgMSAuMDE4IDEuMDQyWiI+PC9wYXRoPgo8L3N2Zz4K) - -## Contributing - -Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-php/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 34a95a7..bf5c460 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -4,7 +4,8 @@ # Requires actions: read and contents: read. Call ci-reports once after all jobs; # the separate CI complete gate decides whether the whole pipeline succeeded. name: Test PHP -description: Run PHP tests, fail on native errors and retain evidence for consolidated reporting. +description: Run PHP tests, fail on native errors and retain evidence for + consolidated reporting. author: hoverkraft branding: icon: check-square @@ -14,16 +15,20 @@ inputs: description: Composer project directory, with its dependencies installed. default: . command: - description: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. + description: + Composer script to execute unchanged. Write native reports under + CI_REPORTS_DIR. default: test:ci test-results: description: Required native report paths relative to CI_REPORTS_DIR, one per line. default: junit.xml coverage: - description: Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. + description: Require test coverage. The project command must honor + CI_TEST_COVERAGE when selecting instrumentation. default: "true" test-coverage: - description: Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. + description: Required native coverage paths relative to CI_REPORTS_DIR when + coverage is enabled, one per line. default: cobertura.xml outputs: report-artifact-id: @@ -59,10 +64,15 @@ runs: const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - 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 uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: @@ -74,11 +84,11 @@ runs: with: script: | await exec.exec('composer', ['--no-interaction', 'run-script', '--timeout=0', process.env.COMMAND.trim()], {cwd:process.env.WORKING_DIRECTORY}); - - name: Validate and retain native reports + - 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 63f0923..5a71b73 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -21,7 +21,7 @@ failed commands finish. They verify filenames, native checksums, validation erro and exclusion of private project files. Verified negative fixture evidence is removed before consolidated reporting; this cleanup is confined to the test harness. -The actions use common `record-ci-reports`; they neither publish comments nor +The actions use common `prepare-ci-reports`; they neither publish comments nor forward report plans. One outer `ci-reports` publishes evidence and a separate `CI complete` job gates every required dependency. Package integration tests create independent Git repositories and exercise distribution omissions, consumer commands, From e2a32934f02f252cac2cd969f4ca1389c2ad1c1e Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 18:31:08 +0100 Subject: [PATCH 25/33] fix(reports): align artifacts with validated common publication --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 408d493..10a5e3e 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -50,6 +50,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@2654703ceb0e0e04f240e8582f4b810bd1738f8d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 087ba0b..aff73a6 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/README.md b/actions/lint/README.md index 798eb60..5709a56 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@96efe75fae6609eba263d3bc6489f7a8173dbcee # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@8b029e1af12ad5662f94537dcdd4cfe5f5040e41 # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 6f44385..70a5edf 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -74,7 +74,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 }} diff --git a/actions/test/README.md b/actions/test/README.md index d57f71f..293cf10 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@96efe75fae6609eba263d3bc6489f7a8173dbcee # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@8b029e1af12ad5662f94537dcdd4cfe5f5040e41 # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index bf5c460..595c320 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -87,7 +87,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 8d512be0827165a4004d50137d185d6fb50404a8 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 18:57:42 +0100 Subject: [PATCH 26/33] fix(reports): adopt file-safe coverage and bounded publication --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index 10a5e3e..c624168 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -50,6 +50,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@ae467050dbd6e92f8072b2dc9e898bc78d093e7d # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index aff73a6..360367d 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/README.md b/actions/lint/README.md index 5709a56..852d44b 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@8b029e1af12ad5662f94537dcdd4cfe5f5040e41 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@e2a32934f02f252cac2cd969f4ca1389c2ad1c1e # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 70a5edf..449523a 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -74,7 +74,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 }} diff --git a/actions/test/README.md b/actions/test/README.md index 293cf10..40c7a10 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@8b029e1af12ad5662f94537dcdd4cfe5f5040e41 # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@e2a32934f02f252cac2cd969f4ca1389c2ad1c1e # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 595c320..5492115 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -87,7 +87,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 846c33869d840fe0da5d4d717e0992d14feecc37 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 19:27:32 +0100 Subject: [PATCH 27/33] fix(reports): update common reporting dependency --- .github/workflows/__assert-report-artifact.yml | 4 ++-- .github/workflows/__shared-ci.yml | 6 +++--- actions/lint/README.md | 2 +- actions/lint/action.yml | 2 +- actions/test/README.md | 2 +- actions/test/action.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index c624168..ddc0291 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -50,6 +50,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@58e2dc7aef918536d5c801d9ec2032694ce586d1 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index 360367d..b0a3887 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -125,6 +125,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/actions/lint/README.md b/actions/lint/README.md index 852d44b..35d4475 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/lint@e2a32934f02f252cac2cd969f4ca1389c2ad1c1e # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/lint@8d512be0827165a4004d50137d185d6fb50404a8 # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/lint/action.yml b/actions/lint/action.yml index 449523a..ec7b940 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -74,7 +74,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 }} diff --git a/actions/test/README.md b/actions/test/README.md index 40c7a10..0cbf05f 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -21,7 +21,7 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Usage ```yaml -- uses: hoverkraft-tech/ci-github-php/actions/test@e2a32934f02f252cac2cd969f4ca1389c2ad1c1e # feat/native-github-coverage +- uses: hoverkraft-tech/ci-github-php/actions/test@8d512be0827165a4004d50137d185d6fb50404a8 # feat/native-github-coverage with: # Composer project directory, with its dependencies installed. # Default: `.` diff --git a/actions/test/action.yml b/actions/test/action.yml index 5492115..ac31554 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -87,7 +87,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 a9edb3cddd5eb38e43dc65b38fc55cc60ef3f100 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 30 Nov 2026 19:41:14 +0100 Subject: [PATCH 28/33] fix(ci): handle delayed fixture artifact lookup --- .github/workflows/__assert-report-artifact.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index ddc0291..ab61129 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -50,6 +50,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@1885f0a6b433228e28c0ea7df8d41bd5e2c24665 # PR #683 (unreleased) with: artifact-ids: ${{ inputs.artifact-id }} From 86a19795cc53dccc5843942f0db4d52b306dcede Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 09:26:37 +0100 Subject: [PATCH 29/33] refactor(ci): call shared completion workflow --- .github/workflows/__shared-ci.yml | 9 +++------ .github/workflows/continuous-integration.md | 10 ++++++++-- .github/workflows/continuous-integration.yml | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index b0a3887..9566520 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -121,10 +121,7 @@ jobs: - test-action-lint - test-workflow-documentation - 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/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index f1b4d6a..9947be6 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -2,6 +2,12 @@ # GitHub Reusable Workflow: Continuous integration +
+ Continuous integration +
+ +--- + @@ -83,7 +89,7 @@ id-token: write and security-events: write. Publisher jobs receive only their required permissions and never run project code. Add a required CI complete job with if: always(), direct needs on every required -producer and reports, and common actions/check-jobs with job-results: toJSON(needs). +producer and reports, and common check-jobs.yml with job-results: toJSON(needs). Report completion validates evidence and publication. It can succeed while displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. @@ -153,7 +159,7 @@ on: permissions: {} jobs: continuous-integration: - uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@fc8b9101a279aeb2c890f4eac2162cd56ea4e17c # feat/native-github-coverage + uses: hoverkraft-tech/ci-github-php/.github/workflows/continuous-integration.yml@9fc3d4e8925f8c6d87f1d46bd6b695ef75cb0f0a # 2.0.4 permissions: actions: read contents: read diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b7a7a63..8c7d5cc 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -74,7 +74,7 @@ # required permissions and never run project code. # # Add a required CI complete job with if: always(), direct needs on every required -# producer and reports, and common actions/check-jobs with job-results: toJSON(needs). +# producer and reports, and common check-jobs.yml with job-results: toJSON(needs). # Report completion validates evidence and publication. It can succeed while # displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. # From e16c60ea79454e11742e8f6b266c4ee3d39031d9 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Tue, 1 Dec 2026 10:17:38 +0100 Subject: [PATCH 30/33] refactor(ci): clarify artifact-only language workflows --- .github/workflows/continuous-integration.md | 27 +++++--------------- .github/workflows/continuous-integration.yml | 27 +++++--------------- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index 9947be6..e4d1689 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -67,31 +67,18 @@ For custom jobs, call `actions/setup-php` after checkout, then the individual lint or test actions. `install-dependencies: false` prepares the runtime without installing the project, for example before isolated package checks. -### Reports and coverage +### Report artifacts -Lint and test actions register their expected native reports before execution. Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. Tests default to junit.xml plus cobertura.xml. Configure test-results, -test-coverage and lint-results for other native paths. Missing or malformed -required reports fail the producer, including after a successful command. +test-coverage and lint-results for other native paths. The lint and test actions +validate these outputs and upload report artifacts, including after command failure. +Missing or malformed required reports fail the action. The highest configured runtime collects coverage; all runtimes retain test results. +Producer calls require contents: read and actions: read. -Call common ci-reports once after all producer jobs, with if: always(), all -producers in needs and job-results: toJSON(needs). No report plan or artifact -inventory is forwarded. Publication defaults to annotations for lint and test -results, and GitHub coverage when available, with comment or summary fallback. -Select destinations through lint-reporters, test-results-reporters and -test-coverage-reporters on that one reporting workflow. - -Producers need contents: read and actions: read. The reporting caller needs -actions: read, contents: read, pull-requests: write, code-quality: write, -id-token: write and security-events: write. Publisher jobs receive only their -required permissions and never run project code. - -Add a required CI complete job with if: always(), direct needs on every required -producer and reports, and common check-jobs.yml with job-results: toJSON(needs). -Report completion validates evidence and publication. It can succeed while -displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. +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). ### Generated application files and documentation diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8c7d5cc..da6330c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -52,31 +52,18 @@ # lint or test actions. `install-dependencies: false` prepares the runtime # without installing the project, for example before isolated package checks. # -# ### Reports and coverage +# ### Report artifacts # -# Lint and test actions register their expected native reports before execution. # Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. # Tests default to junit.xml plus cobertura.xml. Configure test-results, -# test-coverage and lint-results for other native paths. Missing or malformed -# required reports fail the producer, including after a successful command. +# test-coverage and lint-results for other native paths. The lint and test actions +# validate these outputs and upload report artifacts, including after command failure. +# Missing or malformed required reports fail the action. # The highest configured runtime collects coverage; all runtimes retain test results. +# Producer calls require contents: read and actions: read. # -# Call common ci-reports once after all producer jobs, with if: always(), all -# producers in needs and job-results: toJSON(needs). No report plan or artifact -# inventory is forwarded. Publication defaults to annotations for lint and test -# results, and GitHub coverage when available, with comment or summary fallback. -# Select destinations through lint-reporters, test-results-reporters and -# test-coverage-reporters on that one reporting workflow. -# -# Producers need contents: read and actions: read. The reporting caller needs -# actions: read, contents: read, pull-requests: write, code-quality: write, -# id-token: write and security-events: write. Publisher jobs receive only their -# required permissions and never run project code. -# -# Add a required CI complete job with if: always(), direct needs on every required -# producer and reports, and common check-jobs.yml with job-results: toJSON(needs). -# Report completion validates evidence and publication. It can succeed while -# displaying failing tests; the separate gate rejects failed or unexpectedly skipped jobs. +# 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). # # ### Generated application files and documentation # From 235ab128a77dbbafd0ad30034a43b7edf7e8d1b7 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 3 Dec 2026 14:14:21 +0100 Subject: [PATCH 31/33] 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 9566520..5f7bbf4 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) permissions: actions: read contents: read @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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@a57403ecded4ed077dc24a6574953f7c46e69224 # PR #683 (unreleased) permissions: actions: read contents: read From 128f50b6afc99f1f16233c3f755cf8ecf6b17d15 Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Thu, 3 Dec 2026 14:57:27 +0100 Subject: [PATCH 32/33] 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 5f7bbf4..7b89325 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 0da8d5af870ed56f8c8f056ba7a62a6b64ab327d Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Fri, 4 Dec 2026 14:41:25 +0100 Subject: [PATCH 33/33] ci: complete native report discovery with Common 5.0.0 --- .../workflows/__assert-report-artifact.yml | 4 +-- .github/workflows/__greetings.yml | 2 +- .github/workflows/__need-fix-to-issue.yml | 2 +- .github/workflows/__semantic-pull-request.yml | 2 +- .github/workflows/__shared-ci.yml | 6 ++-- .github/workflows/__stale.yml | 2 +- ...__test-workflow-continuous-integration.yml | 34 +++++-------------- .github/workflows/continuous-integration.md | 10 +++--- .github/workflows/continuous-integration.yml | 15 ++++---- .github/workflows/documentation.yml | 2 +- actions/lint/README.md | 23 +++++-------- actions/lint/action.yml | 21 ++++-------- actions/package/test/action.yml | 2 +- actions/setup-php/action.yml | 2 +- actions/test/README.md | 30 ++++++---------- actions/test/action.yml | 28 ++++----------- 16 files changed, 64 insertions(+), 121 deletions(-) diff --git a/.github/workflows/__assert-report-artifact.yml b/.github/workflows/__assert-report-artifact.yml index ab61129..ca15ffa 100644 --- a/.github/workflows/__assert-report-artifact.yml +++ b/.github/workflows/__assert-report-artifact.yml @@ -23,7 +23,7 @@ jobs: steps: # Read artifacts after the producer finishes, as downstream consumers do. - name: Assert - Download the native report artifact - uses: hoverkraft-tech/ci-github-common/actions/download-artifact@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/download-artifact@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: artifact-ids: ${{ inputs.artifact-id }} path: downloaded-reports @@ -50,6 +50,6 @@ jobs: } - name: Cleanup - Remove verified negative fixture evidence if: inputs.discard-fixture - uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@1885f0a6b433228e28c0ea7df8d41bd5e2c24665 # PR #683 (unreleased) + uses: hoverkraft-tech/ci-github-common/actions/quality/discard-report-fixtures@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: artifact-ids: ${{ inputs.artifact-id }} diff --git a/.github/workflows/__greetings.yml b/.github/workflows/__greetings.yml index 1d76f02..f48ad36 100644 --- a/.github/workflows/__greetings.yml +++ b/.github/workflows/__greetings.yml @@ -11,7 +11,7 @@ permissions: {} jobs: greetings: - uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: contents: read issues: write diff --git a/.github/workflows/__need-fix-to-issue.yml b/.github/workflows/__need-fix-to-issue.yml index 1312e87..f4df057 100644 --- a/.github/workflows/__need-fix-to-issue.yml +++ b/.github/workflows/__need-fix-to-issue.yml @@ -18,7 +18,7 @@ permissions: {} jobs: main: - uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: contents: read issues: write diff --git a/.github/workflows/__semantic-pull-request.yml b/.github/workflows/__semantic-pull-request.yml index 6eca601..2d9bf58 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@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + 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 7b89325..0d761fa 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -4,7 +4,7 @@ on: 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 @@ -96,7 +96,7 @@ jobs: - test-action-test - test-action-lint - test-workflow-documentation - 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 @@ -121,7 +121,7 @@ jobs: - test-action-lint - test-workflow-documentation - 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@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: {} with: job-results: ${{ toJSON(needs) }} diff --git a/.github/workflows/__stale.yml b/.github/workflows/__stale.yml index 238feb2..fcdfac8 100644 --- a/.github/workflows/__stale.yml +++ b/.github/workflows/__stale.yml @@ -8,7 +8,7 @@ permissions: {} jobs: main: - uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 permissions: issues: write pull-requests: write diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml index b8bd564..77b5608 100644 --- a/.github/workflows/__test-workflow-continuous-integration.yml +++ b/.github/workflows/__test-workflow-continuous-integration.yml @@ -3,8 +3,8 @@ on: workflow_call: null permissions: {} jobs: - package-configuration: - name: Assert - Package configuration + configuration: + name: Assert - Workflow configuration runs-on: ubuntu-latest permissions: actions: read @@ -14,7 +14,8 @@ jobs: with: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + - name: Assert - Package configuration + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const assert = require('node:assert/strict'); @@ -55,19 +56,8 @@ jobs: await assert.rejects(() => parse(JSON.stringify({ tests })), /must be.*string/); } core.info('Package configuration checks passed.'); - - configuration: - name: Assert - Lint and test configuration - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - ref: ${{ github.event.pull_request.head.sha || github.sha }} - - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + - name: Assert - Lint and test configuration + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const assert = require('node:assert/strict'); @@ -86,16 +76,16 @@ jobs: return {...outputs, lint: JSON.parse(outputs.lint), test: JSON.parse(outputs.test)}; } const defaults = await parse(); - assert.deepEqual(defaults.lint, {command: 'lint:ci', 'lint-results': '*-checkstyle.xml'}); + assert.deepEqual(defaults.lint, {command: 'lint:ci'}); assert.equal((await parse({LINT: '{"command":"lint:custom"}'})).lint.command, 'lint:custom'); - assert.deepEqual(defaults.test, {command: 'test:ci', coverage: true, cache: '', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); + assert.deepEqual(defaults.test, {command: 'test:ci', coverage: true, cache: ''}); for (const value of ['', 'false', 'null']) { const config = await parse({LINT: value, TEST: value}); assert.equal(config.lint, null); assert.equal(config.test, null); } const configured = await parse({TEST: '{"command":"test:custom","coverage":false,"cache":".cache"}', VERSIONS: '["8.2", "8.5"]'}); - assert.deepEqual(configured.test, {command: 'test:custom', coverage: false, cache: '.cache', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); + assert.deepEqual(configured.test, {command: 'test:custom', coverage: false, cache: '.cache'}); assert.equal(configured['primary-version'], '8.5'); assert.equal((await parse({TEST: 'test:custom'})).test.command, 'test:custom'); for (const name of ['LINT', 'TEST']) { @@ -109,12 +99,6 @@ jobs: for (const versions of ['[]', '["8.2","8.2"]', '[8.2]', '["latest"]']) { await assert.rejects(() => parse({VERSIONS: versions})); } - const native = {coverage: true, 'test-coverage': 'custom.xml'}; - const nativeConfig = await parse({TEST: JSON.stringify(native)}); - for (const [key, value] of Object.entries(native)) assert.deepEqual(nativeConfig.test[key], value); - for (const invalid of [{'test-coverage': {}}, {'report-plan': 'obsolete'}]) { - await assert.rejects(() => parse({TEST: JSON.stringify(invalid)})); - } core.info('Lint/test configuration checks passed.'); act: diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md index e4d1689..867a031 100644 --- a/.github/workflows/continuous-integration.md +++ b/.github/workflows/continuous-integration.md @@ -70,15 +70,15 @@ without installing the project, for example before isolated package checks. ### Report artifacts Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. -Tests default to junit.xml plus cobertura.xml. Configure test-results, -test-coverage and lint-results for other native paths. The lint and test actions +Supported native reports are discovered under CI_REPORTS_DIR automatically. +Callers configure commands, not report paths. The lint and test actions validate these outputs and upload report artifacts, including after command failure. Missing or malformed required reports fail the action. The highest configured runtime collects coverage; all runtimes retain test results. Producer calls require contents: read and actions: 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). ### Generated application files and documentation @@ -185,7 +185,7 @@ jobs: # Default: `true` lint: "true" - # true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. + # true for defaults, a Composer script, or JSON options (command, coverage boolean, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. # Default: `true` test: "true" @@ -222,7 +222,7 @@ jobs: | **`ignore-scripts`** | Disable Composer installation scripts. Explicit project commands still run. | **false** | **boolean** | `true` | | **`ignore-plugins`** | Disable Composer plugins during installation. When false, Composer allow-plugins configuration still applies. | **false** | **boolean** | `true` | | **`lint`** | Composer lint script name or a JSON object with `command` (default `lint:ci`). Pass "false", "null" or an empty string to disable. | **false** | **string** | `true` | -| **`test`** | true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. | **false** | **string** | `true` | +| **`test`** | true for defaults, a Composer script, or JSON options (command, coverage boolean, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. | **false** | **string** | `true` | | **`package`** | Validate a public Composer source distribution from the Git repository root. | **false** | **string** | `false` | | | Pass "false" (the default) to disable, "true" for archive and autoload checks, | | | | | | or a JSON object with `tests` for additional commands in an isolated Composer consumer. | | | | diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index da6330c..3375edb 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -55,15 +55,15 @@ # ### Report artifacts # # Composer scripts write into the fresh CI_REPORTS_DIR and honor CI_TEST_COVERAGE. -# Tests default to junit.xml plus cobertura.xml. Configure test-results, -# test-coverage and lint-results for other native paths. The lint and test actions +# Supported native reports are discovered under CI_REPORTS_DIR automatically. +# Callers configure commands, not report paths. The lint and test actions # validate these outputs and upload report artifacts, including after command failure. # Missing or malformed required reports fail the action. # The highest configured runtime collects coverage; all runtimes retain test results. # Producer calls require contents: read and actions: 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). # # ### Generated application files and documentation # @@ -154,7 +154,7 @@ on: default: "true" test: description: |- - true for defaults, a Composer script, or JSON options (command, coverage boolean, test-results paths, test-coverage paths, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. + true for defaults, a Composer script, or JSON options (command, coverage boolean, cache). false, null or empty disables tests. Only the primary runtime contributes coverage. type: string default: "true" package: @@ -251,8 +251,8 @@ jobs: if (!config.command.trim() || config.command.startsWith('-') || /\s/.test(config.command)) throw new Error(name + '.command must name a Composer script.'); return config; } - const lint = options('lint', process.env.LINT, {command: 'lint:ci', 'lint-results': '*-checkstyle.xml'}); - const test = options('test', process.env.TEST, {command: 'test:ci', coverage: true, cache: '', 'test-results': 'junit.xml', 'test-coverage': 'cobertura.xml'}); + const lint = options('lint', process.env.LINT, {command: 'lint:ci'}); + const test = options('test', process.env.TEST, {command: 'test:ci', coverage: true, cache: ''}); const cache = test?.cache; if (cache && (cache === '.' || cache.startsWith('/') || cache.includes('\\') || cache.split('/').includes('..') || /[\r\n*?]/.test(cache))) { throw new Error('test.cache must be one directory inside working-directory.'); @@ -297,7 +297,6 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.lint).command }} - lint-results: ${{ fromJSON(needs.configuration.outputs.lint).lint-results }} test: if: inputs.checks && needs.configuration.outputs.test != 'null' needs: configuration @@ -332,8 +331,6 @@ jobs: with: working-directory: ${{ inputs.working-directory }} command: ${{ fromJSON(needs.configuration.outputs.test).command }} - test-results: ${{ fromJSON(needs.configuration.outputs.test).test-results }} - test-coverage: ${{ fromJSON(needs.configuration.outputs.test).test-coverage }} coverage: ${{ matrix.php-version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' || 'false' }} package: if: inputs.checks && needs.configuration.outputs.package-enabled == 'true' diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 123dd4d..a1c5fed 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -35,7 +35,7 @@ jobs: with: persist-credentials: false - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - name: Generate API documentation diff --git a/actions/lint/README.md b/actions/lint/README.md index 4424f48..1db498b 100644 --- a/actions/lint/README.md +++ b/actions/lint/README.md @@ -15,10 +15,10 @@ Run PHP lint checks, fail on native errors and retain evidence for consolidated reporting. -Run the project's Composer script and retain validated native reports. +Run the project's Composer script and discover its supported native reports. The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. -Requires actions: read and contents: read. Call ci-reports once after all jobs; +Requires actions: read and contents: read. Call publish-ci-reports once after all jobs; the separate CI complete gate decides whether the whole pipeline succeeded. @@ -36,10 +36,6 @@ the separate CI complete gate decides whether the whole pipeline succeeded. # Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. # Default: `lint:ci` command: lint:ci - - # Required native report paths relative to CI_REPORTS_DIR, one per line. - # Default: `*-checkstyle.xml` - lint-results: "*-checkstyle.xml" ``` @@ -47,11 +43,10 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | -------------------------------------------------------------------------------- | ------------ | ------------------- | -| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | -| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `lint:ci` | -| **`lint-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `\*-checkstyle.xml` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | -------------------------------------------------------------------------------- | ------------ | ----------- | +| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | +| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `lint:ci` | @@ -60,9 +55,9 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Outputs -| **Output** | **Description** | -| ------------------------ | ------------------------------------------------------------------ | -| **`report-artifact-id`** | Native result artifact ID, automatically discovered by ci-reports. | +| **Output** | **Description** | +| ------------------------ | -------------------------------------------------------------------------- | +| **`report-artifact-id`** | Native result artifact ID, automatically discovered by publish-ci-reports. | diff --git a/actions/lint/action.yml b/actions/lint/action.yml index ec7b940..42bc43d 100644 --- a/actions/lint/action.yml +++ b/actions/lint/action.yml @@ -1,7 +1,7 @@ -# Run the project's Composer script and retain validated native reports. +# Run the project's Composer script and discover its supported native reports. # The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor # CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. -# Requires actions: read and contents: read. Call ci-reports once after all jobs; +# Requires actions: read and contents: read. Call publish-ci-reports once after all jobs; # the separate CI complete gate decides whether the whole pipeline succeeded. name: Lint PHP description: Run PHP lint checks, fail on native errors and retain evidence for @@ -19,18 +19,15 @@ inputs: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. default: lint:ci - lint-results: - description: Required native report paths relative to CI_REPORTS_DIR, one per line. - default: "*-checkstyle.xml" outputs: report-artifact-id: - description: Native result artifact ID, automatically discovered by ci-reports. + description: Native result artifact ID, automatically discovered by publish-ci-reports. value: ${{ steps.reports.outputs.artifact-id }} runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: definition @@ -38,17 +35,11 @@ runs: env: PROJECT: ${{ steps.directory.outputs.workspace-relative-path || '.' }} COMMAND: ${{ inputs.command }} - RESULTS: ${{ inputs.lint-results }} with: script: | const command = process.env.COMMAND.trim(); if (!command || command.startsWith('-') || /\s/.test(command)) throw new Error('command must name a Composer 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 runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP lint checks',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - id: prepare @@ -74,7 +65,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@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }} diff --git a/actions/package/test/action.yml b/actions/package/test/action.yml index 950d4f6..565ee94 100644 --- a/actions/package/test/action.yml +++ b/actions/package/test/action.yml @@ -15,7 +15,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: test diff --git a/actions/setup-php/action.yml b/actions/setup-php/action.yml index 576125c..dfc1789 100644 --- a/actions/setup-php/action.yml +++ b/actions/setup-php/action.yml @@ -37,7 +37,7 @@ runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: version-file diff --git a/actions/test/README.md b/actions/test/README.md index efd1887..b40588c 100644 --- a/actions/test/README.md +++ b/actions/test/README.md @@ -15,10 +15,10 @@ Run PHP tests, fail on native errors and retain evidence for consolidated reporting. -Run the project's Composer script and retain validated native reports. +Run the project's Composer script and discover its supported native reports. The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. -Requires actions: read and contents: read. Call ci-reports once after all jobs; +Requires actions: read and contents: read. Call publish-ci-reports once after all jobs; the separate CI complete gate decides whether the whole pipeline succeeded. @@ -37,17 +37,9 @@ the separate CI complete gate decides whether the whole pipeline succeeded. # Default: `test:ci` command: test:ci - # Required native report paths relative to CI_REPORTS_DIR, one per line. - # Default: `junit.xml` - test-results: junit.xml - # Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. # Default: `true` coverage: "true" - - # Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. - # Default: `cobertura.xml` - test-coverage: cobertura.xml ``` @@ -55,13 +47,11 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Inputs -| **Input** | **Description** | **Required** | **Default** | -| ----------------------- | ------------------------------------------------------------------------------------------------------ | ------------ | --------------- | -| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | -| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `test:ci` | -| **`test-results`** | Required native report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` | -| **`coverage`** | Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. | **false** | `true` | -| **`test-coverage`** | Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. | **false** | `cobertura.xml` | +| **Input** | **Description** | **Required** | **Default** | +| ----------------------- | ------------------------------------------------------------------------------------------------------ | ------------ | ----------- | +| **`working-directory`** | Composer project directory, with its dependencies installed. | **false** | `.` | +| **`command`** | Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. | **false** | `test:ci` | +| **`coverage`** | Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. | **false** | `true` | @@ -70,9 +60,9 @@ the separate CI complete gate decides whether the whole pipeline succeeded. ## Outputs -| **Output** | **Description** | -| ------------------------ | ------------------------------------------------------------------ | -| **`report-artifact-id`** | Native result artifact ID, automatically discovered by ci-reports. | +| **Output** | **Description** | +| ------------------------ | -------------------------------------------------------------------------- | +| **`report-artifact-id`** | Native result artifact ID, automatically discovered by publish-ci-reports. | diff --git a/actions/test/action.yml b/actions/test/action.yml index ac31554..7b6a0d3 100644 --- a/actions/test/action.yml +++ b/actions/test/action.yml @@ -1,7 +1,7 @@ -# Run the project's Composer script and retain validated native reports. +# Run the project's Composer script and discover its supported native reports. # The script writes fresh reports under CI_REPORTS_DIR. Test scripts honor # CI_TEST_COVERAGE when selecting instrumentation. Run setup-php first. -# Requires actions: read and contents: read. Call ci-reports once after all jobs; +# Requires actions: read and contents: read. Call publish-ci-reports once after all jobs; # the separate CI complete gate decides whether the whole pipeline succeeded. name: Test PHP description: Run PHP tests, fail on native errors and retain evidence for @@ -19,26 +19,19 @@ inputs: Composer script to execute unchanged. Write native reports under CI_REPORTS_DIR. default: test:ci - test-results: - description: Required native report paths relative to CI_REPORTS_DIR, one per line. - default: junit.xml coverage: description: Require test coverage. The project command must honor CI_TEST_COVERAGE when selecting instrumentation. default: "true" - test-coverage: - description: Required native coverage paths relative to CI_REPORTS_DIR when - coverage is enabled, one per line. - default: cobertura.xml outputs: report-artifact-id: - description: Native result artifact ID, automatically discovered by ci-reports. + description: Native result artifact ID, automatically discovered by publish-ci-reports. value: ${{ steps.reports.outputs.artifact-id }} runs: using: composite steps: - id: directory - uses: hoverkraft-tech/ci-github-common/actions/working-directory@f165c0ca3e88604611481e1408ace1e0e3a5ee47 # 4.3.1 + uses: hoverkraft-tech/ci-github-common/actions/working-directory@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: working-directory: ${{ inputs.working-directory }} - id: definition @@ -46,21 +39,14 @@ runs: env: PROJECT: ${{ steps.directory.outputs.workspace-relative-path || '.' }} COMMAND: ${{ inputs.command }} - RESULTS: ${{ inputs.test-results }} COVERAGE: ${{ inputs.coverage }} - COVERAGE_PATHS: ${{ inputs.test-coverage }} with: script: | const command = process.env.COMMAND.trim(); if (!command || command.startsWith('-') || /\s/.test(command)) throw new Error('command must name a Composer 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})); + const reports = [{kind: 'test'}]; if (!['true','false'].includes(process.env.COVERAGE)) throw new Error('coverage must be true or false.'); - if (process.env.COVERAGE === 'true') reports.push(...paths(process.env.COVERAGE_PATHS).map(pattern => ({kind:'coverage',pattern,language:'PHP'}))); + if (process.env.COVERAGE === 'true') reports.push({kind: 'coverage', language: 'PHP'}); const runtime = await exec.getExecOutput('php', ['-r', 'echo PHP_VERSION;'], {silent:true}); core.setOutput('definition', {name:'PHP tests',project:process.env.PROJECT,variant:{runtime:runtime.stdout.trim()},reports}); - id: prepare @@ -87,7 +73,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@26f3d6878844ec53849eec6ac75af8d14ea402e9 # 5.0.0 with: definition: ${{ steps.prepare.outputs.definition }} directory: ${{ steps.prepare.outputs.report-directory }}