Merge pull request #10 from CodePapi/instructions #12
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: BE Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - 'BE/**' | |
| - 'package.json' | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - 'BE/**' | |
| - 'package.json' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:14 | |
| env: | |
| POSTGRES_USER: runner | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: testdb | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| DATABASE_URL: postgresql://runner:password@localhost:5432/testdb | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies (Root and Workspaces) | |
| run: npm install | |
| - name: ⏳ Wait for DB to be ready | |
| run: sleep 5 | |
| - name: 🧬 Run Prisma Migrations (Apply schema to test DB) | |
| run: cd BE && npx prisma migrate deploy | |
| - name: 🛠️ Generate Prisma Client | |
| run: cd BE && npx prisma generate | |
| - name: 🧪 Run Backend Tests | |
| run: npm run test:be |