add readme for FE clients #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, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| NODE_ENV: test | |
| CI: true | |
| jobs: | |
| test: | |
| name: Test & Quality Checks | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| bun-version: [1.0.0] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: ${{ matrix.bun-version }} | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.bun/install/cache | |
| node_modules | |
| client/node_modules | |
| server-ts/node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Install dependencies | |
| run: bun run install:all | |
| - name: Type checking | |
| run: bun run type-check | |
| - name: Lint code | |
| run: bun run lint | |
| - name: Run unit tests | |
| run: bun run test:unit | |
| - name: Run integration tests | |
| run: bun run test:integration | |
| - name: Run E2E tests | |
| run: bun run test:e2e | |
| - name: Generate coverage report | |
| run: bun run test:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage/lcov.info | |
| flags: unittests | |
| name: codecov-umbrella | |
| build: | |
| name: Build Applications | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: 1.0.0 | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.bun/install/cache | |
| node_modules | |
| client/node_modules | |
| server-ts/node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| - name: Install dependencies | |
| run: bun run install:all | |
| - name: Build applications | |
| run: bun run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| client/dist/ | |
| server-ts/dist/ | |
| retention-days: 7 | |
| docker: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| needs: [test, build] | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: your-dockerhub-username/example-react-app | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy: | |
| name: Deploy to Production | |
| runs-on: ubuntu-latest | |
| needs: [test, build, docker] | |
| if: github.ref == 'refs/heads/main' | |
| environment: production | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Deploy to production | |
| run: | | |
| echo "Deploying to production..." | |
| # Add your deployment commands here | |
| # For example, deploy to AWS, Vercel, etc. | |
| - name: Health check | |
| run: | | |
| # Wait for deployment to be ready | |
| sleep 30 | |
| # Perform health check | |
| curl -f https://your-production-url.com/health || exit 1 | |
| notify: | |
| name: Notify | |
| runs-on: ubuntu-latest | |
| needs: [test, build, docker, deploy] | |
| if: always() | |
| steps: | |
| - name: Notify on success | |
| if: ${{ needs.test.result == 'success' && needs.build.result == 'success' }} | |
| run: | | |
| echo "✅ Pipeline completed successfully!" | |
| # Add notification logic (Slack, Discord, etc.) | |
| - name: Notify on failure | |
| if: ${{ needs.test.result == 'failure' || needs.build.result == 'failure' }} | |
| run: | | |
| echo "❌ Pipeline failed!" | |
| # Add notification logic (Slack, Discord, etc.) |