Improvment: improved ci.yml for related to test fixes #7
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 | |
| on: | |
| push: | |
| branches: ["*"] | |
| pull_request: | |
| branches: ["*"] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: arun | |
| POSTGRES_PASSWORD: 12arun | |
| POSTGRES_DB: BrainVector | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U arun -d BrainVector" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| working-directory: backend | |
| run: npm ci | |
| - name: Run database migrations | |
| working-directory: backend | |
| run: npx prisma migrate deploy | |
| - name: Run E2E tests | |
| working-directory: backend | |
| env: | |
| DATABASE_URL: postgres://arun:12arun@localhost:5432/BrainVector | |
| NODE_ENV: test | |
| JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
| run: | | |
| echo "✅ Loading environment variables..." | |
| export $(grep -v '^#' .env | xargs) || true | |
| npm run test:e2e |