style: fix Prettier formatting issues #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [main, dev, stage] | |
| pull_request: | |
| branches: [main, dev, stage] | |
| env: | |
| NODE_VERSION: '18' | |
| PNPM_VERSION: '8' | |
| jobs: | |
| # Code Quality Checks | |
| quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type checking | |
| run: npm run type-check | |
| - name: Linting | |
| run: npm run lint:check | |
| - name: Format checking | |
| run: npm run format:check | |
| - name: Build check | |
| run: npm run build | |
| # Unit Tests | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: quality | |
| 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 | |
| run: npm run test:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage/lcov.info | |
| flags: unittests | |
| name: codecov-umbrella | |
| # E2E Tests | |
| e2e-tests: | |
| name: E2E Tests | |
| runs-on: ubuntu-latest | |
| needs: quality | |
| 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: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Build application | |
| run: npm run build | |
| - name: Run E2E tests | |
| run: npm run test:e2e | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v3 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| # Performance Tests | |
| performance-tests: | |
| name: Performance Tests | |
| runs-on: ubuntu-latest | |
| needs: quality | |
| 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: Build application | |
| run: npm run build | |
| - name: Start application | |
| run: npm start & | |
| env: | |
| PORT: 3000 | |
| - name: Wait for application | |
| run: npx wait-on http://localhost:3000 | |
| - name: Run performance audit | |
| run: npm run perf:audit | |
| - name: Upload performance report | |
| uses: actions/upload-artifact@v3 | |
| if: always() | |
| with: | |
| name: performance-report | |
| path: performance-reports/ | |
| retention-days: 30 | |
| # Security Scan | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| needs: quality | |
| 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 security audit | |
| run: npm audit --audit-level moderate | |
| - name: Run Snyk security scan | |
| uses: snyk/actions/node@master | |
| env: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| with: | |
| args: --severity-threshold=high | |
| # Build and Deploy | |
| build-and-deploy: | |
| name: Build and Deploy | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests, e2e-tests, performance-tests, security-scan] | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stage' | |
| 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: Build application | |
| run: npm run build | |
| - name: Deploy to staging | |
| if: github.ref == 'refs/heads/stage' | |
| run: | | |
| echo "Deploying to staging environment" | |
| # Add staging deployment commands here | |
| - name: Deploy to production | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| echo "Deploying to production environment" | |
| # Add production deployment commands here | |
| - name: Notify deployment | |
| uses: 8398a7/action-slack@v3 | |
| if: always() | |
| with: | |
| status: ${{ job.status }} | |
| channel: '#deployments' | |
| webhook_url: ${{ secrets.SLACK_WEBHOOK }} | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
| # Lighthouse CI | |
| lighthouse-ci: | |
| name: Lighthouse CI | |
| runs-on: ubuntu-latest | |
| needs: build-and-deploy | |
| if: github.ref == 'refs/heads/main' | |
| 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: Build application | |
| run: npm run build | |
| - name: Start application | |
| run: npm start & | |
| env: | |
| PORT: 3000 | |
| - name: Wait for application | |
| run: npx wait-on http://localhost:3000 | |
| - name: Run Lighthouse CI | |
| run: npm run lighthouse | |
| - name: Upload Lighthouse report | |
| uses: actions/upload-artifact@v3 | |
| if: always() | |
| with: | |
| name: lighthouse-report | |
| path: .lighthouseci/ | |
| retention-days: 30 |