-
Notifications
You must be signed in to change notification settings - Fork 0
🌟 [Major]: Introducing Get-PesterCodeCoverage
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…commenting out unused code sections
…ng output formatting
…ted, and analyzed commands
…consistency; update references in main.ps1 and improve output formatting in coverage logs.
… for improved error handling and messaging
…wn code fences for better readability
…executed commands, enhancing readability and structure in GitHub step summary.
…uted commands, improving formatting and readability
…nhancing readability in missed and executed commands
…to use markdown code fences for improved readability
…d replace new lines with line breaks for improved readability
…-breaking spaces, enhancing readability in displayed commands
…nhancing readability in displayed commands
…n command output for improved readability
…or improved readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the GitHub Action configuration and the associated workflow. The changes include updating action metadata in action.yml (action name, description, and inputs) and modifying the Auto-Release workflow by removing the explicit GITHUB_TOKEN environment variable.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
action.yml | Updated action name/description and modified default input values. |
.github/workflows/Auto-Release.yml | Removed the GITHUB_TOKEN environment variable in the release job step. |
Comments suppressed due to low confidence (2)
action.yml:27
- Changing the default WorkingDirectory from '${{ github.workspace }}' to '.' may cause path resolution issues if the action expects an absolute path. Please confirm that this change is intended and functions as expected in different repository contexts.
default: '.'
.github/workflows/Auto-Release.yml:32
- Removing the GITHUB_TOKEN environment variable may cause the Auto-Release action to fail if the token is required for authentication. Please verify that this removal is intentional and that the workflow has alternative means to access the necessary permissions.
env:
GITHUB_TOKEN: ${{ github.token }}
…on and streamline output formatting
… to utilize it for coverage target configuration
…e Normalize-IndentationExceptFirst function documentation in Helpers.psm1
- Created a new code coverage report XML file for the PSModuleTest module. - The report includes detailed coverage metrics for various methods and classes within the module. - Coverage statistics indicate missed instructions, lines, and methods, highlighting areas for potential improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 15 out of 19 changed files in this pull request and generated no comments.
Files not reviewed (4)
- scripts/Helpers.psm1: Language not supported
- scripts/main.ps1: Language not supported
- tests/CodeCoverage/Module-Windows-CodeCoverage/Module-Windows-CodeCoverage-Report.json: Language not supported
- tests/CodeCoverage/Module-macOS-CodeCoverage/Module-macOS-CodeCoverage-Report.json: Language not supported
Comments suppressed due to low confidence (3)
action.yml:28
- The default value for StepSummary_Mode is defined as 'Missed, Files' here but is documented as 'Missed,Files' in README.md. Please ensure the default value is consistent between the action definition and documentation.
StepSummary_Mode:
.github/workflows/Action-Test.yml:80
- The previous configuration included a working-directory setting, which has now been removed. Verify that this change is intentional and that the action is expected to run from the intended directory context.
StepSummary_Mode: Full
.github/workflows/Auto-Release.yml:31
- The removal of the GITHUB_TOKEN environment variable from the Auto-Release step might affect authentication. Confirm that the Auto-Release action now handles token management internally or that this change is intentional.
uses: PSModule/Auto-Release@v1
… for clarity and improved user guidance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the Get-PesterCodeCoverage GitHub Action that aggregates Pester code coverage reports, enforces coverage thresholds, and produces detailed summaries.
- Adds new inputs and updates action configuration in action.yml
- Revises workflow files (Action-Test.yml and Auto-Release.yml) to support multi-platform code coverage uploads and trigger behaviors
- Updates documentation (README.md) and removes placeholder test files
Reviewed Changes
Copilot reviewed 15 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/README.md | Removed placeholder content for tests |
action.yml | Updated configuration with new inputs and GitHub Action settings |
README.md | Enhanced documentation reflecting new functionality and usage details |
.github/workflows/Auto-Release.yml | Removed GITHUB_TOKEN env variable; verify its necessity |
.github/workflows/Action-Test.yml | Added artifact upload steps and updated inputs for improved testing |
Files not reviewed (4)
- scripts/Helpers.psm1: Language not supported
- scripts/main.ps1: Language not supported
- tests/CodeCoverage/Module-Windows-CodeCoverage/Module-Windows-CodeCoverage-Report.json: Language not supported
- tests/CodeCoverage/Module-macOS-CodeCoverage/Module-macOS-CodeCoverage-Report.json: Language not supported
Comments suppressed due to low confidence (1)
.github/workflows/Auto-Release.yml:31
- The removal of the GITHUB_TOKEN environment variable might affect authentication for auto-release; please verify that this change is intentional and that the release process still functions correctly.
- env:
…zation (#150) The **PSModule v4 release** is a major overhaul of the PowerShell module workflow, introducing significant architectural changes to improve speed, modularity, and maintainability. This update continues on the goal to split the once-monolithic process into distinct GitHub Actions for building, testing, documenting, and publishing modules. By refactoring the workflow into isolated steps and enabling parallel execution, v4 dramatically optimizes build and test times while ensuring a more reliable and customizable process for module developers.  <details><summary>Diagram - Old version</summary> <p>  </p> </details> ## Features ### Parallel Testing & Results Aggregation The workflow has been reworked to support flexible, parallelizable test runs. The `Test-PSModule` action will now execute tests in parallel via matrix jobs (e.g. across multiple OSes or test stages). Separate helper actions (`Get-PesterTestResults` and `Get-PesterCodeCoverage`) have been introduced to aggregate Pester test outcomes and code coverage from those parallel jobs, providing unified reporting and enforcing test success and coverage thresholds across the matrix. - Fixes #78 - Fixes #119 ### Central Configuration File A new configuration hierarchy allows customizing the process through a YAML (JSON or PSD1) settings file. Users can include a `.github/PSModule.yml` in their module repo to override defaults. This centralized config makes the pipeline more flexible and eliminates the need for hard-coded inputs in workflow files. - Fixes #144 - Fixes #81 - Fixes #159 ### Dedicated Documentation Step Documentation generation is now handled by a new `Document-PSModule` action. This step automatically builds the module's documentation (using PlatyPS) and uploads as an artifact, so that other steps can build a site and publish it to GitHub Pages. By isolating documentation in its own action, v4 ensures that doc-specific tools (e.g. PlatyPS and MkDocs) run without interference from build or test modules, and documentation is kept up-to-date with each release. - Fixes #148 - Fixes #77 - Fixes #95 ### Shared Helper Module Action A new `Install-PSModuleHelpers` action has been introduced as a foundational setup step. It installs and configures common helper functions used by the pipeline (for example, version specification conversion, module dependency resolution, and module installation utilities). This ensures all subsequent actions operate with a consistent environment and shared logic. Common functionality like resolving module dependencies (`Resolve-PSModuleDependency`) and version parsing has been consolidated here, reducing duplication across the build/test/publish steps. ### Enhanced Platform and Compatibility Support The v4 workflow expands support and testing across platforms and PowerShell versions. The Test-PSModule action runs on Windows, Linux, and macOS with PowerShell Core (and includes light support for Windows PowerShell 5.1 for basic compatibility). - Fixes #146 ### New test actions Static analysis is performed via a dedicated `Invoke-ScriptAnalyzer` GitHub action, and Pester tests are executed in an isolated context via the `Invoke-Pester` GitHub action, ensuring consistent behavior across different environments and increases the reusability of the automation we built around Pester. The new design also honors repository-specific analyzer settings (automatically picking up settings from `.github/linters/.powershell-psscriptanalyzer.psd1` in the repo for static code analysis), allowing module developers to customize linting rules. - Fixes #108 - Fixes #130 ### Modular Workflows By splitting the CI/CD process into discrete actions and enabling concurrency, the overall pipeline runtime is greatly reduced. Linting, unit tests, and integration tests can run in parallel, and the build step no longer blocks documentation or analysis. This *time-optimized process* means quicker feedback on pull requests and faster delivery of new module releases. ### Simplified Build & Publish Process The `Build-PSModule` action has been refactored into a pure module builder. New inputs like `ArtifactName` and `WorkingDirectory` give more control over build output naming and source path. The build step now produces a clean module package and uploads it as an artifact called `module`. Likewise, the **Publish-PSModule** action has been bumped to v2 with a clearer interface – it removes the old monolithic `ConfigurationFile` input in favor of explicit inputs and the new central settings file. The publish logic now uses the repository’s context (working directory defaulting to `.`) and respects the unified settings, simplifying how modules are published to the PowerShell Gallery. ### Robust Dependency Handling Module dependency resolution during builds is now more reliable and up-to-date. The pipeline switched to using **PSResourceGet** for installing required module dependencies, replacing the legacy PowerShellGet v2 approach. This change ensures compatibility with the latest PowerShell module packaging standards and improves the speed and success of acquiring dependencies. The helper scripts (`Convert-VersionSpec` and `Resolve-PSModuleDependency`) were moved into the shared helpers module, and their logic was hardened with better retry and null-check mechanisms when querying the PowerShell Gallery. - Fixes #62 ### Better Logging and Diagnostics Each action now provides more transparent logging and output for easier troubleshooting. The Publish step, for example, now logs all input parameters at the start of execution for traceability. Verbose logging in dependency resolution has been replaced with clear console output to ensure important information is always visible. The `Get-PesterTestResults` action prints a detailed summary of test suites executed, including counts of passed/failed/skipped tests, and will mark the workflow as failed if any tests did not run or failed – giving immediate feedback if something went wrong in the parallel test jobs. - Fixes #91 ### Other smaller issues - Fixes #82 ## Related actions and PRs - [Install-PSModuleHelpers](https://github.com/PSModule/Install-PSModuleHelpers) | PSModule/Install-PSModuleHelpers#2 - [Test-PSModule](https://github.com/PSModule/Test-PSModule) | PSModule/Test-PSModule#98 - [Get-PesterTestResults](https://github.com/PSModule/Get-PesterTestResults) | PSModule/Get-PesterTestResults#2 - [Get-PesterCodeCoverage](https://github.com/PSModule/Get-PesterCodeCoverage) | PSModule/Get-PesterCodeCoverage#1 - [Invoke-Pester](https://github.com/PSModule/Invoke-Pester) - [Invoke-ScriptAnalyzer](https://github.com/PSModule/Invoke-ScriptAnalyzer) - [Document-PSModule](https://github.com/PSModule/Document-PSModule) | PSModule/Document-PSModule#16 - [Build-PSModule](https://github.com/PSModule/Build-PSModule) | PSModule/Build-PSModule#108 - [Publish-PSModule](https://github.com/PSModule/Publish-PSModule) | PSModule/Publish-PSModule#49
Description
This pull request introduces the
Get-PesterCodeCoverage
GitHub Action that aggregates Pester code coverage reports and generates a detailed summary with coverage statistics.Core functionality
scripts/main.ps1
: Added functionality to aggregate Pester code coverage reports, normalize file paths, and compute aggregate coverage statistics. The action now enforces a coverage threshold and generates detailed GitHub step summaries with expandable sections for missed and executed commands.Tests
.github/workflows/Action-Test.yml
: Updated theAction-Test.yml
workflow to upload multiple code coverage artifacts for macOS and Windows environments and added new parameters (StepSummary_Mode
andCodeCoveragePercentTarget
) to control reporting behavior.tests/*
: Added tests reports to use for the Action-Test workflow.Documentation
README.md
: Updated README to reflect the new functionality, including detailed usage instructions, input descriptions, and example workflows. Added a comprehensive explanation of outputs and behavior.Action Metadata
action.yml
: Updated to align with the new functionality. Added new inputs (StepSummary_Mode
,CodeCoveragePercentTarget
) for customization.Type of change
Checklist