fix ci: set TEST_ADMIN_DATABASE_URL to avoid postgres db auth issue #26
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: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| backend: | |
| name: Backend tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_USER: replayforge | |
| POSTGRES_PASSWORD: replayforge | |
| POSTGRES_DB: replayforge | |
| ports: ['5432:5432'] | |
| options: >- | |
| --health-cmd "pg_isready -U replayforge" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| redis: | |
| image: redis:7.4-alpine | |
| ports: ['6379:6379'] | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| defaults: | |
| run: | |
| working-directory: api | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Validate control-plane path | |
| run: test -f requirements.txt | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11.9' | |
| cache: pip | |
| cache-dependency-path: api/requirements.txt | |
| - name: Install deps | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run migrations | |
| env: | |
| DATABASE_URL: postgresql://replayforge:replayforge@127.0.0.1:5432/replayforge | |
| run: alembic upgrade head | |
| - name: Run tests | |
| env: | |
| DATABASE_URL: postgresql://replayforge:replayforge@127.0.0.1:5432/replayforge | |
| TEST_ADMIN_DATABASE_URL: postgresql://replayforge:replayforge@127.0.0.1:5432/replayforge | |
| REDIS_URL: redis://localhost:6379/0 | |
| LOG_FORMAT: text | |
| run: pytest app/tests/ -v --ignore=app/tests/test_smoke_e2e.py | |
| frontend: | |
| name: Frontend typecheck + build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.18' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - run: npm ci | |
| - run: npm run typecheck | |
| - run: npm run build | |
| worker: | |
| name: Worker build + unit tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: worker | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23.x' | |
| cache: true | |
| cache-dependency-path: worker/go.sum | |
| - name: Verify dependencies | |
| run: go mod download | |
| - name: Build worker | |
| run: go build ./... | |
| - name: Run worker tests | |
| run: go test ./... | |
| docker-build: | |
| name: Docker build (smoke) | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend, worker] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Validate build contexts | |
| run: | | |
| test -f api/Dockerfile | |
| test -f frontend/Dockerfile | |
| - name: Build backend image | |
| run: docker build -t replayforge-backend:ci ./api | |
| - name: Build frontend image | |
| run: docker build -t replayforge-frontend:ci --target production ./frontend |