Merge pull request #9 from UnleashMystCode/dev #112
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 Pipeline | |
| # Kapan workflow ini berjalan: | |
| # - Setiap push ke branch utama | |
| # - Setiap pull_request yang menyasar main atau pr/* | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'dev' # Branch integrasi utama (langsung, bukan dev/xxx) | |
| - 'dev/**' # Branch integrasi spesifik (dev/berita-filter, dll.) | |
| - 'be/**' | |
| - 'fe/**' | |
| - 'hotfix/**' # Branch perbaikan darurat | |
| pull_request: | |
| branches: | |
| - main | |
| - 'dev' # PR yang menyasar branch dev | |
| - 'dev/**' # PR yang menyasar branch dev/xxx | |
| # Batalkan run lama jika ada push baru di branch yang sama | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: 🔍 Lint · TypeCheck · Build | |
| runs-on: ubuntu-latest | |
| env: | |
| # Fallback ke nilai dummy agar prisma generate & build tidak gagal di CI | |
| # Build tidak menyentuh DB karena semua page menggunakan force-dynamic | |
| DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgresql://ci:ci@localhost:5432/ci_db' }} | |
| DIRECT_URL: ${{ secrets.DIRECT_URL || 'postgresql://ci:ci@localhost:5432/ci_db' }} | |
| JWT_SECRET: ${{ secrets.JWT_SECRET || 'ci-jwt-secret-placeholder-64-chars-long-for-build-only-ok' }} | |
| NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL || 'https://localhost:3000' }} | |
| steps: | |
| - name: 📥 Checkout kode | |
| uses: actions/checkout@v4 | |
| - name: 🟢 Setup Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: 📦 Install dependencies | |
| run: npm ci | |
| - name: 🗄️ Generate Prisma Client | |
| run: npx prisma generate | |
| - name: 🔍 Lint (ESLint) | |
| run: npm run lint | |
| - name: 🔷 TypeScript type check | |
| run: npx tsc --noEmit | |
| - name: 🏗️ Build Next.js | |
| run: npm run build |