Implement comprehensive CI/CD pipeline and project infrastructure #1
Workflow file for this run
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: [ leader, main ] | ||
| pull_request: | ||
| branches: [ leader, main ] | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| 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: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles("**/package-lock.json") }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run linting | ||
| run: npm run lint | ||
| - name: Check formatting | ||
| run: npm run format:check | ||
| - 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 | ||
| - name: Build application | ||
| run: npm run build | ||
| - name: Run visual regression tests | ||
| run: npm run test:visual | ||
| - name: Upload test artifacts | ||
| uses: actions/upload-artifact@v3 | ||
| if: failure() | ||
| with: | ||
| name: test-artifacts | ||
| path: | | ||
| tests/playwright/screenshots/ | ||
| tests/playwright/test-results/ | ||
| security: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20.x" | ||
| cache: "npm" | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run security audit | ||
| run: npm audit --audit-level=high | ||
| - name: Run custom security scan | ||
| run: ./scripts/security-audit.sh || true | ||
| deploy: | ||
| needs: [test, security] | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == "refs/heads/leader" && github.event_name == "push" | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20.x" | ||
| cache: "npm" | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build for production | ||
| run: npm run build | ||
| - name: Deploy notification | ||
| run: echo "Deployment would happen here - integrate with your deployment system" | ||