diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..452178ea7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Production Build + +on: + push: + pull_request: + +permissions: + contents: read + +concurrency: + group: build-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-22.04 + timeout-minutes: 25 + env: + AUTH_SECRET: ci-build-placeholder-secret + AUTH_URL: http://localhost:3000 + NEXTAUTH_URL: http://localhost:3000 + NEXT_PUBLIC_APP_URL: http://localhost:3000 + POSTGRES_URL: postgres://user:password@localhost:5432/yedir_ai + DISABLE_PERF_GUARD_AUTO_INSTALL: "1" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.12.3 + run_install: false + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run production build + run: pnpm build diff --git a/docs/delivery-readiness-audit.md b/docs/delivery-readiness-audit.md index 3a96b6a7b..a7294b50e 100644 --- a/docs/delivery-readiness-audit.md +++ b/docs/delivery-readiness-audit.md @@ -21,7 +21,7 @@ - Canvas / Chat 工程化:拆分 `LovartHome`、`ImageNode`、`CanvasChatPanel` 和 `/api/chat` 的多个纯逻辑/展示模块,保留业务协议与调用方行为。 - 日志安全:新增结构化 logger、客户端 logger、脱敏工具和分批日志门禁,覆盖高风险 provider、上传、认证、Canvas 和部分生成链路。 - 仓库治理:清理 tracked 本地污染物,补齐 `.gitignore`、CI hygiene、secret/env/package metadata/test hygiene、dependency audit、release verification 和 branch readiness 检查。 -- 生产构建:`pnpm build` 与数据库迁移解耦,重型工作台页面改为动态渲染,迁移脚本增加连接/整体超时,生产构建已验证通过。 +- 生产构建:`pnpm build` 与数据库迁移解耦,重型工作台页面改为动态渲染,迁移脚本增加连接/整体超时,并新增独立 Build workflow 验证生产构建。 - 文档交付:README、部署、运维、架构、安全、贡献、支持、发布清单和依赖风险登记已按 `yedir-ai` 项目定位重写或补齐。 ## 已验证证据 @@ -58,7 +58,7 @@ SMOKE_BASE_URL=http://127.0.0.1:3001 pnpm verify:release - Push 当前分支到 GitHub。 - 创建 PR,并在 PR 描述中粘贴本地验证证据。 -- 等待 GitHub Actions:基础质量门禁、dependency audit、Playwright workflow。 +- 等待 GitHub Actions:基础质量门禁、Production Build、Dependency Audit、Playwright workflow。 - 根据 PR diff 做最后一次人工审查;如 GitHub Actions 与本地结果不一致,以远端 CI 为准处理。 ## 当前不包含的范围 diff --git a/docs/operations.md b/docs/operations.md index e45dfb182..04ecb741d 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -65,6 +65,8 @@ CI 和本地提交前检查复用同一个入口,避免规则漂移。 `.github/workflows/dependency-audit.yml` 独立运行 `pnpm audit:security`,在 push、pull request、每周定时任务和手动触发时守住 high/critical 依赖审计基线。它不依赖任何 secret,避免开源 PR 因环境变量缺失误失败。 +`.github/workflows/build.yml` 独立运行 `pnpm build`,验证生产构建、Next.js route collection 和静态/动态页面边界。该 workflow 使用占位环境变量,不连接真实数据库;数据库迁移仍由部署流程显式执行。 + Playwright workflow 独立运行,避免 e2e 依赖、浏览器安装和 secrets 影响基础门禁反馈速度。 Dependabot 每周检查 npm/pnpm 依赖和 GitHub Actions。依赖 PR 仍需按 PR 模板运行 `pnpm check:quality` 和路由烟测,不应自动合并。 diff --git a/scripts/check-ci-hygiene.mjs b/scripts/check-ci-hygiene.mjs index 4d2a995dc..7c7d01779 100644 --- a/scripts/check-ci-hygiene.mjs +++ b/scripts/check-ci-hygiene.mjs @@ -3,6 +3,7 @@ import { readFileSync } from "node:fs"; const workflowFiles = [ + ".github/workflows/build.yml", ".github/workflows/dependency-audit.yml", ".github/workflows/lint.yml", ".github/workflows/playwright.yml",