|
| 1 | +# Feature Specification: Merge CI and Main Workflows |
| 2 | + |
| 3 | +## User Scenarios & Testing *(mandatory)* |
| 4 | + |
| 5 | +### Primary User Story |
| 6 | + |
| 7 | +As a PowerShell module maintainer, I want a unified workflow that handles both continuous integration (on PRs) and release publishing (on merge), with optional scheduled runs for nightly testing, so that I can reduce workflow duplication and simplify my repository configuration. |
| 8 | + |
| 9 | +**⚠️ BREAKING CHANGE**: This will remove CI.yml, requiring all consuming repositories to update their workflow references from `CI.yml` to `workflow.yml`. |
| 10 | + |
| 11 | +### Acceptance Scenarios |
| 12 | + |
| 13 | +1. **Given** a pull request is opened/synchronized, **When** the workflow runs, **Then** it should build, test, lint, and collect test results/code coverage, but NOT publish the module/docs unless the PR has a "preview" label |
| 14 | +2. **Given** a pull request is merged to main, **When** the workflow completes successfully, **Then** it should run all build, test, and quality checks AND publish both the module and documentation site |
| 15 | +3. **Given** a scheduled/manual workflow run is triggered, **When** the workflow executes, **Then** it should run all build and test steps but skip the publish steps entirely |
| 16 | +4. **Given** tests fail in any stage, **When** the workflow continues, **Then** it should still complete code coverage and test result summarization steps (no early termination) |
| 17 | +5. **Given** a module repository uses this workflow, **When** it's configured, **Then** the Nightly-Run.yml workflow should no longer be needed |
| 18 | +6. **Given** an existing repository references CI.yml, **When** upgrading to the new version, **Then** it must update references from `CI.yml` to `workflow.yml` or the workflow will fail |
| 19 | + |
| 20 | +### Edge Cases |
| 21 | + |
| 22 | +- What happens when test jobs fail but we still need code coverage reports? The workflow should continue processing with `always()` conditions |
| 23 | +- How does the system handle preview publishes on non-merged PRs? The Publish-Module action already has logic to check for "preview" label and handle versioning accordingly |
| 24 | +- What if a repository has no tests configured? The workflow should skip test-related jobs gracefully using conditional logic |
| 25 | +- What happens to repositories that don't update their CI.yml references? Their workflows will fail with "workflow not found" errors |
| 26 | + |
| 27 | +## Requirements *(mandatory)* |
| 28 | + |
| 29 | +### Functional Requirements |
| 30 | + |
| 31 | +- **FR-001**: The merged workflow MUST support three trigger modes: pull request events, scheduled runs, and manual dispatch |
| 32 | +- **FR-002**: The workflow MUST execute build, test, and quality checks for all trigger types |
| 33 | +- **FR-003**: The workflow MUST publish module and documentation ONLY when: |
| 34 | + - Trigger is a merged pull request (to main), OR |
| 35 | + - Trigger is an open/synchronized pull request with "preview" label |
| 36 | +- **FR-004**: The workflow MUST skip publish steps when triggered by schedule or workflow_dispatch |
| 37 | +- **FR-005**: Test result summarization and code coverage jobs MUST run even when test jobs fail (using `always()` and `!cancelled()` conditions) |
| 38 | +- **FR-006**: The workflow MUST maintain all current permissions for different operations (contents, pull-requests, statuses, pages, id-token) |
| 39 | +- **FR-007**: The workflow MUST support all existing inputs (Name, SettingsPath, Debug, Verbose, Version, Prerelease, WorkingDirectory) |
| 40 | +- **FR-008**: The workflow MUST support all existing secrets (APIKey, test credentials) |
| 41 | +- **FR-009**: Module repositories using this workflow MUST be able to remove their Nightly-Run.yml workflow file |
| 42 | +- **FR-010**: The CI.yml workflow file in Process-PSModule MUST be removed as it becomes redundant (BREAKING CHANGE) |
| 43 | +- **FR-011**: The workflow MUST include a concurrency group to cancel in-progress runs when new commits are pushed to the same PR |
| 44 | +- **FR-012**: The workflow name and run-name MUST provide clear context about what triggered the run |
| 45 | +- **FR-013**: Documentation MUST clearly indicate the breaking change and provide migration steps for consuming repositories |
| 46 | +- **FR-014**: The release MUST be a major version bump due to the breaking change of removing CI.yml |
| 47 | + |
| 48 | +### Breaking Changes |
| 49 | + |
| 50 | +- **BC-001**: CI.yml will be deleted - all references to `PSModule/Process-PSModule/.github/workflows/CI.yml@vX` must be updated to `workflow.yml` |
| 51 | +- **BC-002**: Repositories with Nightly-Run.yml or similar workflows calling CI.yml must update their configurations before upgrading |
| 52 | + |
| 53 | +### Migration Requirements |
| 54 | + |
| 55 | +- **MR-001**: Consuming repositories MUST update workflow references from `CI.yml` to `workflow.yml` |
| 56 | +- **MR-002**: Consuming repositories SHOULD remove their Nightly-Run.yml files and update their main workflow to include schedule/dispatch triggers |
| 57 | +- **MR-003**: Migration documentation MUST include before/after examples of workflow configurations |
| 58 | + |
| 59 | +### Key Entities |
| 60 | + |
| 61 | +- **Workflow Triggers**: Pull request events (opened, reopened, synchronize, closed, labeled), schedule (cron), workflow_dispatch |
| 62 | +- **Job Dependencies**: Get-Settings → Build → Test → Summarization → Publish (conditional) |
| 63 | +- **Execution Contexts**: PR validation mode (no publish unless preview), merge mode (full publish), scheduled mode (no publish) |
| 64 | +- **Consuming Repositories**: Any repository using CI.yml that must migrate to workflow.yml |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +**Feature Branch**: `001-merge-workflows` |
| 69 | +**Created**: 2025-10-02 |
| 70 | +**Status**: Draft |
| 71 | +**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. When the pr is created, we do want publish to run, but its got logic to not publish, unless the pull request has a 'preview' label. When merged, the full pipeline should run. When there are failures in tests, it should continue working as it is (completing code coverage and test result summarization). A repo will NEVER only need ci functionality. Check the Template-PSModule's workflow to see how its currently configured for module repos. We want to basically remove the need for the nightly run pipeline, and update the main process workflow with a schedule and a workflow dispatch. When its running in this mode, we do not want the publish steps (module and docs) to run." |
| 72 | + |
| 73 | +## Execution Flow (main) |
| 74 | + |
| 75 | +1. ✅ Parse user description from Input |
| 76 | +2. ✅ Extract key concepts from description |
| 77 | + - Merge two workflow files (CI.yml and workflow.yml) |
| 78 | + - Support three execution modes: PR validation, merge/publish, scheduled testing |
| 79 | + - Maintain existing failure handling behavior |
| 80 | + - Eliminate Nightly-Run.yml from module repositories |
| 81 | +3. ✅ Generate Functional Requirements |
| 82 | + - All requirements are testable through workflow execution |
| 83 | +4. ✅ Identify Key Entities |
| 84 | + - Workflow triggers and execution contexts |
| 85 | +5. ✅ Run Review Checklist |
| 86 | + - No implementation details included |
| 87 | + - All requirements clear and testable |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## ⚡ Quick Guidelines |
| 92 | + |
| 93 | +- ✅ Focus on WHAT users need and WHY |
| 94 | +- ❌ Avoid HOW to implement (no tech stack, APIs, code structure) |
| 95 | +- 👥 Written for business stakeholders, not developers |
| 96 | + |
| 97 | +### Section Requirements |
| 98 | + |
| 99 | +- **Mandatory sections**: Must be completed for every feature |
| 100 | +- **Optional sections**: Include only when relevant to the feature |
| 101 | +- When a section doesn't apply, remove it entirely (don't leave as "N/A") |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## Review & Acceptance Checklist |
| 106 | + |
| 107 | +*GATE: Automated checks run during main() execution* |
| 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 | +*Updated by main() during processing* |
| 129 | + |
| 130 | +- [x] User description parsed |
| 131 | +- [x] Key concepts extracted |
| 132 | +- [x] Ambiguities marked (none found) |
| 133 | +- [x] User scenarios defined |
| 134 | +- [x] Requirements generated |
| 135 | +- [x] Entities identified |
| 136 | +- [x] Review checklist passed |
0 commit comments