Trigger Railway deployment with synced package-lock #9
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 ] | |
| env: | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| lint-and-typecheck: | |
| name: Lint & Type Check | |
| runs-on: ubuntu-latest | |
| 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: TypeScript compilation check | |
| run: npx tsc --noEmit | |
| - name: Lint check | |
| run: | | |
| echo "Linting server code..." | |
| npx tsc --noEmit -p tsconfig.json | |
| echo "Linting client code..." | |
| cd client && npx tsc --noEmit | |
| continue-on-error: true | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| 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: npx jest --selectProjects=server --coverage | |
| - name: Upload unit test coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: unit | |
| continue-on-error: true | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| 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 integration tests | |
| run: npx jest --selectProjects=integration | |
| - name: Upload integration test coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: integration | |
| continue-on-error: true | |
| e2e-tests: | |
| name: E2E Tests (Playwright) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| 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 chromium | |
| - name: Run E2E tests | |
| run: npx playwright test --reporter=line | |
| timeout-minutes: 10 | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: Cleanup processes | |
| if: always() | |
| run: | | |
| echo "Cleaning up any remaining processes..." | |
| pkill -f "npm run dev" || true | |
| pkill -f "node.*vite" || true | |
| pkill -f "tsx.*server" || true | |
| echo "Cleanup complete" | |
| build: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: [lint-and-typecheck, unit-tests, integration-tests] | |
| 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 frontend | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: client/dist | |
| retention-days: 7 | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run npm audit | |
| run: npm audit --audit-level=moderate || true | |
| continue-on-error: true | |
| - name: Check for secrets | |
| uses: trufflesecurity/trufflehog@main | |
| with: | |
| path: ./ | |
| base: main | |
| head: HEAD | |
| continue-on-error: true | |
| dependency-review: | |
| name: Dependency Review | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Dependency Review | |
| uses: actions/dependency-review-action@v4 | |
| continue-on-error: true | |
| health-check: | |
| name: API Health Check | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Check production health | |
| run: | | |
| curl -f https://rugkilleronsol.org/api/health || echo "Health check failed" | |
| continue-on-error: true | |
| notify: | |
| name: Notify Status | |
| runs-on: ubuntu-latest | |
| needs: [lint-and-typecheck, unit-tests, integration-tests, e2e-tests, build, security-scan] | |
| if: always() | |
| steps: | |
| - name: Check overall status | |
| run: | | |
| echo "Pipeline Status:" | |
| echo "Lint & Type Check: ${{ needs.lint-and-typecheck.result }}" | |
| echo "Unit Tests: ${{ needs.unit-tests.result }}" | |
| echo "Integration Tests: ${{ needs.integration-tests.result }}" | |
| echo "E2E Tests: ${{ needs.e2e-tests.result }}" | |
| echo "Build: ${{ needs.build.result }}" | |
| echo "Security Scan: ${{ needs.security-scan.result }}" |