Skip to content

Commit d6bc94d

Browse files
🌟 [Major]: Support parallel workflows and split in concerns (#98)
## Description This PR introduces a major update to the `Test-PSModule` GitHub Action, enabling flexible, parallelizable testing workflows β€” a key requirement for `Process-PSModule` v4. The action now supports isolated, configuration-driven test runs that can be executed in parallel using GitHub matrix jobs. This enables `Process-PSModule` to split testing across stages and environments (e.g., OS matrix, linting vs runtime tests), significantly improving modularity and execution time. Separate actions are created to collect and evaluate results from tests run in matrices. ### Changes - Replaces the previous `TestType` with `Settings` that defines which test preset to execute: - `SourceCode`: Lint source code using PSModule rules. - `Module`: Validate module using PSModule rules. - Move common PSModule functions to [Install-PSModuleHelpers](https://github.com/PSModule/Install-PSModuleHelpers). - Parallel Execution Support. Designed for matrix-based execution, e.g.: - Run linter and style tests in parallel. - Run Pester tests across Windows/macOS/Linux runners. - Delegates analysis and testing to - [Invoke-ScriptAnalyzer](https://github.com/PSModule/Invoke-ScriptAnalyzer) for static code analysis. - [Invoke-Pester](https://github.com/PSModule/Invoke-Pester) for test execution and coverage . These bring better portability, customization, and feature alignment with the broader PSModule ecosystem. - JSON Artifacts for Downstream Evaluation - Emits json structured outputs from Pesters test results and code coverage, so that the data from a matrix job can be evaluated in a later job using [Get-PesterTestResults](https://github.com/PSModule/Get-PesterTestResults) and [Get-PesterCodeCoverage](https://github.com/PSModule/Get-PesterCodeCoverage) - Clean Outputs for Chaining - Exposes a bigger set of data as outputs for downstream steps to consume. - Custom Analyzer Rule Support - Automatically picks up repo-level `PSScriptAnalyzerSettings.psd1` when running `SourceCode`. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] πŸ“– [Docs] - [ ] πŸͺ² [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] πŸš€ [Feature] - [x] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 1fd648f commit d6bc94d

File tree

104 files changed

+922
-768
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+922
-768
lines changed
Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Action-Test [Src-Default]
1+
name: Action-Test-Src-Default
22

3-
run-name: "Action-Test [Src-Default] - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
3+
run-name: 'Action-Test-Src-Default - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}'
44

55
on:
66
workflow_dispatch:
@@ -15,36 +15,21 @@ concurrency:
1515
permissions: {}
1616

1717
jobs:
18-
ActionTest:
18+
ActionTestSrcDefault:
19+
name: Action-Test [Src-Default] - [${{ matrix.os }}]
1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
os: [ubuntu-latest, macos-latest, windows-latest]
23-
name: Action-Test [Src-Default] - [${{ matrix.os }}]
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- name: Checkout repo
2727
uses: actions/checkout@v4
2828

29-
- name: Initialize environment
30-
uses: PSModule/Initialize-PSModule@main
31-
3229
- name: Action-Test
3330
uses: ./
3431
id: action-test
35-
env:
36-
GITHUB_TOKEN: ${{ github.token }}
3732
with:
3833
Name: PSModuleTest
39-
Path: tests/src
40-
TestType: SourceCode
41-
42-
- name: Status
43-
shell: pwsh
44-
env:
45-
PASSED: ${{ steps.action-test.outputs.passed }}
46-
run: |
47-
Write-Host "Passed: [$env:PASSED]"
48-
if ($env:PASSED -ne 'true') {
49-
exit 1
50-
}
34+
WorkingDirectory: tests/srcTestRepo
35+
Settings: SourceCode
Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Action-Test [Src-WithManifest]
1+
name: Action-Test-Src-WithManifest
22

3-
run-name: "Action-Test [Src-WithManifest] - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
3+
run-name: 'Action-Test-Src-WithManifest - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}'
44

55
on:
66
workflow_dispatch:
@@ -15,36 +15,21 @@ concurrency:
1515
permissions: {}
1616

1717
jobs:
18-
ActionTest:
18+
ActionTestsSrcWithManifest:
19+
name: Action-Test [Src-WithManifest] - [${{ matrix.os }}]
1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
os: [ubuntu-latest, macos-latest, windows-latest]
23-
name: Action-Test [Src-WithManifest] - [${{ matrix.os }}]
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- name: Checkout repo
2727
uses: actions/checkout@v4
2828

29-
- name: Initialize environment
30-
uses: PSModule/Initialize-PSModule@main
31-
3229
- name: Action-Test
3330
uses: ./
3431
id: action-test
35-
env:
36-
GITHUB_TOKEN: ${{ github.token }}
3732
with:
3833
Name: PSModuleTest
39-
Path: tests/srcWithManifest
40-
TestType: SourceCode
41-
42-
- name: Status
43-
shell: pwsh
44-
env:
45-
PASSED: ${{ steps.action-test.outputs.passed }}
46-
run: |
47-
Write-Host "Passed: [$env:PASSED]"
48-
if ($env:PASSED -ne 'true') {
49-
exit 1
50-
}
34+
WorkingDirectory: tests/srcWithManifestTestRepo
35+
Settings: SourceCode
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Action-Test [outputs]
1+
name: Action-Test-outputs
22

3-
run-name: "Action-Test [outputs] - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
3+
run-name: 'Action-Test-outputs - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}'
44

55
on:
66
workflow_dispatch:
@@ -15,36 +15,22 @@ concurrency:
1515
permissions: {}
1616

1717
jobs:
18-
ActionTest:
18+
ActionTestOutputs:
19+
name: Action-Test [outputs] - [${{ matrix.os }}]
1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
os: [ubuntu-latest, macos-latest, windows-latest]
23-
name: Action-Test [outputs] - [${{ matrix.os }}]
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- name: Checkout repo
2727
uses: actions/checkout@v4
2828

29-
- name: Initialize environment
30-
uses: PSModule/Initialize-PSModule@main
31-
3229
- name: Action-Test
3330
uses: ./
3431
id: action-test
35-
env:
36-
GITHUB_TOKEN: ${{ github.token }}
3732
with:
3833
Name: PSModuleTest
39-
Path: tests/outputs/modules
40-
TestType: Module
41-
42-
- name: Status
43-
shell: pwsh
44-
env:
45-
PASSED: ${{ steps.action-test.outputs.passed }}
46-
run: |
47-
Write-Host "Passed: [$env:PASSED]"
48-
if ($env:PASSED -ne 'true') {
49-
exit 1
50-
}
34+
WorkingDirectory: tests/outputTestRepo
35+
Settings: Module
36+
CodeCoverage_CoveragePercentTarget: 30

β€Ž.github/workflows/Auto-Release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,5 @@ jobs:
3030

3131
- name: Auto-Release
3232
uses: PSModule/Auto-Release@v1
33-
env:
34-
GITHUB_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
3533
with:
3634
IncrementalPrerelease: false

0 commit comments

Comments
Β (0)