Skip to content

Commit e53a7c1

Browse files
authored
Add pipeline simulation with simulate CLI command (#21)
* update deps * update parameter description for `flattenScriptArray` function * add missing dependency * reorganize script properties * add tests for flattening nested script arrays in YAML import * fix lint issue * enhance service merging logic and update schemas for better type handling * feat: Implement pipeline simulation feature - Added a new command `simulate` to simulate GitLab CI pipeline execution based on variables and rules. - Introduced `PipelineSimulator` class to handle the simulation logic, including job evaluation based on rules and context. - Created `RuleEvaluator` class to evaluate rules against the provided context. - Enhanced job definitions to support rules for conditional execution. - Updated types to accommodate new simulation features, including support for multiple job inputs and outputs. - Added comprehensive unit tests to validate simulation behavior under various scenarios, including rules evaluation and job execution order. * Add integration tests for pipeline simulation with nested remote includes * - add comprehensive test cases for config builder, rule evaluator, and template validation - Introduced tests for remote job extends normalization to ensure string extends are handled correctly. - Added tests for variable and job merge order, verifying child definitions override parent definitions. - Implemented tests for rule evaluator, covering AND operator and not-equal operator scenarios. - Enhanced simulation tests to cover file existence checks, variable interpolation, and various rule conditions. - Created tests for template extends chain resolution and lenient validation of templates. - Updated visualization tests to ensure graceful handling of missing includes.
1 parent b5c6c71 commit e53a7c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+6032
-300
lines changed

.changeset/smooth-cows-doubt.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
"@noxify/gitlab-ci-builder": minor
3+
---
4+
5+
Added pipeline simulation feature and improved remote extends handling
6+
7+
**Simulation Features:**
8+
9+
- Added `simulate` CLI command to simulate GitLab CI pipeline execution
10+
- Added `PipelineSimulator` class for rule evaluation and job filtering
11+
- Support for branch, tag, and merge request pipeline simulation
12+
- Multiple output formats: summary, table, JSON, YAML, and text
13+
- Predefined CI variables automatically set based on context
14+
- Comprehensive integration and E2E test coverage
15+
16+
**Remote Extends Improvements:**
17+
18+
- Added `mergeRemoteExtends` global option to control remote extends resolution
19+
- Fixed remote extends resolution for accurate pipeline simulation
20+
- Better handling of remote includes and templates
21+
22+
**Documentation & Testing:**
23+
24+
- Enhanced CLI documentation with predefined variables table
25+
- Added error handling documentation for remote includes
26+
- Added "Common Pitfalls & Best Practices" section
27+
- Improved JSDoc coverage for all public APIs

.github/copilot-instructions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
1. Types first
3131
2. React/Next.js/Expo (if applicable)
3232
3. Third-party modules
33-
4. @vorsteh-queue packages
34-
5. Relative imports (~/,../, ./)
33+
4. Relative imports (~/,../, ./)
3534

3635
## Code Generation Guidelines
3736

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ jobs:
8080
- name: Integration Tests
8181
run: pnpm test:integration
8282

83+
- name: E2E Tests
84+
run: pnpm test:e2e
85+
8386
pkg-new-release:
8487
needs: [lint, format, typecheck]
8588
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)