diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..7d31d1d
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,14 @@
+# 构建状态:调用共用 Linux 构建流程。
+name: build
+on:
+ push:
+ pull_request:
+ merge_group:
+ workflow_dispatch:
+permissions:
+ contents: read
+jobs:
+ build:
+ uses: ./.github/workflows/linux.yml
+ with:
+ phase: build
diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml
new file mode 100644
index 0000000..ecbd986
--- /dev/null
+++ b/.github/workflows/gate.yml
@@ -0,0 +1,11 @@
+# 门禁状态:仅由所有者手动触发全量入口。
+name: gate
+on:
+ workflow_dispatch:
+permissions:
+ contents: read
+jobs:
+ gate:
+ uses: ./.github/workflows/linux.yml
+ with:
+ phase: gate
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 9e822bb..591cf6c 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -1,19 +1,22 @@
-# Linux 流水线:Rust 存储 + Haskell 引擎/Web/CLI 的构建与测试。
-#
-# 这里每条命令都在 WSL Debian(cargo 1.98 / GHC 9.10.3 / stack 3.11.1)上跑通过,
-# 见仓库根 README 的「构建与测试」段。Haskell 这边链接并装入 libchusql_core_storage.so,
-# 所以 Rust 先构建,LD_LIBRARY_PATH 指向它的输出目录,Haskell 用例才能真跑而不是 pending。
-# 打包和发版资源走 .github/workflows/release.yml(tag 触发,也可手动 dispatch)。
-name: linux
+# Linux CI:构建 Rust 与 Haskell,运行各组件测试。
+name: tests
on:
push:
- branches: [main]
pull_request:
+ merge_group:
workflow_dispatch:
+ workflow_call:
+ inputs:
+ phase:
+ type: string
+ default: tests
+
+permissions:
+ contents: read
concurrency:
- group: linux-${{ github.ref }}
+ group: linux-${{ inputs.phase || 'tests' }}-${{ github.ref }}
cancel-in-progress: true
env:
@@ -22,7 +25,7 @@ env:
jobs:
linux:
- name: build + test
+ name: ${{ inputs.phase || 'tests' }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
@@ -49,10 +52,12 @@ jobs:
run: cargo build --release
- name: cargo test
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-core/storage
run: cargo test --release
- name: cargo clippy (-D warnings)
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-core/storage
run: cargo clippy --all-targets -- -D warnings
@@ -78,6 +83,7 @@ jobs:
chusql-server/.stack-work
chusql-web/.stack-work
chusql-cli/.stack-work
+ benchmark/.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles('**/stack.yaml', '**/stack.yaml.lock') }}
restore-keys: ${{ runner.os }}-stack-
@@ -89,19 +95,37 @@ jobs:
working-directory: chusql-bootstrap
run: stack build --fast
+ - name: benchmark4csql build
+ working-directory: benchmark
+ run: stack build benchmark4csql --fast
+
+ - name: owner-triggered gate
+ if: inputs.phase == 'gate'
+ shell: pwsh
+ run: ./gate-check/run-gate.ps1
+
- name: engine tests
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-core/engine
run: stack test --fast
- name: server tests
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-server
run: stack test --fast
- name: web tests
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-web
run: stack test --fast
- name: cli tests
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
working-directory: chusql-cli
run: stack test chusql-cli --fast
+
+ - name: bootstrap tests
+ if: inputs.phase != 'build' && inputs.phase != 'gate'
+ working-directory: chusql-bootstrap
+ run: stack test chusql-bootstrap --fast
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 10b3e15..e20cc39 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -111,7 +111,7 @@ jobs:
name="chusql-${{ matrix.platform }}"
stage="dist/$name"
rm -rf "$stage"
- mkdir -p "$stage/bin" "$stage/scripts"
+ mkdir -p "$stage/bin" "$stage/resources"
cp chusql-core/storage/target/release/libchusql_core_storage.* "$stage/bin/"
@@ -143,7 +143,7 @@ jobs:
cp "$lib" "$stage/bin/"
done
- cp scripts/chusql.toml "$stage/scripts/"
+ cp resources/settings.toml.* "$stage/resources/"
cp scripts/install.ps1 scripts/install.sh "$stage/"
cp scripts/uninstall.ps1 scripts/uninstall.sh "$stage/"
mkdir -p "$stage/static"
@@ -166,7 +166,7 @@ jobs:
$name = "chusql-${{ matrix.platform }}"
$stage = "dist/$name"
if (Test-Path $stage) { Remove-Item -Recurse -Force $stage }
- New-Item -ItemType Directory -Force -Path "$stage/bin", "$stage/scripts" | Out-Null
+ New-Item -ItemType Directory -Force -Path "$stage/bin", "$stage/resources" | Out-Null
Copy-Item 'chusql-core/storage/target/release/chusql_core_storage.dll' "$stage/bin/"
@@ -195,7 +195,7 @@ jobs:
Where-Object { $_.Name -notlike 'chusql*' } |
ForEach-Object { Copy-Item $_.FullName "$stage/bin/" }
- Copy-Item 'scripts/chusql.toml' "$stage/scripts/"
+ Copy-Item 'resources/settings.toml.*' "$stage/resources/"
Copy-Item 'scripts/install.ps1', 'scripts/install.sh' $stage
Copy-Item 'scripts/uninstall.ps1', 'scripts/uninstall.sh' $stage
New-Item -ItemType Directory -Force -Path "$stage/static" | Out-Null
diff --git a/.gitignore b/.gitignore
index 1e4bfdf..a6b55e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,17 +38,14 @@ target/
# 运行时数据(Rust 服务默认数据目录 CHUSQL_DATA_DIR=data/),不入库
chusql-core/storage/data/
-# 一键启动脚本的默认数据目录与日志,不入库
-localdata/
-
-# 门禁运行时目录:脚本与 README 入库,临时目录与日志不入库
-gate-check/tmp/
+# 本地运行产物:一键启动的数据目录、门禁各车道日志与临时目录、打包产物,不入库
+logs/
# 本机打出来的发行包(scripts/package.sh / package.ps1 的产物),不入库
releases/
-# 前端 IDE 设置(字体等,由 /api/ui-settings 读写),本机专用,不入库
-scripts/chusql.ui.settings.json
+# 前端 IDE 设置(字体等,由 /api/ui-settings 读写),本机专用,不入库;resources/ 不参与打包
+resources/chusql.ui.settings.json
# Cargo.lock 要入库(本项目是要产出可执行程序的 crate,不是纯库)
@@ -79,7 +76,8 @@ scripts/chusql.ui.settings.json
*~
\#*\#
.\#*
-agent_credientials
+AGENTS.md
+agent-credientials
.dsh
# 注意:.zed/tasks.json 是本仓库共享的构建任务(stack build / run / test / repl),
# 需要入库,所以这里不忽略 .zed/
@@ -97,4 +95,3 @@ plandocs/
Thumbs.db
ehthumbs.db
desktop.ini
-AGENTS.md
diff --git a/AGENTS.md b/AGENTS.md
deleted file mode 100644
index d2f3c31..0000000
--- a/AGENTS.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# AGENTS.md — ChuSQL 开发契约(简版)
-
-参考:
-- 进度与待办:`project-plan.txt`
-- 已知问题:`known-issues.txt`
-- 设计依据:`design-decisions.txt`
-
-## 核心约束
-- project-plan.txt 是唯一进度来源。
-- 测试必须通过,禁止绕过检查。
-- 不吞错误,使用明确错误返回。
-- 表存在性以 catalog 为准。
-- 语义检查和优化只使用 schema。
-- 索引由存储层管理,优化器只判断可点查条件。
-- 优化不能改变结果语义。
-
-## 注释规范
-- 文件级:外部引用语句(Haskell `import`、Rust `use`、JS `import`、HTML 的 ``/`