Skip to content

Commit deded99

Browse files
Remove research, specification, and task documents for the local GitHub composite action for BeforeAll/AfterAll test scripts as part of project restructuring. This includes the deletion of research.md, spec.md, and tasks.md files, consolidating the documentation and streamlining the development process.
1 parent 3c6e9b3 commit deded99

File tree

10 files changed

+47
-2969
lines changed

10 files changed

+47
-2969
lines changed

.specify/memory/constitution.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ Repositories that consume Process-PSModule workflows MUST:
8686
│ │ └── Environment.Tests.ps1
8787
│ ├── MyTests/ # Optional: Additional test suites
8888
│ │ └── <ModuleName>.Tests.ps1
89-
│ ├── AfterAll.ps1 # Teardown script (optional, runs after all test matrix jobs)
90-
│ ├── BeforeAll.ps1 # Setup script (optional, runs before all test matrix jobs)
89+
│ ├── AfterAll.ps1 # Teardown script (optional, runs once after all test matrix jobs)
90+
│ ├── BeforeAll.ps1 # Setup script (optional, runs once before all test matrix jobs)
9191
│ ├── <ModuleName>.Tests.ps1 # Module functional tests (Pester)
9292
│ └── Environment.Tests.ps1 # Environment validation tests (optional)
9393
├── .gitattributes # Git line ending configuration
@@ -120,8 +120,9 @@ The `src/` folder contains the module source code that Build-PSModule compiles i
120120
- `data/` - Configuration data files (`.psd1`) loaded as module variables
121121
- `formats/` - Format definition files (`.ps1xml`) for object display
122122
- `functions/private/` - Private functions (internal implementation)
123+
- Supports subdirectories for grouping (e.g., `functions/public/CoponentA/`, `functions/public/ComponentB/`)
123124
- `functions/public/` - Public functions (exported to module consumers)
124-
- Supports subdirectories for grouping (e.g., `functions/public/Get-/`, `functions/public/Set-/`)
125+
- Supports subdirectories for grouping (e.g., `functions/public/CoponentA/`, `functions/public/ComponentB/`)
125126
- Optional category documentation files (e.g., `functions/public/PSModule/PSModule.md`)
126127
- `init/` - Initialization scripts (executed first during module load)
127128
- `modules/` - Nested PowerShell modules (`.psm1`) or additional assemblies
@@ -158,9 +159,32 @@ The `src/` folder contains the module source code that Build-PSModule compiles i
158159

159160
- `tests/` folder at repository root (NOT inside `src/`)
160161
- Pester test files (`.Tests.ps1`) for module validation
161-
- Optional `BeforeAll.ps1` and `AfterAll.ps1` for test environment setup/teardown
162+
- Optional `BeforeAll.ps1` and `AfterAll.ps1` scripts for external test resource management (see below)
162163
- Tests executed by Test-ModuleLocal workflow across all platforms
163-
- See "Test-ModuleLocal workflow" section for matrix testing details
164+
- See "Workflow Execution Order" section for BeforeAll/AfterAll/Test workflow sequence
165+
166+
**BeforeAll/AfterAll Test Scripts** (Optional):
167+
168+
Process-PSModule supports optional test setup and teardown scripts that execute once per workflow run (not per platform):
169+
170+
- **`tests/BeforeAll.ps1`** - Runs once before all Test-ModuleLocal matrix jobs
171+
- **Purpose**: Setup external test resources independent of test platform/OS
172+
- **Intended Use**: Deploy cloud infrastructure via APIs, create external database instances, initialize test data in third-party services
173+
- **NOT Intended For**: OS-specific dependencies, platform-specific test files, test-specific resources for individual matrix combinations
174+
- **Execution**: Runs in `tests/` directory on ubuntu-latest with full access to environment secrets
175+
- **Error Handling**: Script failures halt the testing workflow (setup must succeed)
176+
- **Example Use Cases**: Deploy Azure/AWS resources via APIs, create external PostgreSQL databases, initialize SaaS test accounts
177+
178+
- **`tests/AfterAll.ps1`** - Runs once after all Test-ModuleLocal matrix jobs complete
179+
- **Purpose**: Cleanup external test resources independent of test platform/OS
180+
- **Intended Use**: Remove cloud infrastructure via APIs, delete external database instances, cleanup test data in third-party services
181+
- **NOT Intended For**: OS-specific cleanup, platform-specific file removal, test-specific cleanup for individual matrix combinations
182+
- **Execution**: Runs in `tests/` directory on ubuntu-latest with full access to environment secrets
183+
- **Error Handling**: Script failures logged as warnings but don't halt workflow (cleanup is best-effort)
184+
- **Always Executes**: Runs even if tests fail (via `if: always()` condition)
185+
- **Example Use Cases**: Delete Azure/AWS resources via APIs, remove external databases, cleanup SaaS test accounts
186+
187+
**Key Distinction**: BeforeAll/AfterAll are for managing **external resources via APIs** that exist outside GitHub Actions execution environment. Test-specific resources for individual OS/platform combinations should be created within the tests themselves using Pester `BeforeAll`/`AfterAll` blocks.
164188

165189
**Key Points**:
166190

@@ -360,6 +384,7 @@ All code changes MUST follow strict TDD practices using Pester and PSScriptAnaly
360384
- **Modules MUST function identically** on Linux, macOS, and Windows
361385
- Cross-platform compatibility is **verified through Test-ModuleLocal** workflow
362386
- Test-ModuleLocal executes module tests on: `ubuntu-latest`, `windows-latest`, `macos-latest`
387+
- **BeforeAll/AfterAll scripts** execute on `ubuntu-latest` only (external resource setup)
363388
- Implement matrix testing across all supported operating systems for all workflow components
364389
- Document any platform-specific behaviors or limitations explicitly
365390
- Test failures on any platform MUST block merging
@@ -645,13 +670,23 @@ The standard execution order for Process-PSModule workflows MUST be:
645670
3. **Test-SourceCode** - Parallel matrix testing of source code standards
646671
4. **Lint-SourceCode** - Parallel matrix linting of source code
647672
5. **Test-Module** - Framework validation and linting of built module
648-
6. **Test-ModuleLocal** - Runs Pester tests with BeforeAll/AfterAll support
649-
- **Verifies cross-platform module compatibility** on ubuntu-latest, windows-latest, macos-latest
673+
6. **BeforeAll-ModuleLocal** - Optional: Execute tests/BeforeAll.ps1 setup script once before all test matrix jobs
674+
- **Runs on ubuntu-latest only** (external resource setup via APIs)
675+
- Script failures halt workflow execution
676+
- Skipped if tests/BeforeAll.ps1 does not exist
677+
7. **Test-ModuleLocal** - Runs Pester tests across platform matrix (ubuntu-latest, windows-latest, macos-latest)
678+
- **Verifies cross-platform module compatibility**
650679
- Tests module functionality across all supported platforms
651-
7. **Get-TestResults** - Aggregates and validates test results
652-
8. **Get-CodeCoverage** - Validates coverage thresholds
653-
9. **Build-Docs** and **Build-Site** - Generates documentation
654-
10. **Publish-Module** and **Publish-Site** - Automated publishing on release
680+
- Depends on BeforeAll-ModuleLocal (waits for external resource setup)
681+
8. **AfterAll-ModuleLocal** - Optional: Execute tests/AfterAll.ps1 teardown script once after all test matrix jobs
682+
- **Always runs even if tests fail** (via `if: always()` condition)
683+
- **Runs on ubuntu-latest only** (external resource cleanup via APIs)
684+
- Script failures logged as warnings but don't halt workflow
685+
- Skipped if tests/AfterAll.ps1 does not exist
686+
9. **Get-TestResults** - Aggregates and validates test results
687+
10. **Get-CodeCoverage** - Validates coverage thresholds
688+
11. **Build-Docs** and **Build-Site** - Generates documentation
689+
12. **Publish-Module** and **Publish-Site** - Automated publishing on release
655690

656691
**Workflow Types**:
657692

@@ -710,4 +745,4 @@ For agent-specific runtime development guidance **when developing the framework*
710745

711746
**For Consuming Repositories**: Follow the Required Module Structure and Workflow Integration Requirements documented in the Product Overview section. Start with [Template-PSModule](https://github.com/PSModule/Template-PSModule).
712747

713-
**Version**: 1.5.1 | **Ratified**: TODO(RATIFICATION_DATE) | **Last Amended**: 2025-10-01
748+
**Version**: 1.6.0 | **Ratified**: TODO(RATIFICATION_DATE) | **Last Amended**: 2025-10-01

0 commit comments

Comments
 (0)