@@ -67,6 +67,7 @@ This document defines the data structures, contracts, and entities for the setup
6767 - All environment variables accessible to scripts
6868
6969** Dependencies** :
70+
7071- PSModule/Install-PSModuleHelpers@v1 (installs PSModule helper functions)
7172- PSModule/GitHub-Script@v1 (provides PowerShell execution environment with LogGroup)
7273
@@ -82,6 +83,7 @@ This document defines the data structures, contracts, and entities for the setup
8283### 2. Test Script Files
8384
8485** BeforeAll.ps1** :
86+
8587- ** Location** : ` tests/BeforeAll.ps1 ` (root tests folder only)
8688- ** Purpose** : Setup external test resources before all test matrix jobs - resources that are independent of test platform/OS
8789- ** Intended Use** : Deploy cloud infrastructure via APIs, create external database instances, initialize test data in third-party services
@@ -91,6 +93,7 @@ This document defines the data structures, contracts, and entities for the setup
9193- ** Example Use Cases** : Deploy Azure/AWS resources via APIs, create external PostgreSQL databases, initialize SaaS test accounts
9294
9395** AfterAll.ps1** :
96+
9497- ** Location** : ` tests/AfterAll.ps1 ` (root tests folder only)
9598- ** Purpose** : Cleanup external test resources after all test matrix jobs - resources that are independent of test platform/OS
9699- ** Intended Use** : Remove cloud infrastructure via APIs, delete external database instances, cleanup test data in third-party services
@@ -100,6 +103,7 @@ This document defines the data structures, contracts, and entities for the setup
100103- ** Example Use Cases** : Delete Azure/AWS resources via APIs, remove external databases, cleanup SaaS test accounts
101104
102105** Script Contract** :
106+
103107- Scripts can access all environment variables (secrets)
104108- Scripts execute in tests directory (via Push-Location)
105109- Scripts should use Write-Host for output (not Write-Verbose)
@@ -110,6 +114,7 @@ This document defines the data structures, contracts, and entities for the setup
110114### 3. Workflow Integration Contract
111115
112116** BeforeAll-ModuleLocal Job** :
117+
113118``` yaml
114119BeforeAll-ModuleLocal :
115120 name : BeforeAll-ModuleLocal
@@ -139,6 +144,7 @@ BeforeAll-ModuleLocal:
139144` ` `
140145
141146**AfterAll-ModuleLocal Job**:
147+
142148` ` ` yaml
143149AfterAll-ModuleLocal :
144150 name : AfterAll-ModuleLocal
@@ -172,6 +178,7 @@ AfterAll-ModuleLocal:
172178` ` `
173179
174180**Job Dependencies**:
181+
175182- BeforeAll-ModuleLocal: No dependencies (runs first)
176183- Test-ModuleLocal: Depends on BeforeAll-ModuleLocal
177184- AfterAll-ModuleLocal: Depends on Test-ModuleLocal, always runs (if: always())
@@ -180,7 +187,7 @@ AfterAll-ModuleLocal:
180187
181188Since this is a stateless action, state transitions describe the execution flow:
182189
183- ` ` `
190+ ` ` ` plaintext
184191[Start]
185192 → Check inputs.mode validation
186193 → mode = "before" or "after"
@@ -258,17 +265,20 @@ Since this is a stateless action, state transitions describe the execution flow:
258265### Output Contract
259266
260267The action provides output via:
268+
2612691 . ** Exit Code** : 0 for success, non-zero for failure (mode="before" only)
2622702 . ** Console Output** : Formatted messages via LogGroup
2632713 . ** GitHub Actions Status** : Job success/failure reflected in workflow UI
264272
265273### Log Output Format
266274
267275All output wrapped in LogGroup with title based on mode:
276+
268277- mode="before": "Running BeforeAll Setup Scripts"
269278- mode="after": "Running AfterAll Teardown Scripts"
270279
271280Standard messages:
281+
272282- No tests directory: "No tests directory found - exiting successfully"
273283- No script found: "No [ BeforeAll|AfterAll] .ps1 script found - exiting successfully"
274284- Script execution start: "Running [ BeforeAll|AfterAll] setup/teardown script: [ path] "
@@ -279,23 +289,27 @@ Standard messages:
279289## Non-Functional Requirements
280290
281291### Performance
292+
282293- Action invocation overhead: <2 seconds (Install-PSModuleHelpers + GitHub-Script startup)
283294- Script discovery: <100ms (single file check)
284295- Total execution time: Script runtime + overhead
285296
286297### Reliability
298+
287299- Action must handle missing directories/files gracefully
288300- Action must always restore working directory (via finally block)
289301- Action must propagate errors correctly based on mode
290302- AfterAll mode must ensure cleanup always runs (if: always())
291303
292304### Maintainability
305+
293306- Single source of truth for setup/teardown logic
294307- Clear separation of concerns (action vs scripts)
295308- Reusable across workflows
296309- Documented inputs and behavior
297310
298311### Security
312+
299313- Secrets passed as environment variables (not in action inputs)
300314- Scripts run in isolated job context
301315- No secret values logged (use Write-Host for non-sensitive output)
0 commit comments