Backgrounding 'node .output/server/index.mjs &' swallowed startup crashes — failures presented as a useless 30s 'Wait for server' timeout. Pipe stderr to a log file and cat it on failure so the next crash is one click away.
118 lines
3.3 KiB
YAML
118 lines
3.3 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
vitest:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run test:run
|
|
|
|
playwright:
|
|
runs-on: ubuntu-latest
|
|
needs: vitest
|
|
services:
|
|
mongo:
|
|
image: mongo:7
|
|
ports:
|
|
- 27017:27017
|
|
env:
|
|
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
|
JWT_SECRET: ci-test-jwt-secret
|
|
RESEND_API_KEY: re_ci_dummy_not_used
|
|
HELCIM_API_TOKEN: helcim_ci_dummy_not_used
|
|
NUXT_PUBLIC_COMING_SOON: 'false'
|
|
NODE_ENV: development
|
|
ALLOW_DEV_TEST_ENDPOINTS: 'true'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: npm run build
|
|
- name: Start server
|
|
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
|
env:
|
|
PORT: 3000
|
|
- name: Wait for server
|
|
run: timeout 30 sh -c 'until curl -sf http://localhost:3000; do sleep 1; done'
|
|
- name: Server log on failure
|
|
if: failure()
|
|
run: cat /tmp/server.log || true
|
|
- run: npx playwright test --ignore-snapshots
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report
|
|
path: |
|
|
playwright-report/
|
|
e2e/test-results/
|
|
retention-days: 7
|
|
|
|
notify:
|
|
name: Notify on failure
|
|
runs-on: ubuntu-latest
|
|
needs: [vitest, playwright]
|
|
if: failure()
|
|
steps:
|
|
- name: Post to Slack
|
|
run: |
|
|
curl -s -X POST "${{ secrets.SLACK_WEBHOOK_URL }}" \
|
|
-H 'Content-type: application/json' \
|
|
--data "{\"text\":\":x: *Ghost Guild CI failed* on \`${{ github.ref_name }}\`\nCommit: ${{ github.sha }}\n${{ github.server_url }}/${{ github.repository }}/actions\"}"
|
|
|
|
visual:
|
|
runs-on: ubuntu-latest
|
|
needs: vitest
|
|
continue-on-error: true
|
|
services:
|
|
mongo:
|
|
image: mongo:7
|
|
ports:
|
|
- 27017:27017
|
|
env:
|
|
MONGODB_URI: mongodb://localhost:27017/ghostguild-test
|
|
JWT_SECRET: ci-test-jwt-secret
|
|
RESEND_API_KEY: re_ci_dummy_not_used
|
|
HELCIM_API_TOKEN: helcim_ci_dummy_not_used
|
|
NUXT_PUBLIC_COMING_SOON: 'false'
|
|
NODE_ENV: development
|
|
ALLOW_DEV_TEST_ENDPOINTS: 'true'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: npm run build
|
|
- name: Start server
|
|
run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
|
|
env:
|
|
PORT: 3000
|
|
- name: Wait for server
|
|
run: timeout 30 sh -c 'until curl -sf http://localhost:3000; do sleep 1; done'
|
|
- name: Server log on failure
|
|
if: failure()
|
|
run: cat /tmp/server.log || true
|
|
- run: npx playwright test e2e/visual/
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: visual-diffs
|
|
path: e2e/test-results/
|
|
retention-days: 7
|