diff --git a/.github/actions/parse-ci-reports/README.md b/.github/actions/parse-ci-reports/README.md
deleted file mode 100644
index 49bf3aa..0000000
--- a/.github/actions/parse-ci-reports/README.md
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-# GitHub Action: Parse CI reports
-
-
-

-
-
----
-
-
-
-
-
-
-
-
-[](https://github.com/marketplace/actions/parse-ci-reports)
-[](https://github.com/hoverkraft-tech/ci-github-python/releases)
-[](http://choosealicense.com/licenses/mit/)
-[](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-python?style=social)
-[](https://github.com/hoverkraft-tech/ci-github-python/blob/main/CONTRIBUTING.md)
-
-
-
-
-
-
-
-## Overview
-
-Parse native reports, publish summaries and retain selected files in one artifact. Internal helper for lint and test.
-
-
-
-
-
-
-
-
-## Usage
-
-```yaml
-- uses: hoverkraft-tech/ci-github-python/.github/actions/parse-ci-reports@8fff11508ac0ee0064b432eea089a7bba4be702e # fix/artifact-discovery
- with:
- # Validated absolute project directory.
- # This input is required.
- directory: ""
-
- # Report paths or auto selectors passed to the common parser.
- # Default: `auto:test`
- report-paths: auto:test
-
- # Calling job ID used to group reports.
- # This input is required.
- group: ""
-
- # Title of the GitHub report summary.
- # Default: `CI reports`
- report-name: CI reports
-```
-
-
-
-
-
-## Inputs
-
-| **Input** | **Description** | **Required** | **Default** |
-| ------------------ | ----------------------------------------------------------- | ------------ | ------------ |
-| **`directory`** | Validated absolute project directory. | **true** | - |
-| **`report-paths`** | Report paths or auto selectors passed to the common parser. | **false** | `auto:test` |
-| **`group`** | Calling job ID used to group reports. | **true** | - |
-| **`report-name`** | Title of the GitHub report summary. | **false** | `CI reports` |
-
-
-
-
-
-
-
-
-## Outputs
-
-| **Output** | **Description** |
-| ----------------- | ---------------------------------------------------------- |
-| **`artifact-id`** | Uploaded artifact ID, or empty when no report files exist. |
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Contributing
-
-Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-python/blob/main/CONTRIBUTING.md) for more details.
-
-
-
-
-
-
-
-
-## License
-
-This project is licensed under the MIT License.
-
-SPDX-License-Identifier: MIT
-
-Copyright © 2026 hoverkraft-tech
-
-For more details, see the [license](http://choosealicense.com/licenses/mit/).
-
-
-
-
-
----
-
-This documentation was automatically generated by [CI Dokumentor](https://github.com/hoverkraft-tech/ci-dokumentor).
-
-
-
-
diff --git a/.github/actions/parse-ci-reports/action.test.cjs b/.github/actions/parse-ci-reports/action.test.cjs
deleted file mode 100644
index 6be51d8..0000000
--- a/.github/actions/parse-ci-reports/action.test.cjs
+++ /dev/null
@@ -1,52 +0,0 @@
-const assert = require("node:assert/strict");
-const fs = require("node:fs");
-const path = require("node:path");
-const test = require("node:test");
-const {
- createWorkspace,
- loadActionStep,
-} = require("../../../tests/action-test-helpers.cjs");
-
-const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
-
-test("report artifacts contain only parsed reports and use unique names", async (t) => {
- const directory = createWorkspace(t);
- const report = path.join(directory, "junit.xml");
- fs.writeFileSync(report, "");
- fs.writeFileSync(
- path.join(directory, "unrelated-secret.txt"),
- "not a report",
- );
- const prepare = new AsyncFunction(
- "core",
- "process",
- "require",
- loadActionStep(path.join(__dirname, "action.yml"), "prepare").with.script,
- );
- async function outputs(files, group = "outer-job") {
- const result = {};
- await prepare(
- {
- setOutput: (key, value) => {
- result[key] = value;
- },
- },
- {
- env: {
- DIRECTORY: directory,
- REPORT_FILES: JSON.stringify(files),
- REPORT_GROUP: group,
- GITHUB_RUN_ATTEMPT: "2",
- },
- },
- require,
- );
- return result;
- }
- assert.deepEqual(await outputs([]), {});
- const first = await outputs([report]);
- assert.equal(first.files, report);
- assert.match(first.name, /^ci-reports-2-outer-job-/);
- assert.notEqual(first.name, (await outputs([report])).name);
- await assert.rejects(() => outputs([report], "../bad-group"), /report-group/);
-});
diff --git a/.github/actions/parse-ci-reports/action.yml b/.github/actions/parse-ci-reports/action.yml
deleted file mode 100644
index 7d7a36a..0000000
--- a/.github/actions/parse-ci-reports/action.yml
+++ /dev/null
@@ -1,62 +0,0 @@
----
-name: Parse CI reports
-description:
- Parse native reports, publish summaries and retain selected files in one artifact. Internal helper for lint and
- test.
-inputs:
- directory:
- description: Validated absolute project directory.
- required: true
- report-paths:
- description: Report paths or auto selectors passed to the common parser.
- default: auto:test
- group:
- description: Calling job ID used to group reports.
- required: true
- report-name:
- description: Title of the GitHub report summary.
- default: CI reports
-outputs:
- artifact-id:
- description: Uploaded artifact ID, or empty when no report files exist.
- value: ${{ steps.upload.outputs.artifact-id }}
-runs:
- using: composite
- steps:
- - id: parse
- if: ${{ !cancelled() }}
- uses: hoverkraft-tech/ci-github-common/actions/quality/parse-ci-reports@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
- with:
- working-directory: ${{ inputs.directory }}
- report-paths: |
- ${{ inputs.report-paths }}
- !**/.venv/**
- !**/.git/**
- !**/.cache/**
- !**/vendor/**
- report-name: ${{ inputs.report-name }}
- output-format: annotations,summary,markdown
- - id: prepare
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- env:
- DIRECTORY: ${{ inputs.directory }}
- REPORT_FILES: ${{ steps.parse.outputs.parsed-files }}
- REPORT_GROUP: ${{ inputs.group }}
- with:
- script: |
- const files = JSON.parse(process.env.REPORT_FILES || '[]');
- if (!files.length) return;
- const group = process.env.REPORT_GROUP;
- if (!/^[\w-]+$/.test(group)) throw new Error('report-group must be a job ID.');
- core.setOutput('files', files.join('\n'));
- core.setOutput('name', `ci-reports-${process.env.GITHUB_RUN_ATTEMPT}-${group}-${require('node:crypto').randomUUID()}`);
- if: ${{ !cancelled() }}
- - id: upload
- if: ${{ !cancelled() && steps.prepare.outputs.files != '' }}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
- with:
- name: ${{ steps.prepare.outputs.name }}
- path: ${{ steps.prepare.outputs.files }}
- include-hidden-files: true
- if-no-files-found: error
- retention-days: 7
diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml
new file mode 100644
index 0000000..cf843da
--- /dev/null
+++ b/.github/linters/actionlint.yml
@@ -0,0 +1,13 @@
+# 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"\.] },
+ }
diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml
index 6ed761c..87a9232 100644
--- a/.github/workflows/__main-ci.yml
+++ b/.github/workflows/__main-ci.yml
@@ -16,6 +16,7 @@ jobs:
actions: read
security-events: write
id-token: write
+ code-quality: write
release:
needs: ci
if: github.event_name != 'schedule' && vars.CI_BOT_APP_CLIENT_ID != ''
diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml
index 7232af2..8b907bc 100644
--- a/.github/workflows/__pull-request-ci.yml
+++ b/.github/workflows/__pull-request-ci.yml
@@ -16,6 +16,7 @@ jobs:
actions: read
security-events: write
id-token: write
+ code-quality: write
"on":
merge_group: null
pull_request:
diff --git a/.github/workflows/__release.yml b/.github/workflows/__release.yml
index c41a8b4..78cc269 100644
--- a/.github/workflows/__release.yml
+++ b/.github/workflows/__release.yml
@@ -17,6 +17,7 @@ jobs:
actions: read
security-events: write
id-token: write
+ code-quality: write
release:
name: Create and publish release
needs: ci
diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml
index abe94d7..1c83150 100644
--- a/.github/workflows/__shared-ci.yml
+++ b/.github/workflows/__shared-ci.yml
@@ -1,18 +1,17 @@
----
name: Internal - Common Continuous Integration tasks
"on":
workflow_call: null
permissions: {}
jobs:
linter:
- uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # 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: |
@@ -25,29 +24,69 @@ jobs:
test:
uses: $/.github/workflows/__test-workflow-continuous-integration.yml
permissions:
+ actions: read
contents: read
id-token: write
test-action-setup-python:
uses: $/.github/workflows/__test-action-setup-python.yml
permissions:
+ actions: read
contents: read
test-action-lint:
uses: $/.github/workflows/__test-action-lint.yml
permissions:
+ actions: read
contents: read
test-action-test:
uses: $/.github/workflows/__test-action-test.yml
permissions:
+ actions: read
contents: read
test-action-audit:
uses: $/.github/workflows/__test-action-audit.yml
permissions:
+ actions: read
contents: read
test-action-package-test:
uses: $/.github/workflows/__test-action-package-test.yml
permissions:
+ actions: read
contents: read
- test-action-parse-ci-reports:
- uses: $/.github/workflows/__test-action-parse-ci-reports.yml
+
+ reports:
+ if: always()
+ needs:
+ - linter
+ - test
+ - test-action-setup-python
+ - test-action-lint
+ - test-action-test
+ - test-action-audit
+ - test-action-package-test
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/publish-ci-reports.yml@23aa1846c8c6d829f321984b6d0252ebc36b01ee # 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
+ - test-action-setup-python
+ - test-action-lint
+ - test-action-test
+ - test-action-audit
+ - test-action-package-test
+ - reports
+ uses: hoverkraft-tech/ci-github-common/.github/workflows/check-jobs.yml@cb86863a77462f8837b38ad542b49ab36a825a85 # PR #683 (unreleased)
+ permissions: {}
+ with:
+ job-results: ${{ toJSON(needs) }}
diff --git a/.github/workflows/__test-action-lint.yml b/.github/workflows/__test-action-lint.yml
index 7096e98..32423e6 100644
--- a/.github/workflows/__test-action-lint.yml
+++ b/.github/workflows/__test-action-lint.yml
@@ -1,4 +1,3 @@
----
name: Internal - Test lint action
"on":
workflow_call: null
@@ -8,21 +7,24 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
+ actions: read
contents: read
outputs:
- artifact-id: ${{ steps.failed-lint.outputs.report-artifact-id }}
+ artifact-id: ${{ steps.check.outputs.report-artifact-id }}
steps:
- name: Arrange - Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Assert - Action contract tests pass
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
+ uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased)
with:
+ test-results: junit.xml
+ test-coverage: lcov.info
command: test:ci
arguments: '["actions/lint/action.test.cjs"]'
- coverage: ""
- comment: "false"
+ coverage: "false"
- name: Arrange - Install the project runtime and dependencies
uses: $/actions/setup-python
with:
@@ -31,39 +33,24 @@ jobs:
uses: $/actions/lint
with:
working-directory: tests/python-project
- - name: Act - Retain diagnostics from a failing command
- uses: $/actions/lint
- with:
- working-directory: tests/python-project
- command: |
- printf '%s\n' '' > checkstyle.xml
- exit 23
- id: failed-lint
- continue-on-error: true
- - name: Assert - Failure propagates and reports survive
- shell: bash
- run: |
- test "$OUTCOME" = failure
- test -n "$ARTIFACT"
- env:
- OUTCOME: ${{ steps.failed-lint.outcome }}
- ARTIFACT: ${{ steps.failed-lint.outputs.report-artifact-id }}
+ id: check
verify:
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
+ actions: read
contents: read
steps:
- name: Assert - Download retained lint reports
uses: hoverkraft-tech/ci-github-common/actions/download-artifact@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
with:
artifact-ids: ${{ needs.lint.outputs.artifact-id }}
- path: ${{ runner.temp }}/lint-reports
- - name: Assert - Retained report contains the diagnostic
+ path: ${{ runner.temp }}/retained-reports
+ - name: Assert - Native reports and validation result are retained
shell: bash
run: |
- test -f "$REPORT_DIRECTORY/checkstyle.xml"
- grep -q 'message="expected lint failure"' "$REPORT_DIRECTORY/checkstyle.xml"
+ test -f "$REPORT_DIRECTORY/report.json"
+ test -s "$REPORT_DIRECTORY/native/1-ruff.sarif"
env:
- REPORT_DIRECTORY: ${{ runner.temp }}/lint-reports
+ REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports
diff --git a/.github/workflows/__test-action-parse-ci-reports.yml b/.github/workflows/__test-action-parse-ci-reports.yml
deleted file mode 100644
index dcf7fde..0000000
--- a/.github/workflows/__test-action-parse-ci-reports.yml
+++ /dev/null
@@ -1,65 +0,0 @@
----
-name: Internal - Test parse-ci-reports action
-"on":
- workflow_call: null
-permissions: {}
-jobs:
- reports:
- runs-on: ubuntu-latest
- timeout-minutes: 5
- permissions:
- contents: read
- outputs:
- artifact-id: ${{ steps.report.outputs.artifact-id }}
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - name: Assert - Action contract tests pass
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
- with:
- command: test:ci
- arguments: '[".github/actions/parse-ci-reports/action.test.cjs"]'
- coverage: ""
- comment: "false"
- - name: Arrange - Empty report directory
- run: mkdir -p "$RUNNER_TEMP/empty-reports"
- - name: Act - Retain no reports
- id: empty
- uses: $/.github/actions/parse-ci-reports
- with:
- directory: ${{ runner.temp }}/empty-reports
- group: reports
- - name: Assert - No empty artifact is created
- env:
- ARTIFACT: ${{ steps.empty.outputs.artifact-id }}
- run: test -z "$ARTIFACT"
- - name: Arrange - One report and an unrelated private file
- run: |
- mkdir -p "$RUNNER_TEMP/report-fixture"
- printf '%s\n' '' > "$RUNNER_TEMP/report-fixture/junit.xml"
- printf '%s\n' 'not a report' > "$RUNNER_TEMP/report-fixture/private.txt"
- - name: Act - Retain the selected report
- id: report
- uses: $/.github/actions/parse-ci-reports
- with:
- directory: ${{ runner.temp }}/report-fixture
- group: reports
- report-paths: junit.xml
- verify:
- needs: reports
- runs-on: ubuntu-latest
- timeout-minutes: 5
- permissions:
- contents: read
- steps:
- - name: Assert - Artifact can be downloaded
- uses: hoverkraft-tech/ci-github-common/actions/download-artifact@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
- with:
- artifact-ids: ${{ needs.reports.outputs.artifact-id }}
- path: ${{ runner.temp }}/downloaded-reports
- - name: Assert - Only the selected file was retained
- run: |
- test -f "$RUNNER_TEMP/downloaded-reports/junit.xml"
- test ! -e "$RUNNER_TEMP/downloaded-reports/private.txt"
- test "$(find "$RUNNER_TEMP/downloaded-reports" -type f | wc -l)" -eq 1
diff --git a/.github/workflows/__test-action-setup-python.yml b/.github/workflows/__test-action-setup-python.yml
index 67c2ffd..afb9de2 100644
--- a/.github/workflows/__test-action-setup-python.yml
+++ b/.github/workflows/__test-action-setup-python.yml
@@ -1,4 +1,3 @@
----
name: Internal - Test setup-python action
"on":
workflow_call: null
@@ -8,19 +7,22 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
+ actions: read
contents: read
steps:
- name: Arrange - Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Assert - Action contract tests pass
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
+ uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased)
with:
+ test-results: junit.xml
+ test-coverage: lcov.info
command: test:ci
arguments: '["actions/setup-python/action.test.cjs"]'
- coverage: ""
- comment: "false"
+ coverage: "false"
- name: Act - Detect the runtime and install dependencies
uses: $/actions/setup-python
with:
diff --git a/.github/workflows/__test-action-test.yml b/.github/workflows/__test-action-test.yml
index 02e4807..aeb8f82 100644
--- a/.github/workflows/__test-action-test.yml
+++ b/.github/workflows/__test-action-test.yml
@@ -1,4 +1,3 @@
----
name: Internal - Test test action
"on":
workflow_call: null
@@ -8,68 +7,50 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
+ actions: read
contents: read
outputs:
- artifact-id: ${{ steps.failed-test.outputs.report-artifact-id }}
+ artifact-id: ${{ steps.check.outputs.report-artifact-id }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
name: Arrange - Check out the repository
- name: Assert - Action contract tests pass
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
+ uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased)
with:
+ test-results: junit.xml
+ test-coverage: lcov.info
command: test:ci
arguments: '["actions/test/action.test.cjs"]'
- coverage: ""
- comment: "false"
+ coverage: "false"
- uses: $/actions/setup-python
with:
working-directory: tests/python-project
name: Arrange - Install dependencies
- - id: test
+ - id: check
uses: $/actions/test
with:
working-directory: tests/python-project
+ coverage: "false"
name: Act - Run default tests
- - id: failed-test
- continue-on-error: true
- uses: $/actions/test
- with:
- working-directory: tests/python-project
- command: |-
- printf '%s' 'failure' > junit.xml
- exit 17
- coverage: ""
- name: Act - Run a failing test command
- - name: Assert failures and reports
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- env:
- SUCCESS_ARTIFACT: ${{ steps.test.outputs.report-artifact-id }}
- FAILURE_ARTIFACT: ${{ steps.failed-test.outputs.report-artifact-id }}
- TEST_OUTCOME: ${{ steps.failed-test.outcome }}
- with:
- script: |
- const assert = require('node:assert/strict');
- assert.equal(process.env.TEST_OUTCOME, 'failure');
- assert.ok(process.env.SUCCESS_ARTIFACT, 'Successful tests retain reports');
- assert.ok(process.env.FAILURE_ARTIFACT, 'Failed tests retain reports');
- assert.notEqual(process.env.SUCCESS_ARTIFACT, process.env.FAILURE_ARTIFACT);
verify:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
+ actions: read
contents: read
steps:
- uses: hoverkraft-tech/ci-github-common/actions/download-artifact@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
with:
artifact-ids: ${{ needs.test.outputs.artifact-id }}
- path: ${{ runner.temp }}/failed-reports
- - name: Verify retained failure report
+ path: ${{ runner.temp }}/retained-reports
+ - name: Assert - Native reports and validation result are retained
shell: bash
env:
- REPORT_DIRECTORY: ${{ runner.temp }}/failed-reports
+ REPORT_DIRECTORY: ${{ runner.temp }}/retained-reports
run: |
- test -f "$REPORT_DIRECTORY/junit.xml"
- grep -q 'message="expected"' "$REPORT_DIRECTORY/junit.xml"
+ test -f "$REPORT_DIRECTORY/report.json"
+ test -s "$REPORT_DIRECTORY/native/1-junit.xml"
diff --git a/.github/workflows/__test-workflow-continuous-integration.yml b/.github/workflows/__test-workflow-continuous-integration.yml
index ae8c490..8414e3c 100644
--- a/.github/workflows/__test-workflow-continuous-integration.yml
+++ b/.github/workflows/__test-workflow-continuous-integration.yml
@@ -1,4 +1,3 @@
----
name: Internal - Test continuous integration workflow
"on":
workflow_call: null
@@ -7,31 +6,37 @@ jobs:
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 }}
- name: Assert - Workflow configuration tests pass
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
+ uses: hoverkraft-tech/ci-github-nodejs/actions/test@3ba26a82aae406c87bb99c80dfe46299fc808cbb # PR #624 (unreleased)
with:
+ test-results: junit.xml
+ test-coverage: lcov.info
command: test:ci
arguments: '["tests/config.test.cjs"]'
- coverage: ""
- comment: "false"
+ coverage: "false"
fixture:
uses: $/.github/workflows/continuous-integration.yml
permissions:
+ actions: read
contents: read
id-token: write
with:
working-directory: tests/python-project
+ test: '{"coverage":true}'
python-versions: '["3.13", "3.15"]'
dependency-review: false
package: '{"tests": "python -I -c \"from ci_python_fixture import add; assert add(2, 3) == 5\""}'
checks-disabled:
uses: $/.github/workflows/continuous-integration.yml
permissions:
+ actions: read
contents: read
id-token: write
with:
diff --git a/.github/workflows/continuous-integration.md b/.github/workflows/continuous-integration.md
index 2f507d6..bc5e58d 100644
--- a/.github/workflows/continuous-integration.md
+++ b/.github/workflows/continuous-integration.md
@@ -40,16 +40,16 @@ jobs:
python:
uses: hoverkraft-tech/ci-github-python/.github/workflows/continuous-integration.yml@main
permissions:
+ actions: read
contents: read
- id-token: write
with:
working-directory: .
python-versions: '["3.13", "3.15"]'
```
-An empty versions input uses project detection once. The last matrix entry is
+An empty versions input uses project detection once. The highest configured version is
the primary version: lint, audit and package checks run there, and only
-that version publishes coverage. Tests run on every entry with fail-fast disabled.
+that version contributes coverage. Tests run on every entry with fail-fast disabled.
Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON
array of Linux labels and applies to every job, including configuration.
@@ -100,36 +100,22 @@ build backend in `build-system.requires` for reproducible builds.
Build backends execute code; Python has no general equivalent to npm's
`ignore-scripts` switch. The action does not publish to PyPI.
-### Reports and permissions
+### Report artifacts
-Tests retain JUnit and supported coverage files for seven days, including after
-command failures. Lint retains parsed SARIF/Checkstyle reports. Only report files
-are uploaded, with unique names for parallel calls; a job producing no reports
-returns an empty `report-artifact-id`. Summaries and annotations work without PR
-write permissions. Individual PR comments are not created.
+Every runtime retains detailed test results. The highest configured version runs
+lint and coverage once. Default pytest commands disable coverage instrumentation
+on other versions. Custom commands receive CI_TEST_COVERAGE and CI_REPORTS_DIR.
+The lint and test actions validate their outputs and upload report artifacts,
+including after command failure. Missing or malformed required reports fail the action.
+Producer calls require actions: read and contents: read.
-Use the common
-[ci-reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.yml)
-for consolidated comments after standalone producer jobs; set `report-group` to
-the outer calling job ID when required. Python JUnit and Cobertura reports use the common
-parser.
-
-`test: '{"coverage":"codecov"}'` enables OIDC upload. The expected coverage file is
-`cobertura.xml`. A custom command must produce
-the applicable file. `coverage` controls publication, not collection, and an
-empty value still retains JUnit results. The reusable workflow declares
-`id-token: write` for Codecov and callers must grant it, including for default
-GitHub reports. Standalone GitHub reporting requires only read permissions.
-No repository-specific bot secrets are required by the public actions or workflow.
-
-See [setup-python](../../actions/setup-python/README.md), [lint](../../actions/lint/README.md),
-[test](../../actions/test/README.md) and [audit](../../actions/audit/README.md)
-for standalone action usage. Pin the workflow to a reviewed commit SHA in production.
+The caller publishes those artifacts once with `publish-ci-reports.yml`.
+See the [common reporting guide](https://github.com/hoverkraft-tech/ci-github-common/blob/44d42ca06b9f722d8ab79af4f588f30ad1e16bc5/docs/usage/ci-reports.md#consumer-workflow).
### Permissions
+- **`actions`**: `read`
- **`contents`**: `read`
-- **`id-token`**: `write`
@@ -149,10 +135,10 @@ on:
permissions: {}
jobs:
continuous-integration:
- uses: hoverkraft-tech/ci-github-python/.github/workflows/continuous-integration.yml@244c9508c64e31d1a87327cc9ed07a13c235c454 # main
+ uses: hoverkraft-tech/ci-github-python/.github/workflows/continuous-integration.yml@9fe07ffb0ede25d9311ca9e3d8c82d1ce38e7d75 # 0.0.1
permissions:
+ actions: read
contents: read
- id-token: write
with:
# JSON array of Linux runner labels for all jobs.
# Default: `["ubuntu-latest"]`
@@ -166,14 +152,14 @@ jobs:
# Default: `.`
working-directory: .
- # JSON array of Python versions. The last entry runs lint, audit and package checks and publishes coverage. Empty runs project detection once. An empty entry uses the project version.
+ # JSON array of Python versions. The highest configured version runs lint, audit, package checks and coverage; every version retains test results. Empty uses project detection once.
python-versions: ""
- # true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint.
+ # true for defaults, a Bash command, or JSON options (command, lint-results). false, null or empty disables lint.
# Default: `true`
lint: "true"
- # true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection.
+ # true for defaults, a Bash command, or JSON options (command, coverage, test-results, test-coverage). false, null or empty disables tests.
# Default: `true`
test: "true"
@@ -202,18 +188,18 @@ jobs:
### Workflow Call Inputs
-| **Input** | **Description** | **Required** | **Type** | **Default** |
-| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- |
-| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` |
-| **`checks`** | Enable all checks, including distribution checks. | **false** | **boolean** | `true` |
-| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` |
-| **`python-versions`** | JSON array of Python versions. The last entry runs lint, audit and package checks and publishes coverage. Empty runs project detection once. An empty entry uses the project version. | **false** | **string** | - |
-| **`lint`** | true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint. | **false** | **string** | `true` |
-| **`test`** | true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection. | **false** | **string** | `true` |
-| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` |
-| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` |
-| **`package`** | false disables distribution tests. true builds and installs wheel and sdist. A JSON object with tests supplies consumer smoke commands. Does not publish packages. | **false** | **string** | `false` |
-| **`uv-version`** | Pinned uv release. | **false** | **string** | `0.13.9` |
+| **Input** | **Description** | **Required** | **Type** | **Default** |
+| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- |
+| **`runs-on`** | JSON array of Linux runner labels for all jobs. | **false** | **string** | `["ubuntu-latest"]` |
+| **`checks`** | Enable all checks, including distribution checks. | **false** | **boolean** | `true` |
+| **`working-directory`** | One project directory inside the checkout. Use a caller matrix for multiple projects. | **false** | **string** | `.` |
+| **`python-versions`** | JSON array of Python versions. The highest configured version runs lint, audit, package checks and coverage; every version retains test results. Empty uses project detection once. | **false** | **string** | - |
+| **`lint`** | true for defaults, a Bash command, or JSON options (command, lint-results). false, null or empty disables lint. | **false** | **string** | `true` |
+| **`test`** | true for defaults, a Bash command, or JSON options (command, coverage, test-results, test-coverage). false, null or empty disables tests. | **false** | **string** | `true` |
+| **`audit`** | Check production dependencies for known vulnerabilities. | **false** | **boolean** | `true` |
+| **`dependency-review`** | Review dependency changes on pull requests. Requires GitHub dependency review availability. | **false** | **boolean** | `true` |
+| **`package`** | false disables distribution tests. true builds and installs wheel and sdist. A JSON object with tests supplies consumer smoke commands. Does not publish packages. | **false** | **string** | `false` |
+| **`uv-version`** | Pinned uv release. | **false** | **string** | `0.13.9` |
diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 871cc78..d32e8cf 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -10,16 +10,16 @@
# python:
# uses: hoverkraft-tech/ci-github-python/.github/workflows/continuous-integration.yml@main
# permissions:
+# actions: read
# contents: read
-# id-token: write
# with:
# working-directory: .
# python-versions: '["3.13", "3.15"]'
# ```
#
-# An empty versions input uses project detection once. The last matrix entry is
+# An empty versions input uses project detection once. The highest configured version is
# the primary version: lint, audit and package checks run there, and only
-# that version publishes coverage. Tests run on every entry with fail-fast disabled.
+# that version contributes coverage. Tests run on every entry with fail-fast disabled.
# Duplicate, malformed and non-string versions are rejected. `runs-on` is a JSON
# array of Linux labels and applies to every job, including configuration.
#
@@ -70,33 +70,18 @@
# Build backends execute code; Python has no general equivalent to npm's
# `ignore-scripts` switch. The action does not publish to PyPI.
#
-# ### Reports and permissions
+# ### Report artifacts
#
-# Tests retain JUnit and supported coverage files for seven days, including after
-# command failures. Lint retains parsed SARIF/Checkstyle reports. Only report files
-# are uploaded, with unique names for parallel calls; a job producing no reports
-# returns an empty `report-artifact-id`. Summaries and annotations work without PR
-# write permissions. Individual PR comments are not created.
+# Every runtime retains detailed test results. The highest configured version runs
+# lint and coverage once. Default pytest commands disable coverage instrumentation
+# on other versions. Custom commands receive CI_TEST_COVERAGE and CI_REPORTS_DIR.
+# The lint and test actions validate their outputs and upload report artifacts,
+# including after command failure. Missing or malformed required reports fail the action.
+# Producer calls require actions: read and contents: read.
#
-# Use the common
-# [ci-reports workflow](https://github.com/hoverkraft-tech/ci-github-common/blob/main/.github/workflows/ci-reports.yml)
-# for consolidated comments after standalone producer jobs; set `report-group` to
-# the outer calling job ID when required. Python JUnit and Cobertura reports use the common
-# parser.
+# 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).
#
-# `test: '{"coverage":"codecov"}'` enables OIDC upload. The expected coverage file is
-# `cobertura.xml`. A custom command must produce
-# the applicable file. `coverage` controls publication, not collection, and an
-# empty value still retains JUnit results. The reusable workflow declares
-# `id-token: write` for Codecov and callers must grant it, including for default
-# GitHub reports. Standalone GitHub reporting requires only read permissions.
-# No repository-specific bot secrets are required by the public actions or workflow.
-#
-# See [setup-python](../../actions/setup-python/README.md), [lint](../../actions/lint/README.md),
-# [test](../../actions/test/README.md) and [audit](../../actions/audit/README.md)
-# for standalone action usage. Pin the workflow to a reviewed commit SHA in production.
-
----
name: Python Continuous Integration
"on":
workflow_call:
@@ -114,15 +99,19 @@ name: Python Continuous Integration
type: string
default: .
python-versions:
- description: JSON array of Python versions. The last entry runs lint, audit and package checks and publishes coverage. Empty runs project detection once. An empty entry uses the project version.
+ description:
+ JSON array of Python versions. The highest configured version runs lint, audit, package checks and coverage; every version retains
+ test results. Empty uses project detection once.
type: string
default: ""
lint:
- description: true for default checks, a trusted Bash command, or a JSON object with command. false, null or empty disables lint.
+ description: true for defaults, a Bash command, or JSON options (command, lint-results). false, null or empty disables lint.
type: string
default: "true"
test:
- description: true for default tests, a trusted Bash command, or a JSON object with command, coverage (`github`, `codecov` or empty). false, null or empty disables tests. Coverage publication runs only on the last version; the command controls collection.
+ description:
+ true for defaults, a Bash command, or JSON options (command, coverage, test-results, test-coverage). false, null or empty disables
+ tests.
type: string
default: "true"
audit:
@@ -134,7 +123,9 @@ name: Python Continuous Integration
type: boolean
default: true
package:
- description: false disables distribution tests. true builds and installs wheel and sdist. A JSON object with tests supplies consumer smoke commands. Does not publish packages.
+ description:
+ false disables distribution tests. true builds and installs wheel and sdist. A JSON object with tests supplies consumer smoke commands.
+ Does not publish packages.
type: string
default: "false"
uv-version:
@@ -161,6 +152,8 @@ jobs:
LINT: ${{ inputs.lint }}
TEST: ${{ inputs.test }}
PACKAGE: ${{ inputs.package }}
+ DIRECTORY: ${{ inputs.working-directory }}
+ CHECKS: ${{ inputs.checks }}
with:
script: |
const versions = process.env.VERSIONS.trim() ? JSON.parse(process.env.VERSIONS) : [''];
@@ -181,13 +174,12 @@ jobs:
if (unknown.length) throw new Error('Unknown ' + name + ' options: ' + unknown.join(', '));
config = {...defaults, ...config};
for (const [key, value] of Object.entries(config)) {
- if (typeof value !== typeof defaults[key]) throw new Error(name + '.' + key + ' has the wrong type.');
+ if (Array.isArray(defaults[key]) ? !Array.isArray(value) : typeof value !== typeof defaults[key]) throw new Error(name + '.' + key + ' has the wrong type.');
}
return config;
}
- const lint = options('lint', process.env.LINT, {command: ''});
- const test = options('test', process.env.TEST, {"command": "uv run --locked pytest --junitxml=junit.xml --cov --cov-report=term-missing --cov-report=xml:cobertura.xml", "coverage": "github"});
- if (test && !['', 'github', 'codecov'].includes(test.coverage)) throw new Error('test.coverage must be github, codecov or empty.');
+ const lint = options('lint', process.env.LINT, {command: '', 'lint-results': 'ruff.sarif'});
+ const test = options('test', process.env.TEST, {command: '', coverage: true, 'test-results': 'junit.xml', 'test-coverage': 'coverage.xml'});
let pkg;
try { pkg = JSON.parse(process.env.PACKAGE.trim() || 'false'); }
catch { throw new Error('package must be true, false or an object with tests.'); }
@@ -199,7 +191,16 @@ jobs:
core.setOutput('package-enabled', enabled);
core.setOutput('package-tests', pkg.tests || '');
core.setOutput('versions', versions);
- core.setOutput('primary-version', versions.at(-1));
+ if (versions.length > 1 && versions.includes('')) throw new Error('Project detection cannot be mixed with explicit versions.');
+ const primary = [...versions].sort((a, b) => {
+ const left = a.split('.').map(Number); const right = b.split('.').map(Number);
+ for (let index = 0; index < 3; index++) {
+ const difference = (left[index] || 0) - (right[index] || 0);
+ if (difference) return difference;
+ }
+ return 0;
+ }).at(-1);
+ core.setOutput('primary-version', primary);
core.setOutput('lint', JSON.stringify(lint));
core.setOutput('test', JSON.stringify(test));
dependency-review:
@@ -208,10 +209,11 @@ jobs:
permissions:
contents: read
steps:
- - &checkout
+ - &id001
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'
@@ -220,9 +222,10 @@ jobs:
timeout-minutes: 20
permissions:
contents: read
+ actions: read
steps:
- - *checkout
- - &setup-primary
+ - *id001
+ - &id002
uses: $/actions/setup-python
with:
working-directory: ${{ inputs.working-directory }}
@@ -232,6 +235,7 @@ 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
@@ -239,9 +243,12 @@ jobs:
timeout-minutes: 20
permissions:
contents: read
- id-token: write
+ actions: read
steps:
- - *checkout
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
+ persist-credentials: false
- uses: $/actions/setup-python
with:
working-directory: ${{ inputs.working-directory }}
@@ -251,7 +258,11 @@ jobs:
with:
working-directory: ${{ inputs.working-directory }}
command: ${{ fromJSON(needs.configuration.outputs.test).command }}
- coverage: ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage || '' }}
+ coverage:
+ ${{ matrix.version == needs.configuration.outputs.primary-version && fromJSON(needs.configuration.outputs.test).coverage && 'true' ||
+ 'false' }}
+ test-results: ${{ fromJSON(needs.configuration.outputs.test).test-results }}
+ test-coverage: ${{ fromJSON(needs.configuration.outputs.test).test-coverage }}
strategy:
fail-fast: false
matrix:
@@ -264,8 +275,8 @@ jobs:
permissions:
contents: read
steps:
- - *checkout
- - *setup-primary
+ - *id001
+ - *id002
- uses: $/actions/audit
with:
working-directory: ${{ inputs.working-directory }}
@@ -277,8 +288,8 @@ jobs:
permissions:
contents: read
steps:
- - *checkout
- - *setup-primary
+ - *id001
+ - *id002
- uses: $/actions/package/test
with:
working-directory: ${{ inputs.working-directory }}
diff --git a/actions/lint/README.md b/actions/lint/README.md
index c3e75b8..e218f13 100644
--- a/actions/lint/README.md
+++ b/actions/lint/README.md
@@ -2,12 +2,6 @@
#  GitHub Action: Lint Python
-
-

-
-
----
-
@@ -17,9 +11,7 @@
[](https://github.com/marketplace/actions/lint-python)
[](https://github.com/hoverkraft-tech/ci-github-python/releases)
-[](http://choosealicense.com/licenses/mit/)
[](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-python?style=social)
-[](https://github.com/hoverkraft-tech/ci-github-python/blob/main/CONTRIBUTING.md)
@@ -29,22 +21,15 @@
## Overview
-Run project-locked Ruff, Black and mypy.
+Check Python using project-locked Ruff, Black and mypy.
-Declare all three in the default uv dependency groups and configure them in
-`pyproject.toml`. Ruff emits SARIF, Black checks formatting and mypy checks types.
-All three execute even after one fails. A trusted Bash `command` replaces defaults;
-emit SARIF or Checkstyle to retain annotations from custom checks.
-
-
-
+Run setup-python first and declare these tools in the default uv dependency groups.
+All checks execute even when another fails. Ruff writes SARIF into a fresh
+report directory. Custom commands receive CI_REPORTS_DIR.
-Run [setup-python](../setup-python/README.md) first with the same `working-directory`.
-
-Native reports survive command failures and are retained for seven days.
-See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions.
-
-
+Native diagnostics are validated and retained after failures
+as well as success. The common publish-ci-reports workflow publishes the final feedback.
+Producer jobs require actions: read and contents: read.
@@ -56,17 +41,18 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Usage
```yaml
-- uses: hoverkraft-tech/ci-github-python/actions/lint@4b801b911424c68370a3e713bc5404151ab4d772 # main
+- uses: hoverkraft-tech/ci-github-python/actions/lint@45dcf33362aa3721f965cc1b60cd379aee8c7146 # feat/native-github-coverage
with:
# uv project directory.
# Default: `.`
working-directory: .
- # Trusted Bash command replacing the default checks. Generate SARIF or Checkstyle reports for annotations.
+ # Trusted Bash replacement for Ruff, Black and mypy. Write the declared reports under CI_REPORTS_DIR.
command: ""
- # Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted.
- report-group: ""
+ # Required lint report paths relative to CI_REPORTS_DIR, one per line.
+ # Default: `ruff.sarif`
+ lint-results: ruff.sarif
```
@@ -75,11 +61,11 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Inputs
-| **Input** | **Description** | **Required** | **Default** |
-| ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------ | ----------- |
-| **`working-directory`** | uv project directory. | **false** | `.` |
-| **`command`** | Trusted Bash command replacing the default checks. Generate SARIF or Checkstyle reports for annotations. | **false** | - |
-| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - |
+| **Input** | **Description** | **Required** | **Default** |
+| ----------------------- | --------------------------------------------------------------------------------------------------- | ------------ | ------------ |
+| **`working-directory`** | uv project directory. | **false** | `.` |
+| **`command`** | Trusted Bash replacement for Ruff, Black and mypy. Write the declared reports under CI_REPORTS_DIR. | **false** | - |
+| **`lint-results`** | Required lint report paths relative to CI_REPORTS_DIR, one per line. | **false** | `ruff.sarif` |
@@ -90,9 +76,9 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Outputs
-| **Output** | **Description** |
-| ------------------------ | --------------------------------------------------------------- |
-| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. |
+| **Output** | **Description** |
+| ------------------------ | -------------------------- |
+| **`report-artifact-id`** | Native lint report bundle. |
@@ -105,28 +91,12 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
-
-## Contributing
-
-Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-python/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 c24e15f..6227f1e 100644
--- a/actions/lint/action.yml
+++ b/actions/lint/action.yml
@@ -1,22 +1,14 @@
----
name: Lint Python
description: |
- Run project-locked Ruff, Black and mypy.
+ Check Python using project-locked Ruff, Black and mypy.
- Declare all three in the default uv dependency groups and configure them in
- `pyproject.toml`. Ruff emits SARIF, Black checks formatting and mypy checks types.
- All three execute even after one fails. A trusted Bash `command` replaces defaults;
- emit SARIF or Checkstyle to retain annotations from custom checks.
+ Run setup-python first and declare these tools in the default uv dependency groups.
+ All checks execute even when another fails. Ruff writes SARIF into a fresh
+ report directory. Custom commands receive CI_REPORTS_DIR.
-
-
-
- Run [setup-python](../setup-python/README.md) first with the same `working-directory`.
-
- Native reports survive command failures and are retained for seven days.
- See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions.
-
-
+ Native diagnostics are validated and retained after failures
+ as well as success. The common publish-ci-reports workflow publishes the final feedback.
+ Producer jobs require actions: read and contents: read.
author: hoverkraft
branding:
icon: package
@@ -26,15 +18,16 @@ inputs:
description: uv project directory.
default: .
command:
- description: Trusted Bash command replacing the default checks. Generate SARIF or Checkstyle reports for annotations.
- default: ""
- report-group:
- description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted.
+ description: Trusted Bash replacement for Ruff, Black and mypy. Write the
+ declared reports under CI_REPORTS_DIR.
default: ""
+ lint-results:
+ description: Required lint report paths relative to CI_REPORTS_DIR, one per line.
+ default: ruff.sarif
outputs:
report-artifact-id:
- description: Native report artifact ID. Empty when no reports were produced.
- value: ${{ steps.report-artifact.outputs.artifact-id }}
+ description: Native lint report bundle.
+ value: ${{ steps.reports.outputs.artifact-id }}
runs:
using: composite
steps:
@@ -42,12 +35,39 @@ runs:
uses: hoverkraft-tech/ci-github-common/actions/working-directory@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
with:
working-directory: ${{ inputs.working-directory }}
+ - id: definition
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ DIRECTORY: ${{ steps.directory.outputs.workspace-relative-path || '.' }}
+ WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }}
+ LINT_RESULTS: ${{ inputs.lint-results }}
+ with:
+ script: |
+ const paths = value => {
+ const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean);
+ if (!result.length) throw new Error('Required report paths must not be empty.');
+ return result;
+ };
+ const reports = paths(process.env.LINT_RESULTS).map(pattern => ({kind: 'lint', pattern}));
+ const runtime = await exec.getExecOutput('uv', ['run', '--locked', 'python', '-c', 'import platform; print(platform.python_version())'], {cwd: process.env.WORKING_DIRECTORY, silent: true});
+ core.setOutput('definition', {name: 'Python lint', project: process.env.DIRECTORY, variant: {runtime: runtime.stdout.trim()}, reports});
+ - id: prepare
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ with:
+ script: |
+ const fs = require('node:fs');
+ const path = require('node:path');
+ core.setOutput('report-directory', fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'ci-reports-')));
+ core.setOutput('definition', process.env.REPORT_DEFINITION);
+ env:
+ REPORT_DEFINITION: ${{ steps.definition.outputs.definition }}
- id: run
shell: bash
working-directory: ${{ steps.directory.outputs.absolute-path }}
env:
COMMAND: ${{ inputs.command }}
CI: "true"
+ CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }}
run: |
if [ -n "$COMMAND" ] && ! [[ "$COMMAND" =~ [^[:space:]] ]]; then
echo "command must not contain only whitespace." >&2
@@ -58,16 +78,15 @@ runs:
exit
fi
status=0
- uv run --locked ruff check --output-format=sarif --output-file=ruff.sarif . || status=1
+ uv run --locked ruff check --output-format=sarif --output-file="$CI_REPORTS_DIR/ruff.sarif" . || status=1
uv run --locked black --check . || status=1
uv run --locked mypy . || status=1
exit "$status"
- - name: Report lint results
- id: report-artifact
- if: ${{ !cancelled() && steps.run.outcome != 'skipped' }}
- uses: $/.github/actions/parse-ci-reports
+ - id: reports
+ name: Prepare and retain reports
+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' }}
+ uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased)
with:
- directory: ${{ steps.directory.outputs.absolute-path }}
- report-paths: auto:lint
- report-name: Python lint results
- group: ${{ inputs.report-group || github.job }}
+ 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 fbb8e2e..2b57d7a 100644
--- a/actions/test/README.md
+++ b/actions/test/README.md
@@ -2,12 +2,6 @@
#  GitHub Action: Test Python
-
-

-
-
----
-
@@ -17,9 +11,7 @@
[](https://github.com/marketplace/actions/test-python)
[](https://github.com/hoverkraft-tech/ci-github-python/releases)
-[](http://choosealicense.com/licenses/mit/)
[](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-python?style=social)
-[](https://github.com/hoverkraft-tech/ci-github-python/blob/main/CONTRIBUTING.md)
@@ -29,32 +21,16 @@
## Overview
-Run project-locked pytest with JUnit and Cobertura coverage.
-
-Declare pytest and pytest-cov in the default uv dependency groups. Configure
-coverage sources in `[tool.coverage.run]` to avoid measuring unrelated code.
-A trusted Bash `command` replaces the default and must produce JUnit for test
-reporting and `cobertura.xml` for coverage. The common parser handles both formats.
-
-
-
-
-Run [setup-python](../setup-python/README.md) first with the same `working-directory`.
-
-
-
-`coverage: "github"` is the default. Set `coverage: "codecov"` and grant the
-job `id-token: write` for OIDC upload of `cobertura.xml`. An empty coverage
-value disables publication while retaining JUnit; collection is controlled by
-the command. Custom commands must produce the applicable report files.
+Run pytest with detailed test results on every runtime and optional coverage.
-
-
+Run setup-python first. Default commands write JUnit and coverage.py XML into a
+fresh directory. Configure measured packages in [tool.coverage.run].
+Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE.
-Native reports survive command failures and are retained for seven days.
-See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions.
-
-
+Reports are validated after execution, including after
+command failure. Missing or malformed required reports fail the action. Call
+the common publish-ci-reports workflow once after all checks; no report outputs need forwarding.
+Producer jobs require actions: read and contents: read.
@@ -66,23 +42,26 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Usage
```yaml
-- uses: hoverkraft-tech/ci-github-python/actions/test@4b801b911424c68370a3e713bc5404151ab4d772 # main
+- uses: hoverkraft-tech/ci-github-python/actions/test@45dcf33362aa3721f965cc1b60cd379aee8c7146 # feat/native-github-coverage
with:
# uv project directory.
# Default: `.`
working-directory: .
- # Trusted Bash test command. Configure measured packages in [tool.coverage.run]. Generate junit.xml and cobertura.xml for reporting.
- # Default: `uv run --locked pytest --junitxml=junit.xml --cov --cov-report=term-missing --cov-report=xml:cobertura.xml`
- command: uv run --locked pytest --junitxml=junit.xml --cov
- --cov-report=term-missing --cov-report=xml:cobertura.xml
+ # Trusted Bash command replacing pytest. Write reports under CI_REPORTS_DIR and honor CI_TEST_COVERAGE for instrumentation.
+ command: ""
+
+ # Collect test coverage. The default pytest command disables instrumentation when false.
+ # Default: `true`
+ coverage: "true"
- # Publication only: `github`, `codecov`, or empty. Collection is controlled by command.
- # Default: `github`
- coverage: github
+ # Required test report paths relative to CI_REPORTS_DIR, one per line.
+ # Default: `junit.xml`
+ test-results: junit.xml
- # Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted.
- report-group: ""
+ # Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line.
+ # Default: `coverage.xml`
+ test-coverage: coverage.xml
```
@@ -91,12 +70,13 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Inputs
-| **Input** | **Description** | **Required** | **Default** |
-| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------ |
-| **`working-directory`** | uv project directory. | **false** | `.` |
-| **`command`** | Trusted Bash test command. Configure measured packages in [tool.coverage.run]. Generate junit.xml and cobertura.xml for reporting. | **false** | `uv run --locked pytest --junitxml=junit.xml --cov --cov-report=term-missing --cov-report=xml:cobertura.xml` |
-| **`coverage`** | Publication only: `github`, `codecov`, or empty. Collection is controlled by command. | **false** | `github` |
-| **`report-group`** | Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted. | **false** | - |
+| **Input** | **Description** | **Required** | **Default** |
+| ----------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------- |
+| **`working-directory`** | uv project directory. | **false** | `.` |
+| **`command`** | Trusted Bash command replacing pytest. Write reports under CI_REPORTS_DIR and honor CI_TEST_COVERAGE for instrumentation. | **false** | - |
+| **`coverage`** | Collect test coverage. The default pytest command disables instrumentation when false. | **false** | `true` |
+| **`test-results`** | Required test report paths relative to CI_REPORTS_DIR, one per line. | **false** | `junit.xml` |
+| **`test-coverage`** | Required native coverage paths relative to CI_REPORTS_DIR when coverage is enabled, one per line. | **false** | `coverage.xml` |
@@ -107,9 +87,9 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
## Outputs
-| **Output** | **Description** |
-| ------------------------ | --------------------------------------------------------------- |
-| **`report-artifact-id`** | Native report artifact ID. Empty when no reports were produced. |
+| **Output** | **Description** |
+| ------------------------ | --------------------------------------------------------------------- |
+| **`report-artifact-id`** | Native report bundle, including available diagnostics after failures. |
@@ -122,28 +102,12 @@ See the [continuous integration workflow](../../.github/workflows/continuous-int
-
-## Contributing
-
-Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-python/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.test.cjs b/actions/test/action.test.cjs
index 25ba88b..5b8573d 100644
--- a/actions/test/action.test.cjs
+++ b/actions/test/action.test.cjs
@@ -25,7 +25,7 @@ test("custom commands retain quoting and fail without continuing to default tool
assert.equal(fs.readFileSync(output, "utf8"), 'quotes " and $(not-executed)');
});
-test("test configuration rejects unsupported coverage destinations", (t) => {
+test("test configuration rejects non-boolean coverage configuration", (t) => {
const directory = createWorkspace(t);
assert.notEqual(
runActionStep(actionFile, "validate", directory, {
@@ -36,9 +36,35 @@ test("test configuration rejects unsupported coverage destinations", (t) => {
);
assert.equal(
runActionStep(actionFile, "validate", directory, {
- COVERAGE: "",
+ COVERAGE: "true",
RACE: "true",
}).status,
0,
);
});
+
+test("the default command writes into the fresh directory and disables coverage on secondary runtimes", (t) => {
+ const directory = createWorkspace(t);
+ const log = path.join(directory, "arguments.json");
+ fs.writeFileSync(
+ path.join(directory, "uv"),
+ `#!/usr/bin/env node
+require("node:fs").writeFileSync(process.env.ARGUMENT_LOG, JSON.stringify(process.argv.slice(2)));
+`,
+ { mode: 0o700 },
+ );
+ for (const coverage of ["true", "false"]) {
+ const result = runActionStep(actionFile, "run", directory, {
+ COMMAND: "",
+ CI_TEST_COVERAGE: coverage,
+ CI_REPORTS_DIR: path.join(directory, "fresh reports"),
+ PATH: `${directory}:${process.env.PATH}`,
+ ARGUMENT_LOG: log,
+ });
+ assert.equal(result.status, 0, result.stderr);
+ const args = JSON.parse(fs.readFileSync(log, "utf8"));
+ assert.ok(args.includes(`--junitxml=${directory}/fresh reports/junit.xml`));
+ assert.equal(args.includes("--no-cov"), coverage === "false");
+ assert.equal(args.includes("--cov"), coverage === "true");
+ }
+});
diff --git a/actions/test/action.yml b/actions/test/action.yml
index 2cc92d1..d8244a3 100644
--- a/actions/test/action.yml
+++ b/actions/test/action.yml
@@ -1,32 +1,15 @@
----
name: Test Python
description: |
- Run project-locked pytest with JUnit and Cobertura coverage.
+ Run pytest with detailed test results on every runtime and optional coverage.
- Declare pytest and pytest-cov in the default uv dependency groups. Configure
- coverage sources in `[tool.coverage.run]` to avoid measuring unrelated code.
- A trusted Bash `command` replaces the default and must produce JUnit for test
- reporting and `cobertura.xml` for coverage. The common parser handles both formats.
+ Run setup-python first. Default commands write JUnit and coverage.py XML into a
+ fresh directory. Configure measured packages in [tool.coverage.run].
+ Custom commands receive CI_REPORTS_DIR and CI_TEST_COVERAGE.
-
-
-
- Run [setup-python](../setup-python/README.md) first with the same `working-directory`.
-
-
-
- `coverage: "github"` is the default. Set `coverage: "codecov"` and grant the
- job `id-token: write` for OIDC upload of `cobertura.xml`. An empty coverage
- value disables publication while retaining JUnit; collection is controlled by
- the command. Custom commands must produce the applicable report files.
-
-
-
-
- Native reports survive command failures and are retained for seven days.
- See the [continuous integration workflow](../../.github/workflows/continuous-integration.md#reports-and-permissions) for consolidated reporting and permissions.
-
-
+ Reports are validated after execution, including after
+ command failure. Missing or malformed required reports fail the action. Call
+ the common publish-ci-reports workflow once after all checks; no report outputs need forwarding.
+ Producer jobs require actions: read and contents: read.
author: hoverkraft
branding:
icon: package
@@ -36,18 +19,24 @@ inputs:
description: uv project directory.
default: .
command:
- description: Trusted Bash test command. Configure measured packages in [tool.coverage.run]. Generate junit.xml and cobertura.xml for reporting.
- default: uv run --locked pytest --junitxml=junit.xml --cov --cov-report=term-missing --cov-report=xml:cobertura.xml
- coverage:
- description: "Publication only: `github`, `codecov`, or empty. Collection is controlled by command."
- default: github
- report-group:
- description: Outer calling job ID for consolidated ci-reports. Defaults to the current job ID. No individual PR comments are posted.
+ description: Trusted Bash command replacing pytest. Write reports under
+ CI_REPORTS_DIR and honor CI_TEST_COVERAGE for instrumentation.
default: ""
+ coverage:
+ description: Collect test coverage. The default pytest command disables
+ instrumentation when false.
+ default: "true"
+ test-results:
+ description: Required test report paths relative to CI_REPORTS_DIR, one per line.
+ default: junit.xml
+ test-coverage:
+ description: Required native coverage paths relative to CI_REPORTS_DIR when
+ coverage is enabled, one per line.
+ default: coverage.xml
outputs:
report-artifact-id:
- description: Native report artifact ID. Empty when no reports were produced.
- value: ${{ steps.report-artifact.outputs.artifact-id }}
+ description: Native report bundle, including available diagnostics after failures.
+ value: ${{ steps.reports.outputs.artifact-id }}
runs:
using: composite
steps:
@@ -60,33 +49,66 @@ runs:
env:
COVERAGE: ${{ inputs.coverage }}
run: |
- case "$COVERAGE" in github|codecov|'') ;; *) echo 'coverage must be github, codecov or empty.' >&2; exit 1 ;; esac
+ case "$COVERAGE" in true|false) ;; *) echo "coverage must be true or false." >&2; exit 1 ;; esac
+ - id: definition
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ DIRECTORY: ${{ steps.directory.outputs.workspace-relative-path || '.' }}
+ WORKING_DIRECTORY: ${{ steps.directory.outputs.absolute-path }}
+ TEST_RESULTS: ${{ inputs.test-results }}
+ TEST_COVERAGE: ${{ inputs.test-coverage }}
+ COVERAGE: ${{ inputs.coverage }}
+ with:
+ script: |
+ const paths = value => {
+ const result = value.split(/\r?\n/).map(item => item.trim()).filter(Boolean);
+ if (!result.length) throw new Error('Required report paths must not be empty.');
+ return result;
+ };
+ const reports = paths(process.env.TEST_RESULTS).map(pattern => ({kind: 'test', pattern}));
+ if (process.env.COVERAGE === 'true') reports.push(...paths(process.env.TEST_COVERAGE).map(pattern => ({kind: 'coverage', pattern, language: 'Python'})));
+ const runtime = await exec.getExecOutput('uv', ['run', '--locked', 'python', '-c', 'import platform; print(platform.python_version())'], {cwd: process.env.WORKING_DIRECTORY, silent: true});
+ core.setOutput('definition', {name: 'Python tests', project: process.env.DIRECTORY, variant: {runtime: runtime.stdout.trim()}, reports});
+ - id: prepare
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ with:
+ script: |
+ const fs = require('node:fs');
+ const path = require('node:path');
+ core.setOutput('report-directory', fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'ci-reports-')));
+ core.setOutput('definition', process.env.REPORT_DEFINITION);
+ env:
+ REPORT_DEFINITION: ${{ steps.definition.outputs.definition }}
- id: run
shell: bash
working-directory: ${{ steps.directory.outputs.absolute-path }}
env:
COMMAND: ${{ inputs.command }}
CI: "true"
+ CI_REPORTS_DIR: ${{ steps.prepare.outputs.report-directory }}
+ CI_TEST_COVERAGE: ${{ inputs.coverage }}
+ COVERAGE_FILE: ${{ steps.prepare.outputs.report-directory }}/.coverage
run: |
- test -n "$COMMAND" || { echo "command must not be empty." >&2; exit 1; }
if [ -n "$COMMAND" ] && ! [[ "$COMMAND" =~ [^[:space:]] ]]; then
echo "command must not contain only whitespace." >&2
exit 1
fi
- bash --noprofile --norc -e -u -o pipefail -c "$COMMAND"
- - name: Report test results
- id: report-artifact
- if: ${{ !cancelled() && steps.run.outcome != 'skipped' }}
- uses: $/.github/actions/parse-ci-reports
- with:
- directory: ${{ steps.directory.outputs.absolute-path }}
- report-paths: ${{ inputs.coverage == 'github' && 'auto:test,auto:coverage' || 'auto:test' }}
- report-name: Python test results
- group: ${{ inputs.report-group || github.job }}
- - name: Upload coverage to Codecov
- if: ${{ !cancelled() && steps.run.outcome != 'skipped' && inputs.coverage == 'codecov' }}
- uses: hoverkraft-tech/ci-github-common/actions/quality/codecov@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
+ if [ -n "$COMMAND" ]; then
+ bash --noprofile --norc -e -u -o pipefail -c "$COMMAND"
+ exit
+ fi
+ args=(--junitxml="$CI_REPORTS_DIR/junit.xml")
+ if [ "$CI_TEST_COVERAGE" = true ]; then
+ args+=(--cov --cov-report=term-missing --cov-report="xml:$CI_REPORTS_DIR/coverage.xml")
+ else
+ args+=(--no-cov)
+ fi
+ uv run --locked pytest "${args[@]}"
+ - id: reports
+ name: Prepare and retain reports
+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' }}
+ uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@23aa1846c8c6d829f321984b6d0252ebc36b01ee # PR #683 (unreleased)
with:
- working-directory: ${{ steps.directory.outputs.absolute-path }}
- files: cobertura.xml
- fail-ci-if-error: "true"
+ 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 2a9dd43..000566e 100644
--- a/docs/development/README.md
+++ b/docs/development/README.md
@@ -2,9 +2,8 @@
Install Node.js from `.node-version`, npm, uv and a supported Python runtime, and Docker.
Node.js and the development-only `yaml` dependency exercise the actual inline
-Actions configuration scripts. Lint and test actions share the internal
-[parse-ci-reports action](../../.github/actions/parse-ci-reports/README.md), which owns
-file selection, unique artifact naming and uploads.
+Actions configuration scripts. Lint and test actions use common `prepare-ci-reports` for fresh-file validation,
+execution identity and retention. Native parsers and publication live only in common.
```sh
make setup
@@ -43,8 +42,7 @@ The Node tests execute workflow configuration directly to check matrix selection
disable switches and invalid input.
Action contract tests live beside each action as `action.test.cjs`, including
[setup](../../actions/setup-python/action.test.cjs),
-[lint](../../actions/lint/action.test.cjs), [test](../../actions/test/action.test.cjs)
-and [report parsing](../../.github/actions/parse-ci-reports/action.test.cjs).
+[lint](../../actions/lint/action.test.cjs) and [test](../../actions/test/action.test.cjs).
They execute the actual Bash and JavaScript from adjacent action metadata to
check quoting, failure propagation, setup preconditions and artifact selection.
`make test` discovers these files and the workflow configuration tests.
@@ -111,3 +109,15 @@ Markdown validation.
Super-Linter reads the fixture's `pyproject.toml` for Black, Ruff, isort and mypy.
It uses the same first-party import classification as project-local checks.
+
+## Reporting boundary
+
+One outer `ci-reports` job publishes all evidence. A separate required `CI complete`
+job calls `check-jobs.yml` to check every producer and reporting. Failed native tests
+fail the producer, while valid reports can still be published successfully.
+Unexpected skips fail the gate. Configure explicitly allowed conditional skips
+in the caller; the reporting workflow owns no skip policy.
+
+The Node contract suites execute inline workflow scripts; they retain JUnit results
+without requesting an empty JavaScript coverage measurement. The language fixture
+collects application coverage on its primary runtime.
diff --git a/package.json b/package.json
index 6054c70..eb5cfb5 100644
--- a/package.json
+++ b/package.json
@@ -3,8 +3,8 @@
"private": true,
"description": "Development-only tests for GitHub Actions configuration",
"scripts": {
- "test": "node --test tests/*.test.cjs actions/*/*.test.cjs .github/actions/*/*.test.cjs",
- "test:ci": "node --test"
+ "test": "node --test tests/*.test.cjs actions/*/*.test.cjs",
+ "test:ci": "node $(test \"$CI_TEST_COVERAGE\" = true && printf %s --experimental-test-coverage) --test-reporter=lcov --test-reporter-destination=\"$CI_REPORTS_DIR/lcov.info\" --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=\"$CI_REPORTS_DIR/junit.xml\""
},
"devDependencies": {
"yaml": "2.9.1"
diff --git a/tests/config.test.cjs b/tests/config.test.cjs
index e2679f6..f7579d1 100644
--- a/tests/config.test.cjs
+++ b/tests/config.test.cjs
@@ -31,16 +31,17 @@ async function parse(env = {}) {
return outputs;
}
-test("uses project detection by default and the last explicit version as primary", async () => {
+test("uses project detection by default and the highest explicit version as primary", async () => {
const automatic = await parse();
assert.deepEqual(automatic.versions, [""]);
assert.equal(automatic["primary-version"], "");
- const explicit = await parse({ VERSIONS: '["3.13", "3.15"]' });
- assert.equal(explicit["primary-version"], explicit.versions.at(-1));
+ const explicit = await parse({ VERSIONS: '["3.15", "3.13"]' });
+ assert.equal(explicit["primary-version"], "3.15");
});
test("rejects ambiguous or unbounded version matrices", async () => {
for (const value of [
+ '["", "3.15"]',
"[]",
'["1.2", "1.2"]',
"[1.2]",
@@ -61,17 +62,17 @@ test("disables checks and preserves explicitly supplied command bytes", async ()
}
const command = 'printf "%s\n" "$VALUE"\nexit 17';
const result = await parse({
- TEST: JSON.stringify({ command, coverage: "" }),
+ TEST: JSON.stringify({ command, coverage: false }),
});
assert.equal(JSON.parse(result.test).command, command);
- assert.equal(JSON.parse(result.test).coverage, "");
+ assert.equal(JSON.parse(result.test).coverage, false);
assert.equal(
JSON.parse((await parse({ LINT: "make lint" })).lint).command,
"make lint",
);
});
-test("rejects misspelled options, invalid types and unknown coverage providers", async () => {
+test("rejects misspelled options, invalid types and non-boolean coverage options", async () => {
for (const key of ["LINT", "TEST"]) {
for (const value of [
"{",
@@ -87,7 +88,7 @@ test("rejects misspelled options, invalid types and unknown coverage providers",
);
}
}
- for (const coverage of ["unknown", false, null]) {
+ for (const coverage of ["unknown", "false", null]) {
await assert.rejects(() => parse({ TEST: JSON.stringify({ coverage }) }));
}
});
@@ -113,3 +114,22 @@ test("distribution checks are opt-in and validate consumer commands", async () =
await assert.rejects(() => parse({ PACKAGE: value }));
}
});
+
+test("preserves declared native reports and rejects ambiguous input types", async () => {
+ const options = {
+ coverage: true,
+ "test-results": "junit.xml",
+ "test-coverage": "native.xml",
+ };
+ const actual = JSON.parse(
+ (await parse({ TEST: JSON.stringify(options) })).test,
+ );
+ for (const [key, value] of Object.entries(options))
+ assert.deepEqual(actual[key], value);
+ for (const invalid of [
+ { "test-coverage": {} },
+ { "report-plan": "obsolete" },
+ ]) {
+ await assert.rejects(() => parse({ TEST: JSON.stringify(invalid) }));
+ }
+});