wip/52-deploy-staging-azure #232
Workflow file for this run
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: Backend CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| environment: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Clear npm cache | |
| run: npm cache clean --force | |
| - name: Install deps | |
| run: npm ci --fetch-retries=5 | |
| - name: Prisma generate | |
| run: npx prisma generate | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| DIRECT_URL: ${{ secrets.DIRECT_URL }} | |
| - name: Verify Prisma client | |
| run: ls -la node_modules/.prisma/client | |
| - name: Run ESLint | |
| run: npx eslint "src/**/*.ts" "tests/**/*.ts" --max-warnings=0 | |
| - name: Run Prettier | |
| run: npx prettier --check "src/**/*.ts" "tests/**/*.ts" | |
| - name: Start test database | |
| run: | | |
| docker compose up -d test-db | |
| echo "Waiting for database to be ready..." | |
| timeout 30 bash -c 'until docker compose exec -T test-db pg_isready -U postgres -d test_db; do sleep 1; done' | |
| echo "Database is ready!" | |
| - name: Run tests | |
| run: npm run test | |
| env: | |
| # DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| # DIRECT_URL: ${{ secrets.DATABASE_URL }} | |
| NODE_ENV: test | |
| DATABASE_URL: postgresql://postgres:test_password@localhost:5433/test_db | |
| DIRECT_URL: postgresql://postgres:test_password@localhost:5433/test_db | |
| - name: Stop test database | |
| if: always() | |
| run: docker compose down -v |