name: CI/CD Pipeline
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
test:
name: Test on Windows with WSL
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Lint and validate package.json
run: npm run check-config || echo "Config check completed"
- name: Run tests
run: npm test
- name: Run diagnostics
run: npm run debug || echo "Diagnostics completed"
- name: Test build
run: npm run start --if-present || echo "Start script test completed"
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run security audit
run: npm audit --audit-level=moderate
- name: Check for known vulnerabilities
run: npm audit --audit-level=high
compatibility:
name: Node.js Compatibility
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '20', '21']
steps:
- name: Checkout repository
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 install
- name: Run tests
run: npm test
documentation:
name: Documentation Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for required documentation files
run: |
echo "Checking for required documentation..."
test -f README.md && echo "✅ README.md found" || echo "❌ README.md missing"
test -f CHANGELOG.md && echo "✅ CHANGELOG.md found" || echo "❌ CHANGELOG.md missing"
test -f CONTRIBUTING.md && echo "✅ CONTRIBUTING.md found" || echo "❌ CONTRIBUTING.md missing"
test -f LICENSE && echo "✅ LICENSE found" || echo "❌ LICENSE missing"
test -f TROUBLESHOOTING.md && echo "✅ TROUBLESHOOTING.md found" || echo "❌ TROUBLESHOOTING.md missing"
- name: Check documentation links
run: |
echo "Checking for broken links in documentation..."
# This is a basic check - you could add more sophisticated link checking
grep -r "http" *.md || echo "No external links found"
release:
name: Release Check
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test, security, compatibility, documentation]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Check version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "Current version: $VERSION"
- name: Validate release readiness
run: |
echo "Checking release readiness..."
npm run monitor || echo "Monitor check completed"
- name: Generate release notes
run: |
echo "Release validation completed for version $(node -p "require('./package.json').version")"