|
| 1 | +# Feature Specification: Merge CI.yml into Workflow.yml |
| 2 | + |
| 3 | +## User Scenarios & Testing |
| 4 | + |
| 5 | +### Primary User Story |
| 6 | + |
| 7 | +As a PowerShell module maintainer using the Process-PSModule framework, I want a single reusable workflow file that intelligently handles pull requests (with optional preview publishing), merged releases (with full publishing), and scheduled/manual test runs (without publishing), so that my repository configuration is simpler with fewer workflow files to maintain and the Nightly-Run.yml workflow is no longer needed. |
| 8 | + |
| 9 | +### Acceptance Scenarios |
| 10 | + |
| 11 | +1. **Given** a pull request is opened, **When** the workflow runs, **Then** all build/test/lint jobs execute and publish jobs run but skip publishing unless the PR has a "preview" label |
| 12 | +2. **Given** a pull request with "preview" label is opened, **When** the workflow runs, **Then** the full pipeline executes including module and documentation publishing to preview environments |
| 13 | +3. **Given** a pull request is merged to main, **When** the workflow runs, **Then** the full pipeline executes including module publishing to PowerShell Gallery and documentation deployment to GitHub Pages |
| 14 | +4. **Given** the workflow is triggered by workflow_dispatch or schedule (nightly), **When** the workflow runs, **Then** all build/test/lint jobs execute but publish jobs (Publish-Site, Publish-Module) are skipped |
| 15 | +5. **Given** test jobs fail during execution, **When** the workflow continues, **Then** code coverage aggregation and test result summarization still complete successfully |
| 16 | +6. **Given** a repository currently uses both Process-PSModule.yml and Nightly-Run.yml, **When** migrated to the unified workflow, **Then** only Process-PSModule.yml is needed with workflow_dispatch and schedule triggers added |
| 17 | + |
| 18 | +### Edge Cases |
| 19 | + |
| 20 | +- What happens when a pull request is created? → Should run full pipeline including publish jobs, but publish jobs contain logic to skip unless PR has "preview" label |
| 21 | +- What happens when a pull request is merged to main? → Should run full pipeline including all publishing steps |
| 22 | +- How does the system handle test failures? → Should continue to completion, including code coverage and test result summarization (existing behavior) |
| 23 | +- What happens when triggered by workflow_dispatch or schedule (nightly run)? → Should run all build/test/lint jobs but skip publishing steps (replaces separate Nightly-Run.yml workflow) |
| 24 | +- What happens if a repository only needs CI functionality? → Not applicable - all repositories using Process-PSModule run the full workflow |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Requirements |
| 29 | + |
| 30 | +### Functional Requirements |
| 31 | + |
| 32 | +- **FR-001**: System MUST preserve all job definitions from CI.yml (Get-Settings, Build-Module, Build-Docs, Build-Site, Test-SourceCode, Lint-SourceCode, Test-Module, Test-ModuleLocal, BeforeAll-ModuleLocal, AfterAll-ModuleLocal, Get-TestResults, Get-CodeCoverage) |
| 33 | +- **FR-002**: System MUST preserve all job definitions from workflow.yml (all jobs from CI.yml plus Publish-Site and Publish-Module) |
| 34 | +- **FR-003**: System MUST maintain identical input parameters as defined in both workflows (Name, SettingsPath, Debug, Verbose, Version, Prerelease, WorkingDirectory) |
| 35 | +- **FR-004**: System MUST maintain identical secrets definitions as defined in both workflows (APIKey, TEST_APP_ENT_CLIENT_ID, TEST_APP_ENT_PRIVATE_KEY, TEST_APP_ORG_CLIENT_ID, TEST_APP_ORG_PRIVATE_KEY, TEST_USER_ORG_FG_PAT, TEST_USER_USER_FG_PAT, TEST_USER_PAT) |
| 36 | +- **FR-005**: System MUST support workflow_dispatch trigger to allow manual workflow execution |
| 37 | +- **FR-006**: System MUST support schedule trigger for nightly automated test runs |
| 38 | +- **FR-007**: Publish-Site job MUST execute when a pull request is merged to main and all prerequisite jobs succeed |
| 39 | +- **FR-008**: Publish-Module job MUST execute when a pull request is merged to main and all prerequisite jobs succeed |
| 40 | +- **FR-009**: Publish-Site job MUST execute when a pull request has the "preview" label and is not merged |
| 41 | +- **FR-010**: Publish-Module job MUST execute when a pull request has the "preview" label and is not merged (with preview/prerelease publishing logic) |
| 42 | +- **FR-011**: Publish-Site and Publish-Module jobs MUST be skipped when triggered via workflow_dispatch or schedule |
| 43 | +- **FR-012**: System MUST maintain all job dependencies and execution order as defined in the original workflows |
| 44 | +- **FR-013**: System MUST continue executing code coverage and test result jobs even when test jobs fail |
| 45 | +- **FR-014**: System MUST maintain all conditional logic for job execution (if conditions) from both workflows |
| 46 | +- **FR-015**: Repositories using Process-PSModule MUST be able to reference a single workflow file for all execution modes (PR, merge, scheduled, manual) |
| 47 | +- **FR-016**: CI.yml file MUST be removed after successful migration to prevent confusion |
| 48 | +- **FR-017**: Nightly-Run.yml workflow in module repositories MUST be removed as its functionality is absorbed into the unified workflow |
| 49 | +- **FR-018**: Unified workflow MUST use write permissions (contents: write, pull-requests: write, statuses: write, pages: write, id-token: write) to support all execution modes |
| 50 | + |
| 51 | +### Key Entities |
| 52 | + |
| 53 | +- **CI.yml Workflow**: GitHub Actions reusable workflow file that currently handles continuous integration tasks (build, test, lint) with read-only permissions, used by Nightly-Run.yml for scheduled testing |
| 54 | +- **workflow.yml Workflow**: GitHub Actions reusable workflow file that handles full pipeline including CI tasks plus publishing (site deployment, module publishing) with write permissions, used for pull request workflows |
| 55 | +- **Nightly-Run.yml**: Repository-level workflow in module repos that triggers CI.yml on a schedule or manual dispatch for testing without publishing |
| 56 | +- **Process-PSModule.yml**: Repository-level workflow in module repos that triggers workflow.yml for pull request and merge operations |
| 57 | +- **Job Definitions**: Reusable workflow jobs that perform specific operations (Get-Settings, Build-Module, Test-Module, etc.) |
| 58 | +- **Publish Jobs**: Publish-Site and Publish-Module jobs that deploy documentation and modules, with conditional execution based on trigger type and PR labels |
| 59 | +- **Trigger Types**: Different invocation methods (pull_request opened/synchronized, pull_request merged, workflow_dispatch, schedule) that determine which jobs execute |
| 60 | +- **Preview Label**: Pull request label that enables preview publishing for testing changes before merge |
| 61 | +- **Permissions**: GitHub Actions permission sets that control what the workflow can do (write permissions needed for all modes) |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +**Feature Branch**: `002-merge-ci-yml` |
| 66 | +**Created**: 2025-10-02 |
| 67 | +**Status**: Draft |
| 68 | +**Input**: User description: "Merge ci.yml into workflow.yml, so that we can deduplicate and two workflows and have less workflows in the repos that use this process." |
| 69 | + |
| 70 | +## Execution Flow (main) |
| 71 | + |
| 72 | +1. Parse user description from Input |
| 73 | + → Feature description is clear: consolidate two similar workflow files |
| 74 | +2. Extract key concepts from description |
| 75 | + → Actors: PowerShell module maintainers, CI/CD pipeline |
| 76 | + → Actions: Merge workflows, deduplicate configuration, reduce workflow count |
| 77 | + → Data: Workflow YAML files, job definitions, permissions |
| 78 | + → Constraints: Must maintain existing functionality |
| 79 | +3. For each unclear aspect: |
| 80 | + → No major ambiguities; requirements are well-defined |
| 81 | +4. Fill User Scenarios & Testing section |
| 82 | + → Primary user flow: Repository using Process-PSModule framework references a single workflow |
| 83 | +5. Generate Functional Requirements |
| 84 | + → Requirements focus on workflow consolidation and preservation of functionality |
| 85 | +6. Identify Key Entities |
| 86 | + → CI.yml workflow, workflow.yml, job definitions, permissions |
| 87 | +7. Run Review Checklist |
| 88 | + → No implementation details included; focused on user value |
| 89 | +8. Return: SUCCESS (spec ready for planning) |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## ⚡ Quick Guidelines |
| 94 | + |
| 95 | +- ✅ Focus on WHAT users need and WHY |
| 96 | +- ❌ Avoid HOW to implement (no tech stack, APIs, code structure) |
| 97 | +- 👥 Written for business stakeholders, not developers |
| 98 | + |
| 99 | +### Section Requirements |
| 100 | + |
| 101 | +- **Mandatory sections**: Must be completed for every feature |
| 102 | +- **Optional sections**: Include only when relevant to the feature |
| 103 | +- When a section doesn't apply, remove it entirely (don't leave as "N/A") |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## Review & Acceptance Checklist |
| 108 | + |
| 109 | +### Content Quality |
| 110 | + |
| 111 | +- [x] No implementation details (languages, frameworks, APIs) |
| 112 | +- [x] Focused on user value and business needs |
| 113 | +- [x] Written for non-technical stakeholders |
| 114 | +- [x] All mandatory sections completed |
| 115 | + |
| 116 | +### Requirement Completeness |
| 117 | + |
| 118 | +- [x] No [NEEDS CLARIFICATION] markers remain |
| 119 | +- [x] Requirements are testable and unambiguous |
| 120 | +- [x] Success criteria are measurable |
| 121 | +- [x] Scope is clearly bounded |
| 122 | +- [x] Dependencies and assumptions identified |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Execution Status |
| 127 | + |
| 128 | +- [x] User description parsed |
| 129 | +- [x] Key concepts extracted |
| 130 | +- [x] Ambiguities marked (none identified) |
| 131 | +- [x] User scenarios defined |
| 132 | +- [x] Requirements generated |
| 133 | +- [x] Entities identified |
| 134 | +- [x] Review checklist passed |
0 commit comments