1- name : CI/CD Pipeline
1+ name : CI Pipeline
22
33on :
44 push :
55 branches : [ main, master, develop, 'feature/**', 'fix/**', 'cli-fixes' ]
66 pull_request :
77 branches : [ main, master ]
8- release :
9- types : [ published ]
108
119env :
1210 NODE_VERSION : ' 20.x'
13- REGISTRY_URL : https://registry.npmjs.org/
1411
1512jobs :
16- # Quality Gates - Run in parallel for speed
17- lint :
18- name : Code Quality (Lint)
19- runs-on : ubuntu-latest
20- steps :
21- - name : Checkout code
22- uses : actions/checkout@v4
23-
24- - name : Setup Node.js
25- uses : actions/setup-node@v4
26- with :
27- node-version : ${{ env.NODE_VERSION }}
28- cache : ' npm'
29-
30- - name : Install dependencies
31- run : npm ci
32-
33- - name : Run ESLint
34- run : npm run lint
35-
13+ # Type checking
3614 type-check :
3715 name : TypeScript Type Check
3816 runs-on : ubuntu-latest
5230 - name : TypeScript compilation check
5331 run : npm run type-check
5432
55- security-audit :
56- name : Security Audit
33+ # Linting
34+ lint :
35+ name : Code Quality (Lint)
5736 runs-on : ubuntu-latest
5837 steps :
5938 - name : Checkout code
@@ -68,17 +47,14 @@ jobs:
6847 - name : Install dependencies
6948 run : npm ci
7049
71- - name : Run security audit
72- run : npm run security:audit
73-
74- - name : Check for outdated dependencies
75- run : npm run deps:check
50+ - name : Run ESLint
51+ run : npm run lint
7652
7753 # Build validation
7854 build :
79- name : Build Validation
55+ name : Build
8056 runs-on : ubuntu-latest
81- needs : [lint, type-check]
57+ needs : [type-check, lint ]
8258 steps :
8359 - name : Checkout code
8460 uses : actions/checkout@v4
@@ -95,248 +71,9 @@ jobs:
9571 - name : Build project
9672 run : npm run build
9773
98- - name : Validate package contents
99- run : npm run package:check
100-
101- - name : Check package size
102- run : |
103- SIZE=$(npm run package:size --silent)
104- echo "Package size: $SIZE"
105- # Fail if package is larger than 10MB
106- if [[ $(echo $SIZE | grep -o '[0-9.]*') > 10 ]]; then
107- echo "Package size exceeds 10MB limit"
108- exit 1
109- fi
110-
11174 - name : Upload build artifacts
11275 uses : actions/upload-artifact@v4
11376 with :
11477 name : build-artifacts
11578 path : build/
116- retention-days : 7
117-
118- # Test suites - Run in parallel with matrix strategy
119- # NOTE: Tests are excluded from publishing pipeline but still run for PR validation
120- test :
121- name : Test Suite
122- runs-on : ${{ matrix.os }}
123- needs : [lint, type-check]
124- if : github.event_name != 'release'
125- strategy :
126- matrix :
127- os : [ubuntu-latest, windows-latest, macos-latest]
128- node-version : ['20.x', '22.x']
129- fail-fast : false
130-
131- steps :
132- - name : Checkout code
133- uses : actions/checkout@v4
134-
135- - name : Setup Node.js ${{ matrix.node-version }}
136- uses : actions/setup-node@v4
137- with :
138- node-version : ${{ matrix.node-version }}
139- cache : ' npm'
140-
141- - name : Install dependencies
142- run : npm ci
143-
144- - name : Run unit tests only
145- run : npm run test:unit:ci
146- env :
147- CI : true
148- NODE_ENV : test
149- NODE_OPTIONS : ' --max-old-space-size=2048'
150-
151- - name : Upload test results
152- uses : actions/upload-artifact@v4
153- if : always()
154- with :
155- name : test-results-${{ matrix.os }}-${{ matrix.node-version }}
156- path : test-results.xml
157- retention-days : 7
158-
159- # Unit test coverage only
160- # NOTE: Only run unit test coverage, not integration or e2e
161- coverage :
162- name : Unit Test Coverage
163- runs-on : ubuntu-latest
164- needs : [lint, type-check]
165- if : github.event_name != 'release'
166- steps :
167- - name : Checkout code
168- uses : actions/checkout@v4
169-
170- - name : Setup Node.js
171- uses : actions/setup-node@v4
172- with :
173- node-version : ${{ env.NODE_VERSION }}
174- cache : ' npm'
175-
176- - name : Install dependencies
177- run : npm ci
178-
179- - name : Run unit tests with coverage
180- run : npm run coverage:unit
181- env :
182- CI : true
183- NODE_ENV : test
184- NODE_OPTIONS : ' --max-old-space-size=2048'
185-
186- - name : Upload coverage to Codecov
187- uses : codecov/codecov-action@v4
188- with :
189- file : ./coverage/lcov.info
190- flags : unittests
191- name : codecov-umbrella
192-
193- - name : Coverage quality gate
194- run : |
195- COVERAGE=$(grep -o 'Lines.*: [0-9.]*%' coverage/lcov-report/index.html | grep -o '[0-9.]*' | head -1 || echo "0")
196- echo "Coverage: $COVERAGE%"
197- if (( $(echo "$COVERAGE < 70" | bc -l) )); then
198- echo "Coverage below 70% threshold"
199- exit 1
200- fi
201-
202- # Integration tests - DISABLED (only run manually)
203- # NOTE: Integration tests are skipped in CI to reduce pipeline time
204- # Run locally with: npm run test:integration
205- # integration-tests:
206- # name: Integration Tests (Disabled)
207- # runs-on: ubuntu-latest
208- # if: false # Disabled - only run unit tests in CI
209-
210- # Pre-release validation
211- pre-release-validation :
212- name : Pre-release Validation
213- runs-on : ubuntu-latest
214- needs : [build, security-audit]
215- if : github.event_name == 'release'
216- steps :
217- - name : Checkout code
218- uses : actions/checkout@v4
219-
220- - name : Setup Node.js
221- uses : actions/setup-node@v4
222- with :
223- node-version : ${{ env.NODE_VERSION }}
224- cache : ' npm'
225- registry-url : ${{ env.REGISTRY_URL }}
226-
227- - name : Install dependencies
228- run : npm ci
229-
230- - name : Download build artifacts
231- uses : actions/download-artifact@v4
232- with :
233- name : build-artifacts
234- path : build/
235-
236- - name : Validate CLI functionality
237- run : |
238- node build/unified-cli.js --version
239- node build/unified-cli.js --help
240-
241- - name : Test package installation
242- run : |
243- npm pack
244- npm install -g ./vibe-coder-mcp-*.tgz
245- vibe --version
246- npm uninstall -g vibe-coder-mcp
247-
248- - name : Validate MCP server startup
249- run : |
250- timeout 10s node build/index.js || [ $? -eq 124 ]
251-
252- # Automated npm publication
253- publish :
254- name : Publish to npm
255- runs-on : ubuntu-latest
256- needs : [pre-release-validation]
257- if : github.event_name == 'release' && !github.event.release.prerelease
258- environment : production
259- steps :
260- - name : Checkout code
261- uses : actions/checkout@v4
262-
263- - name : Setup Node.js
264- uses : actions/setup-node@v4
265- with :
266- node-version : ${{ env.NODE_VERSION }}
267- cache : ' npm'
268- registry-url : ${{ env.REGISTRY_URL }}
269-
270- - name : Install dependencies
271- run : npm ci
272-
273- - name : Download build artifacts
274- uses : actions/download-artifact@v4
275- with :
276- name : build-artifacts
277- path : build/
278-
279- - name : Publish to npm
280- run : npm publish
281- env :
282- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
283-
284- - name : Create GitHub release assets
285- run : |
286- npm pack
287- gh release upload ${{ github.event.release.tag_name }} vibe-coder-mcp-*.tgz
288- env :
289- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
290-
291- # Post-publication validation
292- post-publish-validation :
293- name : Post-publication Validation
294- runs-on : ubuntu-latest
295- needs : [publish]
296- if : github.event_name == 'release' && !github.event.release.prerelease
297- steps :
298- - name : Wait for npm propagation
299- run : sleep 60
300-
301- - name : Validate npm package availability
302- run : |
303- PACKAGE_VERSION=$(npm view vibe-coder-mcp version)
304- EXPECTED_VERSION=${{ github.event.release.tag_name }}
305- if [ "$PACKAGE_VERSION" != "${EXPECTED_VERSION#v}" ]; then
306- echo "Published version mismatch: expected ${EXPECTED_VERSION#v}, got $PACKAGE_VERSION"
307- exit 1
308- fi
309-
310- - name : Test global installation
311- run : |
312- npm install -g vibe-coder-mcp@latest
313- vibe --version
314- vibe --help
315-
316- - name : Notify success
317- run : |
318- echo "✅ Successfully published vibe-coder-mcp@${{ github.event.release.tag_name }} to npm"
319-
320- # Rollback capability
321- rollback :
322- name : Emergency Rollback
323- runs-on : ubuntu-latest
324- if : failure() && github.event_name == 'release'
325- needs : [publish, post-publish-validation]
326- environment : production
327- steps :
328- - name : Setup Node.js
329- uses : actions/setup-node@v4
330- with :
331- node-version : ${{ env.NODE_VERSION }}
332- registry-url : ${{ env.REGISTRY_URL }}
333-
334- - name : Deprecate problematic version
335- run : |
336- npm deprecate vibe-coder-mcp@${{ github.event.release.tag_name }} "This version has been deprecated due to CI/CD pipeline failure"
337- env :
338- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
339-
340- - name : Notify rollback
341- run : |
342- echo "🚨 Emergency rollback executed for vibe-coder-mcp@${{ github.event.release.tag_name }}"
79+ retention-days : 7
0 commit comments