Merge pull request #3 from demonkillerr/revamp #4
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 | |
| on: | |
| push: | |
| branches: [main, revamp] | |
| pull_request: | |
| branches: [main, revamp] | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| install-dependencies: | |
| name: Install Dependencies | |
| 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: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| prisma-generate: | |
| name: Test Prisma Schema Generation | |
| runs-on: ubuntu-latest | |
| needs: install-dependencies | |
| 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: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate Prisma client | |
| run: npm run db:generate | |
| - name: Verify Prisma client | |
| run: | | |
| if [ ! -d "node_modules/@prisma/client" ]; then | |
| echo "Prisma client generation failed" | |
| exit 1 | |
| fi | |
| echo "Prisma client generated successfully" | |
| build-backend: | |
| name: Build Backend (API) | |
| runs-on: ubuntu-latest | |
| needs: [install-dependencies, prisma-generate] | |
| 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: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate Prisma client | |
| run: npm run db:generate | |
| - name: Build API | |
| run: npm run build --workspace=api | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "apps/api/dist" ]; then | |
| echo "API build failed - dist folder not found" | |
| exit 1 | |
| fi | |
| echo "API built successfully" | |
| build-frontend: | |
| name: Build Frontend (Web) | |
| runs-on: ubuntu-latest | |
| needs: install-dependencies | |
| 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: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Web | |
| run: npm run build --workspace=web | |
| env: | |
| NEXT_PUBLIC_API_URL: http://localhost:3001 | |
| NEXT_PUBLIC_SOCKET_URL: http://localhost:3001 | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "apps/web/.next" ]; then | |
| echo "Web build failed - .next folder not found" | |
| exit 1 | |
| fi | |
| echo "Web built successfully" | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| needs: install-dependencies | |
| 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: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint |