R28-1 R28-4: 收口网页门禁与公网 smoke
这个提交包含在:
+27
-61
@@ -2,6 +2,9 @@ name: ci-e2e
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "10 19 * * *"
|
||||
@@ -9,7 +12,7 @@ on:
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
timeout-minutes: 60
|
||||
|
||||
services:
|
||||
postgres:
|
||||
@@ -27,24 +30,26 @@ jobs:
|
||||
--health-retries=10
|
||||
|
||||
env:
|
||||
NODE_ENV: test
|
||||
PORT: 3000
|
||||
HOST: 127.0.0.1
|
||||
APP_ORIGIN: http://127.0.0.1:3000
|
||||
DATABASE_URL: postgresql://hyboa_user:[email protected]:5432/hyb_oa?schema=public
|
||||
JWT_SECRET: ci_e2e_secret_key
|
||||
OCR_PROVIDER: mock
|
||||
OCR_MAX_ATTEMPTS: 3
|
||||
OCR_POLL_CRON: "*/5 * * * * *"
|
||||
DELEGATION_REVOKE_CRON: "0 * * * *"
|
||||
SERVE_CLIENT_DIST: "true"
|
||||
CLIENT_DIST_DIR: "../client/dist"
|
||||
E2E_BASE_URL: http://127.0.0.1:3000
|
||||
QA_DB_HOST: 127.0.0.1
|
||||
QA_DB_PORT: 5432
|
||||
QA_DB_USER: hyboa_user
|
||||
QA_DB_PASSWORD: hyboa_password
|
||||
QA_DB_ADMIN_DB: postgres
|
||||
QA_PORT: 3000
|
||||
QA_HOST: 127.0.0.1
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Select gate mode
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
echo "WEB_GATE_MODE=smoke-local" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "WEB_GATE_MODE=full-local" >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -62,61 +67,22 @@ jobs:
|
||||
working-directory: client
|
||||
run: npm ci
|
||||
|
||||
- name: Migrate database
|
||||
working-directory: server
|
||||
run: npm run prisma:migrate:deploy
|
||||
|
||||
- name: Seed database
|
||||
working-directory: server
|
||||
run: npm run seed:dev
|
||||
|
||||
- name: Build client
|
||||
working-directory: client
|
||||
run: npm run build
|
||||
- name: Install PostgreSQL client
|
||||
run: sudo apt-get update && sudo apt-get install -y postgresql-client
|
||||
|
||||
- name: Install Playwright browsers
|
||||
working-directory: client
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Start server
|
||||
working-directory: server
|
||||
run: |
|
||||
nohup npm run dev > /tmp/hyb-oa-server.log 2>&1 &
|
||||
echo $! > /tmp/hyb-oa-server.pid
|
||||
|
||||
- name: Wait for ready
|
||||
run: |
|
||||
for i in {1..45}; do
|
||||
if curl -fsS "http://127.0.0.1:3000/ready" >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "Server readiness check timed out" >&2
|
||||
exit 1
|
||||
|
||||
- name: Run Playwright E2E
|
||||
working-directory: client
|
||||
run: npm run test:e2e
|
||||
|
||||
- name: Stop server
|
||||
if: always()
|
||||
run: |
|
||||
if [[ -f /tmp/hyb-oa-server.pid ]]; then
|
||||
kill "$(cat /tmp/hyb-oa-server.pid)" || true
|
||||
fi
|
||||
|
||||
- name: Dump server log on failure
|
||||
if: failure()
|
||||
run: |
|
||||
echo "==== /tmp/hyb-oa-server.log ===="
|
||||
cat /tmp/hyb-oa-server.log || true
|
||||
- name: Run web gate
|
||||
run: bash scripts/qa/run-web-gates.sh "$WEB_GATE_MODE"
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: client/playwright-report
|
||||
name: playwright-report-${{ env.WEB_GATE_MODE }}-${{ github.run_id }}
|
||||
path: |
|
||||
client/playwright-report
|
||||
client/test-results
|
||||
if-no-files-found: ignore
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户