Never batch prisma operations to save on connection count #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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:latest | |
| env: | |
| POSTGRES_USER: postgres-test | |
| POSTGRES_PASSWORD: postgres-test | |
| POSTGRES_DB: teerank-test | |
| ports: | |
| - 5433:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npx nx run-many -t lint --parallel=3 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Migrate database | |
| run: | | |
| flyctl proxy 5434:5432 --app teerankio-postgres2 & | |
| sleep 2 | |
| npx prisma generate --sql --schema=libs/prisma/prisma/schema.prisma | |
| npx nx run-many -t prisma-deploy --parallel=4 | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_POSTGRES2 }} | |
| PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]' | |
| - name: Build | |
| run: npx nx run-many -t build --configuration=production --parallel=4 | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| - name: Test | |
| run: | | |
| npx nx run prisma:prisma-push | |
| npx nx run-many -t test --runInBand | |
| env: | |
| DATABASE_URL: postgres://postgres-test:postgres-test@localhost:5433/teerank-test | |
| PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]' | |
| - name: Deploy frontend | |
| run: flyctl deploy --config apps/frontend/fly.toml --dockerfile apps/frontend/Dockerfile | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_FRONTEND }} | |
| PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]' | |
| - name: Deploy worker | |
| run: flyctl deploy --config apps/worker/fly.toml --dockerfile apps/worker/Dockerfile | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_WORKER }} | |
| PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]' | |
| - name: Deploy scheduler | |
| run: flyctl deploy --config apps/scheduler/fly.toml --dockerfile apps/scheduler/Dockerfile | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_SCHEDULER }} | |
| PRISMA_BINARY_TARGETS: '["native", "linux-musl-openssl-3.0.x", "linux-musl"]' |