@@ -39,53 +39,174 @@ Depending on the labels in the pull requests, the [workflow will result in diffe
3939
4040![ Process diagram] ( ./media/Process-PSModule.png )
4141
42- - [ Get settings] ( #get-settings )
42+ - [ Process-PSModule] ( #process-psmodule )
43+ - [ How to get started] ( #how-to-get-started )
44+ - [ How it works] ( #how-it-works )
45+ - [ Workflow overview] ( #workflow-overview )
46+ - [ Get-Settings] ( #get-settings )
47+ - [ Lint-Repository] ( #lint-repository )
48+ - [ Get settings] ( #get-settings-1 )
49+ - [ Build module] ( #build-module )
50+ - [ Test source code] ( #test-source-code )
51+ - [ Lint source code] ( #lint-source-code )
52+ - [ Framework test] ( #framework-test )
53+ - [ Test module] ( #test-module )
54+ - [ Setup and Teardown Scripts] ( #setup-and-teardown-scripts )
55+ - [ Setup - ` BeforeAll.ps1 ` ] ( #setup---beforeallps1 )
56+ - [ Example - ` BeforeAll.ps1 ` ] ( #example---beforeallps1 )
57+ - [ Teardown - ` AfterAll.ps1 ` ] ( #teardown---afterallps1 )
58+ - [ Example - ` AfterAll.ps1 ` ] ( #example---afterallps1 )
59+ - [ Get test results] ( #get-test-results )
60+ - [ Get code coverage] ( #get-code-coverage )
61+ - [ Publish module] ( #publish-module )
62+ - [ Build docs] ( #build-docs )
63+ - [ Build site] ( #build-site )
64+ - [ Publish Docs] ( #publish-docs )
65+ - [ Usage] ( #usage )
66+ - [ Inputs] ( #inputs )
67+ - [ Secrets] ( #secrets )
68+ - [ Permissions] ( #permissions )
69+ - [ Scenario Matrix] ( #scenario-matrix )
70+ - [ Configuration] ( #configuration )
71+ - [ Example 1 - Defaults with Code Coverage target] ( #example-1---defaults-with-code-coverage-target )
72+ - [ Example 2 - Rapid testing] ( #example-2---rapid-testing )
73+ - [ Example 3 - Configuring the Repository Linter] ( #example-3---configuring-the-repository-linter )
74+ - [ Disabling the Linter] ( #disabling-the-linter )
75+ - [ Configuring Linter Validation Rules] ( #configuring-linter-validation-rules )
76+ - [ Additional Configuration] ( #additional-configuration )
77+ - [ Showing Linter Summary on Success] ( #showing-linter-summary-on-success )
78+ - [ Repository structure] ( #repository-structure )
79+ - [ Module source code structure] ( #module-source-code-structure )
80+ - [ Principles and practices] ( #principles-and-practices )
81+
82+ ### Get-Settings
83+
84+ [ workflow] ( ./.github/workflows/Get-Settings.yml )
85+
86+ ### Lint-Repository
87+
88+ [ workflow] ( ./.github/workflows/Lint-Repository.yml )
89+
90+ ### Get settings
91+
92+ [ workflow] ( #get-settings )
4393 - Reads the settings file ` github/PSModule.yml ` in the module repository to configure the workflow.
4494 - Gathers context for the process from GitHub and the repo files, configuring what tests to run, if and what kind of release to create, and wether
4595 to setup testing infrastructure and what operating systems to run the tests on.
46- - [ Build module] ( ./.github/workflows/Build-Module.yml )
96+
97+ ### Build module
98+
99+ [ workflow] ( ./.github/workflows/Build-Module.yml )
47100 - Compiles the module source code into a PowerShell module.
48- - [ Test source code] ( ./.github/workflows/Test-SourceCode.yml )
101+
102+ ### Test source code
103+
104+ [ workflow] ( ./.github/workflows/Test-SourceCode.yml )
49105 - Tests the source code in parallel (matrix) using:
50106 - [ PSModule framework settings for style and standards for source code] ( https://github.com/PSModule/Test-PSModule?tab=readme-ov-file#sourcecode-tests )
51107 - This produces a JSON-based report that is used to later evaluate the results of the tests.
52- - [ Lint source code] ( ./.github/workflows/Lint-SourceCode.yml )
108+
109+ ### Lint source code
110+
111+ [ workflow] ( ./.github/workflows/Lint-SourceCode.yml )
53112 - Lints the source code in parallel (matrix) using:
54113 - [ PSScriptAnalyzer rules] ( https://github.com/PSModule/Invoke-ScriptAnalyzer )
55114 - This produces a JSON-based report that is used to later evaluate the results of the linter.
56- - [ Framework test] ( ./.github/workflows/Test-Module.yml )
115+
116+ ### Framework test
117+
118+ [ workflow] ( ./.github/workflows/Test-Module.yml )
57119 - Tests and lints the module in parallel (matrix) using:
58120 - [ PSModule framework settings for style and standards for modules] ( https://github.com/PSModule/Test-PSModule?tab=readme-ov-file#module-tests )
59121 - [ PSScriptAnalyzer rules] ( https://github.com/PSModule/Invoke-ScriptAnalyzer )
60122 - This produces a JSON-based report that is used to later evaluate the results of the tests.
61- - [ Test module] ( ./.github/workflows/Test-ModuleLocal.yml )
123+
124+ ### Test module
125+
126+ [ workflow] ( ./.github/workflows/Test-ModuleLocal.yml )
62127 - Imports and tests the module in parallel (matrix) using Pester tests from the module repository.
63128 - Supports setup and teardown scripts executed via separate dedicated jobs:
64129 - ` BeforeAll ` : Runs once before all test matrix jobs to set up the test environment (e.g., deploy infrastructure, download test data).
65130 - ` AfterAll ` : Runs once after all test matrix jobs complete to clean up the test environment (e.g., remove test resources, clean up databases).
66131 - Setup/teardown scripts are automatically detected in test directories and executed with the same environment variables as the tests.
67132 - This produces a JSON-based report that is used to later evaluate the results of the tests.
68- - [ Get test results] ( ./.github/workflows/Get-TestResults.yml )
133+
134+
135+ #### Setup and Teardown Scripts
136+
137+ The workflow supports automatic execution of setup and teardown scripts for module tests:
138+
139+ - Scripts are automatically detected and executed if present.
140+ - If no scripts are found, the workflow continues normally.
141+
142+ ##### Setup - ` BeforeAll.ps1 `
143+
144+ - Place in your test directories (` tests/BeforeAll.ps1 ` ).
145+ - Runs once before all test matrix jobs to prepare the test environment.
146+ - Deploy test infrastructure, download test data, initialize databases, or configure services.
147+ - Has access to the same environment variables as your tests (secrets, GitHub token, etc.).
148+
149+ ###### Example - ` BeforeAll.ps1 `
150+
151+ ``` powershell
152+ Write-Host "Setting up test environment..."
153+ # Deploy test infrastructure
154+ # Download test data
155+ # Initialize test databases
156+ Write-Host "Test environment ready!"
157+ ```
158+
159+ ##### Teardown - ` AfterAll.ps1 `
160+
161+ - Place in your test directories (` tests/AfterAll.ps1 ` ).
162+ - Runs once after all test matrix jobs complete to clean up the test environment.
163+ - Remove test resources, clean up databases, stop services, or upload artifacts.
164+ - Has access to the same environment variables as your tests.
165+
166+ ###### Example - ` AfterAll.ps1 `
167+
168+ ``` powershell
169+ Write-Host "Cleaning up test environment..."
170+ # Remove test resources
171+ # Clean up databases
172+ # Stop services
173+ Write-Host "Cleanup completed!"
174+ ```
175+
176+
177+ ### Get test results
178+
179+ [ workflow] ( ./.github/workflows/Get-TestResults.yml )
69180 - Gathers the test results from the previous steps and creates a summary of the results.
70181 - If any tests have failed, the workflow will fail here.
71- - [ Get code coverage] ( ./.github/workflows/Get-CodeCoverage.yml )
182+
183+ ### Get code coverage
184+
185+ [ workflow] ( ./.github/workflows/Get-CodeCoverage.yml )
72186 - Gathers the code coverage from the previous steps and creates a summary of the results.
73187 - If the code coverage is below the target, the workflow will fail here.
74- - [ Build docs] ( ./.github/workflows/Build-Docs.yml )
188+
189+ ### Publish module
190+
191+ [ workflow] ( ./.github/workflows/Publish-Module.yml )
192+ - Publishes the module to the PowerShell Gallery.
193+ - Creates a release on the GitHub repository.
194+
195+ ### Build docs
196+
197+ [ workflow] ( ./.github/workflows/Build-Docs.yml )
75198 - Generates documentation and lints the documentation using:
76199 - [ super-linter] ( https://github.com/super-linter/super-linter ) .
77- - [ Build site] ( ./.github/workflows/Build-Site.yml )
200+
201+ ### Build site
202+
203+ [ workflow] ( ./.github/workflows/Build-Site.yml )
78204 - Generates a static site using:
79205 - [ Material for MkDocs] ( https://squidfunk.github.io/mkdocs-material/ ) .
80- - [ Publish site] ( ./.github/workflows/Publish-Site.yml )
81- - Publishes the static site with the module documentation to GitHub Pages.
82- - [ Publish module] ( ./.github/workflows/Publish-Module.yml )
83- - Publishes the module to the PowerShell Gallery.
84- - Creates a release on the GitHub repository.
85206
86- ### Get-Settings
207+ ### Publish Docs
87208
88- ### Lint-Repository
209+ [ workflow ] ( ./.github/workflows/Publish-Docs.yml )
89210
90211## Usage
91212
@@ -143,47 +264,6 @@ jobs:
143264| `Verbose` | `boolean` | Whether to enable verbose output. | `false` | `false` |
144265| `WorkingDirectory` | `string` | The path to the root of the repo. | `false` | `.` |
145266
146- # ## Setup and Teardown Scripts
147-
148- The workflow supports automatic execution of setup and teardown scripts for module tests :
149-
150- - Scripts are automatically detected and executed if present.
151- - If no scripts are found, the workflow continues normally.
152-
153- # ### Setup - `BeforeAll.ps1`
154-
155- - Place in your test directories (`tests/BeforeAll.ps1`).
156- - Runs once before all test matrix jobs to prepare the test environment.
157- - Deploy test infrastructure, download test data, initialize databases, or configure services.
158- - Has access to the same environment variables as your tests (secrets, GitHub token, etc.).
159-
160- # #### Example - `BeforeAll.ps1`
161-
162- ` ` ` powershell
163- Write-Host "Setting up test environment..."
164- # Deploy test infrastructure
165- # Download test data
166- # Initialize test databases
167- Write-Host "Test environment ready!"
168- ` ` `
169-
170- # ### Teardown - `AfterAll.ps1`
171-
172- - Place in your test directories (`tests/AfterAll.ps1`).
173- - Runs once after all test matrix jobs complete to clean up the test environment.
174- - Remove test resources, clean up databases, stop services, or upload artifacts.
175- - Has access to the same environment variables as your tests.
176-
177- # #### Example - `AfterAll.ps1`
178-
179- ` ` ` powershell
180- Write-Host "Cleaning up test environment..."
181- # Remove test resources
182- # Clean up databases
183- # Stop services
184- Write-Host "Cleanup completed!"
185- ` ` `
186-
187267# ## Secrets
188268
189269The following secrets are used by the workflow. They can be automatically provided (if available) by setting `secrets : inherit` in the workflow file.
0 commit comments