fix(ci): 修复全新检出 Lint 失败并恢复 main 自动触发
背景:run #37 在 runner 上失败于 Lint,日志报 @lingxi/* 下发类型无法解析—— workspace 包 types 指向 dist/,而 dist/ 被 gitignore,全新检出未构建导致 类型感知规则失效;另 postgres 健康检查 -U lingxi 与 POSTGRES_USER=postgres 不一致。 改动: - ci.yml:Lint 前新增 packages 构建步骤;健康检查改为 pg_isready -U postgres; 恢复 push main 自动触发(保留 workflow_dispatch)。 - ci-local.mjs:同步补充 packages 构建步骤,避免全新检出本地 CI 同样失败。 影响面:仅 CI 配置与本地 CI 脚本,不改业务代码;push main 后自动跑完整门禁。 回滚方式:revert 本提交;如需临时停用远端 CI,注释 on.push。 验证证据:runner 冒烟 run #38 全绿(ci-smoke.yml,71s);本提交推送后由远端 ci.yml 完整链路验证。
This commit is contained in:
1 parent
81c0426d71
commit
88d9c77522
2 files changed
+16
-4
No files matched your search
+11
-3
@@ -1,8 +1,11 @@
|
|||||||
# 远端 Gitea 未部署 Actions runner:本工作流不随 push 触发,仅供本地参考 / 手动触发。
|
# 自建 Gitea 已部署 Actions runner(gitea-runner-01,label ubuntu-latest):
|
||||||
# 本地等价命令:pnpm ci:local(推送前必须全绿)。
|
# push main 自动执行,也可在 Actions 页面手动触发。轻量冒烟见 ci-smoke.yml。
|
||||||
|
# 本地等价命令:pnpm ci:local(推送前仍必须全绿,远端 CI 是第二道防线)。
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -25,7 +28,7 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U lingxi -d lingxi_test"
|
--health-cmd "pg_isready -U postgres -d lingxi_test"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
--health-timeout 3s
|
--health-timeout 3s
|
||||||
--health-retries 10
|
--health-retries 10
|
||||||
@@ -69,6 +72,11 @@ jobs:
|
|||||||
- name: 安装依赖
|
- name: 安装依赖
|
||||||
run: pnpm install --frozen-lockfile
|
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: 格式检查
|
- name: 格式检查
|
||||||
run: pnpm format:check
|
run: pnpm format:check
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/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)
|
* 用法:pnpm ci:local(推荐通过 ./.tools/pnpm ci:local 锁定 pnpm 10)
|
||||||
*/
|
*/
|
||||||
import { spawnSync } from 'node:child_process';
|
import { spawnSync } from 'node:child_process';
|
||||||
@@ -19,6 +19,10 @@ const e2eEnv = {
|
|||||||
/** 每一步可包含多条 pnpm 命令,任一失败立即退出;env 为该步骤追加的环境变量。 */
|
/** 每一步可包含多条 pnpm 命令,任一失败立即退出;env 为该步骤追加的环境变量。 */
|
||||||
const steps = [
|
const steps = [
|
||||||
{ label: '检查本地依赖(PG / Redis)', commands: [['check:dev']] },
|
{ label: '检查本地依赖(PG / Redis)', commands: [['check:dev']] },
|
||||||
|
{
|
||||||
|
label: '构建 workspace 包(Lint 类型解析前置)',
|
||||||
|
commands: [['exec', 'turbo', 'run', 'build', '--filter=./packages/*']],
|
||||||
|
},
|
||||||
{ label: '格式化检查', commands: [['format:check']] },
|
{ label: '格式化检查', commands: [['format:check']] },
|
||||||
{ label: 'Lint', commands: [['lint']] },
|
{ label: 'Lint', commands: [['lint']] },
|
||||||
{ label: '类型检查', commands: [['typecheck']] },
|
{ label: '类型检查', commands: [['typecheck']] },
|
||||||
|
|||||||
Reference in new issue
Block a user