Skip to content

Publish Pester test and coverage results in GitHub UI #114

@blindzero

Description

@blindzero

Problem Statement

In CI, Pester currently generates:

  • Test results: artifacts/test-results.xml (NUnitXml)
  • Coverage results: artifacts/coverage.xml (JaCoCo XML)

These files are uploaded as GitHub Actions artifacts, but GitHub does not render them in a TeamCity-like way. Consumers must download ZIP artifacts to inspect failures/coverage, which slows reviews and reduces visibility in PRs and workflow runs.

Proposed Solution

Enhance the CI workflow to publish Pester test and coverage results in GitHub’s UI:

  1. Publish test results as a GitHub Check

    • Use a test report action that supports NUnit XML (e.g. dorny/test-reporter)
    • Run with if: always() so failures still produce a report
    • Ensure required permissions for checks (e.g. checks: write)
  2. Publish coverage results in GitHub UI

    • Keep the existing Pester coverage output format (JaCoCo XML) and use a JaCoCo reporter action to create a Check and/or Job Summary.
    • Additionally write a compact coverage summary into $GITHUB_STEP_SUMMARY (percentage + covered/total lines if available).
  3. Fork/PR safety

    • If Check creation is restricted for PRs from forks, gate reporting appropriately (e.g. only on non-fork PRs), or adopt a workflow_run pattern to render reports from uploaded artifacts.

Acceptance Criteria

  • A PR shows a Tests check with pass/fail and a readable list of failing tests (no artifact download required).
  • The workflow run shows a readable coverage summary (check and/or run summary).
  • Reports are produced even when tests fail (if: always()).
  • The solution works for typical contribution flows and does not require external services (Codecov/Coveralls optional, not required).

Alternatives Considered

  • Artifacts only (status quo): simplest, but reviewers must download ZIPs and manually inspect XML.
  • External coverage services (Codecov/Coveralls): great UX, but adds third-party dependency and configuration overhead.
  • Convert coverage format to Cobertura: would unlock more generic coverage summary actions, but requires changing Pester coverage output configuration.

Impact

  • Does this affect existing workflows?
    • Only CI reporting; no runtime module behavior changes.
  • Any backward compatibility concerns?
    • None for module consumers.
    • CI permissions might need adjustment (checks: write), and fork PR behavior must be handled carefully.

Additional Context

  • Current CI already produces and uploads:
    • artifacts/test-results.xml (NUnitXml)
    • artifacts/coverage.xml (JaCoCo XML)
  • Desired outcome: reviewers can see failures/coverage directly in GitHub PR checks and/or workflow summaries, similar to other CI systems.

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions