name: CI/CD Pipeline on: push: branches: [main, develop] pull_request: branches: [main, develop] jobs: lint: name: Lint & Format Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install dependencies run: npm ci - name: Run ESLint run: npm run lint - name: Check TypeScript run: npm run type-check test: name: Unit & Integration Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install dependencies run: npm ci - name: Run unit tests run: npm run test:unit - name: Upload coverage uses: codecov/codecov-action@v3 with: files: ./coverage/coverage-final.json flags: unittests name: codecov-umbrella build: name: Build & Bundle runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install dependencies run: npm ci - name: Build production run: npm run build - name: Check bundle size run: | SIZE=$(du -sh dist | awk '{print $1}') echo "📦 Bundle size: $SIZE" if [ $(du -sb dist | awk '{print $1}') -gt 524288000 ]; then echo "❌ Bundle exceeds 500MB limit!" exit 1 fi - name: Upload build artifact uses: actions/upload-artifact@v3 with: name: dist path: dist/ storybook: name: Build Storybook runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install dependencies run: npm ci - name: Build Storybook run: npm run build-storybook - name: Upload Storybook uses: actions/upload-artifact@v3 with: name: storybook-static path: storybook-static/ accessibility: name: Accessibility Audit runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install dependencies run: npm ci - name: Build Storybook run: npm run build-storybook - name: Run accessibility audit run: npm run test:a11y || true status: name: CI Status runs-on: ubuntu-latest needs: [lint, test, build, storybook, accessibility] if: always() steps: - name: Check CI status run: | if [[ "${{ needs.lint.result }}" == "failure" || "${{ needs.test.result }}" == "failure" || "${{ needs.build.result }}" == "failure" ]]; then echo "❌ CI failed" exit 1 fi echo "✅ CI passed"