Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 54 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ permissions:

jobs:
python:
env:
COVERAGE_RCFILE: ${{ github.workspace }}/pyproject.toml
COVERAGE_FILE: ${{ github.workspace }}/coverage/python/.coverage
name: "${{ matrix.check }}"
runs-on: ubuntu-latest
timeout-minutes: 15
Expand All @@ -20,7 +23,7 @@ jobs:
- check: Python lint
command: uv run --extra test ruff check maintainer products
- check: Python test
command: uv run --extra test pytest
command: uv run --extra test coverage run -m pytest
- check: GitLab scripts
command: |
staging=$(mktemp -d)
Expand Down Expand Up @@ -52,6 +55,30 @@ jobs:
- name: Run check
run: ${{ matrix.command }}

- name: Report Python coverage
if: always() && matrix.check == 'Python test'
run: |
uv run --extra test coverage combine
uv run --extra test coverage html
uv run --extra test coverage xml
uv run --extra test coverage json
python -c 'import json; t=json.load(open("coverage/python/coverage.json"))["totals"]; print("Python coverage: {percent_statements_covered:.1f}% statements · {percent_branches_covered:.1f}% branches".format(**t))' \
| tee -a "$GITHUB_STEP_SUMMARY"
{
echo '## Python source coverage'
uv run --extra test coverage report --format=markdown
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload Python coverage
if: always() && matrix.check == 'Python test'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-coverage
path: |
coverage/python/html/
coverage/python/coverage.xml
coverage/python/coverage.json
if-no-files-found: warn

skill-bundle:
name: Skill bundle
runs-on: ubuntu-latest
Expand Down Expand Up @@ -89,7 +116,7 @@ jobs:
- check: astro
command: npm --prefix products/deployment-kit/operator/site run typecheck:astro
- check: test
command: npm --prefix products/deployment-kit/operator/site run test
command: npm --prefix maintainer/coverage test
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -101,9 +128,34 @@ jobs:
node-version: ">=22.23.4 <23"
- name: Install site dependencies
run: npm ci --prefix products/deployment-kit/operator/site
- name: Install coverage tooling
if: matrix.check == 'test'
run: npm ci --prefix maintainer/coverage
- name: Run check
run: ${{ matrix.command }}

- name: Summarize Node coverage
if: always() && matrix.check == 'test'
run: |
node -e 'const {total:t}=require("./coverage/node/coverage-summary.json"); console.log("Node coverage: " + t.statements.pct.toFixed(1) + "% statements · " + t.branches.pct.toFixed(1) + "% branches")' \
| tee -a "$GITHUB_STEP_SUMMARY"
{
echo '## Node utilities and build scripts'
echo 'Browser-executed React and Astro UI coverage is not measured.'
echo '```text'
npm --prefix maintainer/coverage run --silent summary
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload Node coverage
if: always() && matrix.check == 'test'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: node-coverage
path: |
coverage/node/
!coverage/node/tmp/
if-no-files-found: warn

markdown:
name: "Markdown ${{ matrix.check }}"
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ __pycache__/

# Assessment diagnostics are local/CI output, not BOE.
scanner.log

# Test coverage reports.
.coverage*
/coverage/
/maintainer/coverage/node_modules/
28 changes: 28 additions & 0 deletions CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,34 @@ Tests exercise program behavior and compare the results with expectations. **Lin

The GitLab script checks inspect the templates in the arrangement customers receive. They do not submit them to GitLab's validation service or prove that a customer's project can start a pipeline. A **pipeline** is GitLab's term for an automated run of jobs. See [local lint checks](docs/linting.md) for exact commands and limitations, and [Contributing](CONTRIBUTING.md#local-checks) to run checks before submitting changes.

### Test coverage reports

The Python and site test jobs publish separate coverage summaries and downloadable `python-coverage` and `node-coverage` artifacts, including reports when tests fail after collecting data. Download and extract an artifact, then open its HTML report to inspect uncovered code. Python also provides XML and JSON; Node provides LCOV and summary JSON. Reports are informational and do not enforce a minimum percentage.

Python measures all assessment, Operator, and maintainer source modules, including Python subprocesses. Node measures `.mjs` utilities under `site/src/lib/` and build scripts under `site/scripts/`, including files never loaded by a test. It does not measure browser-executed React components or Astro pages. Tests that execute copied scripts in temporary fixtures do not credit those copies to the original source path, so those scripts can appear uncovered. These scopes have separate totals.

To reproduce Python coverage from the repository root:

```sh
export COVERAGE_RCFILE="$PWD/pyproject.toml"
export COVERAGE_FILE="$PWD/coverage/python/.coverage"
uv run --extra test coverage erase
uv run --extra test coverage run -m pytest
uv run --extra test coverage combine
uv run --extra test coverage report
uv run --extra test coverage html
```

To reproduce Node coverage from the repository root:

```sh
npm ci --prefix products/deployment-kit/operator/site
npm ci --prefix maintainer/coverage
npm --prefix maintainer/coverage test
```

Open `coverage/node/index.html` for the report. The maintainer coverage package runs the existing site tests with c8.

### Why the website needs assessment reports

A published exchange shows skills alongside their assessment evidence. The build must therefore avoid showing an old report as though it reviewed a changed skill.
Expand Down
6 changes: 6 additions & 0 deletions maintainer/coverage/c8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"all": true,
"include": ["src/lib/**/*.mjs", "scripts/**/*.mjs"],
"reports-dir": "../../../../coverage/node",
"reporter": ["text", "html", "lcovonly", "json-summary"]
}
Loading