Skip to content

docs: add Installation and Dependencies Guide to enhance setup instru… #26

docs: add Installation and Dependencies Guide to enhance setup instru…

docs: add Installation and Dependencies Guide to enhance setup instru… #26

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
env:
NODE_VERSION: '18.x'
jobs:
# Quality checks
quality:
name: Code Quality Checks
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 --prefer-offline --no-audit
- name: Check code formatting
run: npm run lint || echo "No lint script found"
- name: Check Prettier formatting
run: |
npx prettier --check "**/*.{js,md,json,yaml,yml,css,html}" --ignore-path .prettierignore || {
echo "⚠️ Prettier formatting issues found"
exit 1
}
- name: Validate package.json
run: npm run validate || echo "Package validation skipped"
# Tests
test:
name: Run Tests
runs-on: ubuntu-latest
needs: quality
strategy:
matrix:
node-version: [18.x, 20.x]
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 --prefer-offline --no-audit
- name: Run unit tests
run: npm test -- --run
- name: Upload coverage
if: always()
uses: codecov/codecov-action@v4
with:
file: ./coverage/coverage-final.json
flags: unittests
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
# Build check
build:
name: Build Check
runs-on: ubuntu-latest
needs: test
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 --prefer-offline --no-audit
- name: Build project
run: npm run build
- name: Check build artifacts
run: |
if [ -d "dist" ]; then
echo "✅ Build successful - dist directory exists"
ls -la dist/
else
echo "⚠️ No dist directory found (this is OK for static projects)"
fi
# Security checks
security:
name: Security Audit
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 --prefer-offline --no-audit
- name: Run security audit
run: npm audit --audit-level=moderate || true
# Deploy to staging (only on develop branch)
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: [build, security]
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to staging
run: |
echo "🚀 Deploying to staging environment..."
echo "This would deploy to a staging server"
# Add your staging deployment commands here
# Deploy to production (only on main branch)
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [build, security]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to production
run: |
echo "🚀 Deploying to production..."
echo "Build passed all checks - ready for production"
# GitHub Pages deployment is handled by separate workflow