content: añade LlarJove (RAG) y VitaLiber CRM/ERP v2 #126
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 - Portfolio | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'apps/portfolio/**' | |
| - 'pnpm-workspace.yaml' | |
| - 'package.json' | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - 'apps/portfolio/**' | |
| env: | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| # Job 1: Lint and Format Check | |
| lint: | |
| name: Lint & Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run ESLint | |
| run: pnpm --filter portfolio run lint | |
| - name: Check Prettier formatting | |
| run: pnpm --filter portfolio run format:check | |
| # Job 2: Type Check | |
| typecheck: | |
| name: TypeScript Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run TypeScript compiler | |
| run: pnpm --filter portfolio exec tsc --noEmit | |
| # Job 3: Tests | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run tests | |
| run: pnpm --filter portfolio run test:run | |
| - name: Generate coverage report | |
| run: pnpm --filter portfolio run test:coverage | |
| continue-on-error: true | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| continue-on-error: true | |
| with: | |
| files: ./coverage/coverage-final.json | |
| flags: unittests | |
| name: codecov-umbrella | |
| # Job 4: Build | |
| build: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: [lint, typecheck, test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build Next.js application | |
| run: pnpm --filter portfolio run build | |
| env: | |
| NEXT_PUBLIC_SITE_URL: https://angelhidalgo.dev | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: apps/portfolio/.next | |
| retention-days: 7 | |
| # Job 5: Lighthouse CI (Optional - runs only on PRs) | |
| lighthouse: | |
| name: Lighthouse Performance Check | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'pull_request' | |
| continue-on-error: true | |
| permissions: | |
| actions: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build for Lighthouse | |
| run: pnpm --filter portfolio run build | |
| env: | |
| NEXT_PUBLIC_SITE_URL: https://angelhidalgo.dev | |
| - name: Install wait-on | |
| run: npm install -g wait-on | |
| - name: Start production server | |
| run: | | |
| pnpm --filter portfolio run start & | |
| echo $! > server.pid | |
| wait-on http://localhost:3000 -t 60000 | |
| - name: Run Lighthouse CI | |
| uses: treosh/lighthouse-ci-action@v10 | |
| with: | |
| urls: | | |
| http://localhost:3000 | |
| temporaryPublicStorage: true | |
| - name: Stop production server | |
| if: always() | |
| run: | | |
| if [ -f server.pid ]; then | |
| kill $(cat server.pid) || true | |
| rm server.pid | |
| fi | |
| pkill -f "next start" || true | |
| # Job 6: Security Audit | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run pnpm audit | |
| run: pnpm audit --production || echo "Audit failed, continuing..." | |
| continue-on-error: true | |
| # Job 7: Status Check Summary | |
| status: | |
| name: CI Status Check | |
| runs-on: ubuntu-latest | |
| needs: [lint, typecheck, test, build] | |
| if: always() | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Check job status | |
| run: | | |
| if [[ "${{ needs.lint.result }}" == "failure" || | |
| "${{ needs.typecheck.result }}" == "failure" || | |
| "${{ needs.test.result }}" == "failure" || | |
| "${{ needs.build.result }}" == "failure" ]]; then | |
| echo "❌ CI Pipeline failed" | |
| exit 1 | |
| else | |
| echo "✅ CI Pipeline passed" | |
| fi | |
| - name: Post status comment (PR only) | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const status = '${{ needs.lint.result }}' === 'success' && | |
| '${{ needs.typecheck.result }}' === 'success' && | |
| '${{ needs.test.result }}' === 'success' && | |
| '${{ needs.build.result }}' === 'success'; | |
| const body = status | |
| ? '✅ **CI Pipeline passed!** All checks completed successfully.' | |
| : '❌ **CI Pipeline failed!** Please check the workflow logs.'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); |