diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e2ef54f..bbd474c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,8 +1,11 @@ -# 远端 Gitea 未部署 Actions runner:本工作流不随 push 触发,仅供本地参考 / 手动触发。 -# 本地等价命令:pnpm ci:local(推送前必须全绿)。 +# 自建 Gitea 已部署 Actions runner(gitea-runner-01,label ubuntu-latest): +# push main 自动执行,也可在 Actions 页面手动触发。轻量冒烟见 ci-smoke.yml。 +# 本地等价命令:pnpm ci:local(推送前仍必须全绿,远端 CI 是第二道防线)。 name: ci on: + push: + branches: [main] workflow_dispatch: concurrency: @@ -25,7 +28,7 @@ jobs: ports: - 5432:5432 options: >- - --health-cmd "pg_isready -U lingxi -d lingxi_test" + --health-cmd "pg_isready -U postgres -d lingxi_test" --health-interval 5s --health-timeout 3s --health-retries 10 @@ -69,6 +72,11 @@ jobs: - name: 安装依赖 run: pnpm install --frozen-lockfile + # workspace 包的 types 指向 dist/(gitignore),全新检出必须先构建, + # 否则 Lint 的类型感知规则会报 type that cannot be resolved。 + - name: 构建 workspace 包(Lint 类型解析前置) + run: pnpm exec turbo run build --filter='./packages/*' + - name: 格式检查 run: pnpm format:check diff --git a/scripts/ci-local.mjs b/scripts/ci-local.mjs index e0112fa..c1993a9 100644 --- a/scripts/ci-local.mjs +++ b/scripts/ci-local.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * 本地 CI:在无 Gitea Actions runner 时,按 .gitea/workflows/ci.yml 的门禁顺序执行。 + * 本地 CI:按 .gitea/workflows/ci.yml 的门禁顺序执行(推送前强制;远端 Gitea Actions 为第二道防线)。 * 用法:pnpm ci:local(推荐通过 ./.tools/pnpm ci:local 锁定 pnpm 10) */ import { spawnSync } from 'node:child_process'; @@ -19,6 +19,10 @@ const e2eEnv = { /** 每一步可包含多条 pnpm 命令,任一失败立即退出;env 为该步骤追加的环境变量。 */ const steps = [ { label: '检查本地依赖(PG / Redis)', commands: [['check:dev']] }, + { + label: '构建 workspace 包(Lint 类型解析前置)', + commands: [['exec', 'turbo', 'run', 'build', '--filter=./packages/*']], + }, { label: '格式化检查', commands: [['format:check']] }, { label: 'Lint', commands: [['lint']] }, { label: '类型检查', commands: [['typecheck']] },