Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 10 additions & 273 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,16 @@
name: CI/CD Pipeline
name: CI Pipeline

on:
push:
branches: [ main, master, develop, 'feature/**', 'fix/**', 'cli-fixes' ]
pull_request:
branches: [ main, master ]
release:
types: [ published ]

env:
NODE_VERSION: '20.x'
REGISTRY_URL: https://registry.npmjs.org/

jobs:
# Quality Gates - Run in parallel for speed
lint:
name: Code Quality (Lint)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

# Type checking
type-check:
name: TypeScript Type Check
runs-on: ubuntu-latest
Expand All @@ -52,8 +30,9 @@ jobs:
- name: TypeScript compilation check
run: npm run type-check

security-audit:
name: Security Audit
# Linting
lint:
name: Code Quality (Lint)
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -68,17 +47,14 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run security audit
run: npm run security:audit

- name: Check for outdated dependencies
run: npm run deps:check
- name: Run ESLint
run: npm run lint

# Build validation
build:
name: Build Validation
name: Build
runs-on: ubuntu-latest
needs: [lint, type-check]
needs: [type-check, lint]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -95,248 +71,9 @@ jobs:
- name: Build project
run: npm run build

- name: Validate package contents
run: npm run package:check

- name: Check package size
run: |
SIZE=$(npm run package:size --silent)
echo "Package size: $SIZE"
# Fail if package is larger than 10MB
if [[ $(echo $SIZE | grep -o '[0-9.]*') > 10 ]]; then
echo "Package size exceeds 10MB limit"
exit 1
fi

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: build/
retention-days: 7

# Test suites - Run in parallel with matrix strategy
# NOTE: Tests are excluded from publishing pipeline but still run for PR validation
test:
name: Test Suite
runs-on: ${{ matrix.os }}
needs: [lint, type-check]
if: github.event_name != 'release'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['20.x', '22.x']
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run unit tests only
run: npm run test:unit:ci
env:
CI: true
NODE_ENV: test
NODE_OPTIONS: '--max-old-space-size=2048'

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.node-version }}
path: test-results.xml
retention-days: 7

# Unit test coverage only
# NOTE: Only run unit test coverage, not integration or e2e
coverage:
name: Unit Test Coverage
runs-on: ubuntu-latest
needs: [lint, type-check]
if: github.event_name != 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run unit tests with coverage
run: npm run coverage:unit
env:
CI: true
NODE_ENV: test
NODE_OPTIONS: '--max-old-space-size=2048'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella

- name: Coverage quality gate
run: |
COVERAGE=$(grep -o 'Lines.*: [0-9.]*%' coverage/lcov-report/index.html | grep -o '[0-9.]*' | head -1 || echo "0")
echo "Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 70" | bc -l) )); then
echo "Coverage below 70% threshold"
exit 1
fi

# Integration tests - DISABLED (only run manually)
# NOTE: Integration tests are skipped in CI to reduce pipeline time
# Run locally with: npm run test:integration
# integration-tests:
# name: Integration Tests (Disabled)
# runs-on: ubuntu-latest
# if: false # Disabled - only run unit tests in CI

# Pre-release validation
pre-release-validation:
name: Pre-release Validation
runs-on: ubuntu-latest
needs: [build, security-audit]
if: github.event_name == 'release'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
registry-url: ${{ env.REGISTRY_URL }}

- name: Install dependencies
run: npm ci

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/

- name: Validate CLI functionality
run: |
node build/unified-cli.js --version
node build/unified-cli.js --help

- name: Test package installation
run: |
npm pack
npm install -g ./vibe-coder-mcp-*.tgz
vibe --version
npm uninstall -g vibe-coder-mcp

- name: Validate MCP server startup
run: |
timeout 10s node build/index.js || [ $? -eq 124 ]

# Automated npm publication
publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: [pre-release-validation]
if: github.event_name == 'release' && !github.event.release.prerelease
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
registry-url: ${{ env.REGISTRY_URL }}

- name: Install dependencies
run: npm ci

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub release assets
run: |
npm pack
gh release upload ${{ github.event.release.tag_name }} vibe-coder-mcp-*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Post-publication validation
post-publish-validation:
name: Post-publication Validation
runs-on: ubuntu-latest
needs: [publish]
if: github.event_name == 'release' && !github.event.release.prerelease
steps:
- name: Wait for npm propagation
run: sleep 60

- name: Validate npm package availability
run: |
PACKAGE_VERSION=$(npm view vibe-coder-mcp version)
EXPECTED_VERSION=${{ github.event.release.tag_name }}
if [ "$PACKAGE_VERSION" != "${EXPECTED_VERSION#v}" ]; then
echo "Published version mismatch: expected ${EXPECTED_VERSION#v}, got $PACKAGE_VERSION"
exit 1
fi

- name: Test global installation
run: |
npm install -g vibe-coder-mcp@latest
vibe --version
vibe --help

- name: Notify success
run: |
echo "✅ Successfully published vibe-coder-mcp@${{ github.event.release.tag_name }} to npm"

# Rollback capability
rollback:
name: Emergency Rollback
runs-on: ubuntu-latest
if: failure() && github.event_name == 'release'
needs: [publish, post-publish-validation]
environment: production
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.REGISTRY_URL }}

- name: Deprecate problematic version
run: |
npm deprecate vibe-coder-mcp@${{ github.event.release.tag_name }} "This version has been deprecated due to CI/CD pipeline failure"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Notify rollback
run: |
echo "🚨 Emergency rollback executed for vibe-coder-mcp@${{ github.event.release.tag_name }}"
retention-days: 7
Loading