fix(ci): start MongoDB explicitly via docker run
The Forgejo runner isn't honoring the 'services:' block — the playwright job booted the server cleanly but every Mongo query returned ECONNREFUSED on 127.0.0.1:27017. Replace 'services:' with an explicit 'docker run -d' step + nc-based readiness wait.
This commit is contained in:
parent
16aaeddcee
commit
a797f8e17c
1 changed files with 8 additions and 10 deletions
|
|
@ -21,11 +21,6 @@ jobs:
|
||||||
playwright:
|
playwright:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: vitest
|
needs: vitest
|
||||||
services:
|
|
||||||
mongo:
|
|
||||||
image: mongo:7
|
|
||||||
ports:
|
|
||||||
- 27017:27017
|
|
||||||
env:
|
env:
|
||||||
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
||||||
JWT_SECRET: ci-test-jwt-secret
|
JWT_SECRET: ci-test-jwt-secret
|
||||||
|
|
@ -43,6 +38,10 @@ jobs:
|
||||||
cache: npm
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npx playwright install --with-deps chromium
|
- run: npx playwright install --with-deps chromium
|
||||||
|
- name: Start MongoDB
|
||||||
|
run: docker run -d --name mongo-ci -p 27017:27017 mongo:7
|
||||||
|
- name: Wait for MongoDB
|
||||||
|
run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done'
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- name: Start server
|
- name: Start server
|
||||||
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
||||||
|
|
@ -79,11 +78,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: vitest
|
needs: vitest
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
services:
|
|
||||||
mongo:
|
|
||||||
image: mongo:7
|
|
||||||
ports:
|
|
||||||
- 27017:27017
|
|
||||||
env:
|
env:
|
||||||
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
||||||
JWT_SECRET: ci-test-jwt-secret
|
JWT_SECRET: ci-test-jwt-secret
|
||||||
|
|
@ -101,6 +95,10 @@ jobs:
|
||||||
cache: npm
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npx playwright install --with-deps chromium
|
- run: npx playwright install --with-deps chromium
|
||||||
|
- name: Start MongoDB
|
||||||
|
run: docker run -d --name mongo-ci -p 27017:27017 mongo:7
|
||||||
|
- name: Wait for MongoDB
|
||||||
|
run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done'
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- name: Start server
|
- name: Start server
|
||||||
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue