Skip to content

Commit ccd424c

Browse files
eprifticlaude
andcommitted
fix: Merge E2E tests into docker-build job so image is available
The E2E job ran on a separate runner and couldn't access the Docker image built by docker-build. Its own build attempt also failed because gpredomics/gpredomicspy weren't checked out. Now E2E steps run in the same job, reusing the image, with its own postgres instance on port 8001. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e74434b commit ccd424c

1 file changed

Lines changed: 27 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: npm run build
5959

6060
# -------------------------------------------------------------------------
61-
# Docker build (full stack)
61+
# Docker build + E2E tests (full stack)
6262
# -------------------------------------------------------------------------
6363
docker-build:
6464
runs-on: ubuntu-latest
@@ -129,40 +129,40 @@ jobs:
129129
docker network rm test-net
130130
exit 1
131131
132-
# -------------------------------------------------------------------------
133-
# E2E tests (Playwright against Docker)
134-
# -------------------------------------------------------------------------
135-
e2e-test:
136-
runs-on: ubuntu-latest
137-
needs: [docker-build]
138-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
139-
140-
steps:
141-
- uses: actions/checkout@v4
132+
# --- E2E tests (Playwright against the Docker image we just built) ---
142133

143134
- name: Set up Node.js
144135
uses: actions/setup-node@v4
145136
with:
146137
node-version: "20"
147138

148-
- name: Install dependencies
139+
- name: Install E2E dependencies
140+
working-directory: predomicsapp-web
149141
run: npm ci
150142

151143
- name: Install Playwright browser
144+
working-directory: predomicsapp-web
152145
run: npx playwright install chromium
153146

154-
- name: Build Docker image for E2E
155-
run: |
156-
docker build -t predomicsapp-web:e2e -f Dockerfile ../ 2>/dev/null || echo "Using cached image"
157-
158-
- name: Start app
147+
- name: Start app for E2E
159148
run: |
160-
docker run -d --name e2e-app -p 8001:8000 \
161-
-e PREDOMICS_SECRET_KEY=e2e-test-secret \
162-
predomicsapp-web:latest 2>/dev/null || \
163-
docker run -d --name e2e-app -p 8001:8000 \
149+
docker network create e2e-net
150+
docker run -d --name e2e-db --network e2e-net \
151+
-e POSTGRES_USER=predomics \
152+
-e POSTGRES_PASSWORD=predomics \
153+
-e POSTGRES_DB=predomics \
154+
postgres:16-alpine
155+
for i in $(seq 1 15); do
156+
if docker exec e2e-db pg_isready -U predomics > /dev/null 2>&1; then
157+
echo "Postgres ready on attempt $i"
158+
break
159+
fi
160+
sleep 2
161+
done
162+
docker run -d --name e2e-app --network e2e-net -p 8001:8000 \
163+
-e PREDOMICS_DATABASE_URL=postgresql+asyncpg://predomics:predomics@e2e-db:5432/predomics \
164164
-e PREDOMICS_SECRET_KEY=e2e-test-secret \
165-
predomicsapp-web:e2e
165+
predomicsapp-web:latest
166166
for i in $(seq 1 30); do
167167
if curl -sf http://localhost:8001/health; then
168168
echo "App ready on attempt $i"
@@ -173,10 +173,13 @@ jobs:
173173
done
174174
175175
- name: Run E2E tests
176+
working-directory: predomicsapp-web
176177
run: npm run test:e2e
177178
env:
178179
BASE_URL: http://localhost:8001
179180

180-
- name: Cleanup
181+
- name: E2E cleanup
181182
if: always()
182-
run: docker stop e2e-app 2>/dev/null || true
183+
run: |
184+
docker stop e2e-app e2e-db 2>/dev/null || true
185+
docker network rm e2e-net 2>/dev/null || true

0 commit comments

Comments
 (0)