test(ci): 第1刀 可移植 SQL 扫描硬闸 + 五支柱 PR 自检模板

执行机制四道闸 → 闸4(CI 硬闸) + 评审兜底落地:
- ci/scan-portable-sql.sh:扫 server Go 运行时查询禁用 MySQL 专属构造
  (UTC_TIMESTAMP/UTC_DATE/NOW()/FIELD(/ON DUPLICATE KEY/IFNULL),
  豁免方言层 dialect*.go / _test.go / 注释行;当前 152 文件 0 违规
- ci.yml:新增 portable-sql-scan job;push 触发路径补 server/**
- .gitea/PULL_REQUEST_TEMPLATE.md:可测试性五支柱 + 测试 + 红线自检清单
- 守支柱 3(纯逻辑/IO 分离·双库可移植),见 docs/dev-conventions.html

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-24 23:25:26 +08:00
parent 29ddd5b453
commit 2bf6701def
3 changed files with 116 additions and 1 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
name: ci-pangolin
# 触发条件:deploy/ 或 design/ 或 client/ 或 ci/ 变更时,以及所有向 main 的 PR
# 触发条件:deploy/ 或 design/ 或 client/ 或 server/ 或 ci/ 变更时,以及所有向 main 的 PR
on:
push:
branches: [main]
@@ -8,6 +8,7 @@ on:
- 'deploy/**'
- 'design/**'
- 'client/**'
- 'server/**'
- 'ci/**'
- '.gitea/workflows/ci.yml'
pull_request:
@@ -77,3 +78,16 @@ jobs:
-v "$PWD/client:/app" -w /app \
ghcr.io/cirruslabs/flutter:stable \
bash -c "flutter pub get && flutter analyze && flutter test test/unit test/widget"
# ── Job 5: Portable SQL Scan (支柱 3:双库可移植)─────────────────────────
# server Go 运行时查询不得含 MySQL 专属构造(同一份 SQL 要跑 mysql 与 sqlite)。
# 规则与豁免见 ci/scan-portable-sql.sh 头注 + docs/dev-conventions.html 支柱 3。
portable-sql-scan:
name: Portable SQL — 可移植性 (mysql/sqlite)
runs-on: nas
steps:
- name: Checkout
uses: actions/checkout@v4
- name: scan server Go runtime SQL for MySQL-specific constructs
run: bash ci/scan-portable-sql.sh