name: Test & Lint on: push: branches: [main, develop] pull_request: branches: [main, develop] env: NODE_VERSION: "22" PNPM_VERSION: "10.15.0" jobs: test: name: Test & Lint runs-on: ubuntu-latest services: postgres: image: postgres:17 env: POSTGRES_PASSWORD: test POSTGRES_DB: portal_test options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: - 5432:5432 redis: image: redis:8-alpine options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 ports: - 6379:6379 steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: Enable Corepack and install pnpm run: | corepack enable corepack prepare pnpm@${{ env.PNPM_VERSION }} --activate - name: Cache pnpm dependencies uses: actions/cache@v4 with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build shared package (needed for type refs) run: pnpm --filter @customer-portal/shared run build - name: Generate Prisma client run: pnpm --filter @customer-portal/bff run db:generate - name: Type check run: pnpm type-check - name: Lint run: pnpm lint - name: Test shared package run: pnpm --filter @customer-portal/shared run test if: success() || failure() - name: Test BFF package run: pnpm --filter @customer-portal/bff run test env: DATABASE_URL: postgresql://postgres:test@localhost:5432/portal_test REDIS_URL: redis://localhost:6379 if: success() || failure() - name: Build applications run: pnpm build env: NEXT_PUBLIC_API_BASE: http://localhost:4000 NEXT_PUBLIC_APP_NAME: Customer Portal Test