外包风险评估系统:领域引擎+前端+服务端持久化与生产部署
- 确定性领域引擎(分类/评分/分级/红线/费用/裁决)+LLM(通义千问)语言理解 - 6步评估向导、服务端草稿持久化(跨设备/编辑草稿保护) - 工作流(草稿→风控→管理层)、RBAC、报告导出、校准、客户/费率/红线/最低工资管理 - 专业图标体系替换全部emoji、看板美化 - 生产化:API_BASE可配置(同源反代)、auth密钥惰性读取修复RBAC - 444单测+204前端测试+51 e2e
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
name: 类型检查 / 单元测试 / 构建
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
# 使用含 pgvector 扩展的镜像(相似项目向量搜索迁移依赖)
|
||||
image: pgvector/pgvector:pg16
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: riskagent
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/riskagent
|
||||
# CI 不配置 LLM/AUTH:评估自动回退确定性规则引擎,RBAC 为演示模式
|
||||
DASHSCOPE_API_KEY: ''
|
||||
AUTH_SECRET: ''
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: 安装依赖
|
||||
run: npm ci
|
||||
|
||||
- name: 运行数据库迁移
|
||||
run: npm run migrate:up
|
||||
|
||||
- name: 类型检查(前后端)
|
||||
run: npm run typecheck
|
||||
|
||||
- name: 单元 / 属性测试
|
||||
run: npm test
|
||||
|
||||
- name: 构建
|
||||
run: npm run build
|
||||
|
||||
e2e:
|
||||
name: 端到端(API 全流程)
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-test
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg16
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: riskagent
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/riskagent
|
||||
DASHSCOPE_API_KEY: ''
|
||||
AUTH_SECRET: ''
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: 安装依赖
|
||||
run: npm ci
|
||||
|
||||
- name: 运行数据库迁移
|
||||
run: npm run migrate:up
|
||||
|
||||
- name: 构建
|
||||
run: npm run build
|
||||
|
||||
- name: 播种 E2E 所需基础数据(客户档案)
|
||||
run: node scripts/seed-e2e.mjs
|
||||
|
||||
- name: 启动后端
|
||||
run: |
|
||||
node dist/server/index.js &
|
||||
echo $! > server.pid
|
||||
for i in $(seq 1 30); do
|
||||
curl -sf http://localhost:3005/api/health && break
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: 运行端到端测试
|
||||
run: npm run e2e
|
||||
|
||||
- name: 关闭后端
|
||||
if: always()
|
||||
run: kill "$(cat server.pid)" || true
|
||||
Reference in New Issue
Block a user