feat(acp-bridge): 事件驱动真流式 + 新版协议方法对齐 #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # CI — zcode-open-bridge | |
| # | |
| # 三个 job: | |
| # 1. lint — ruff 检查 (代码风格 + bug 类规则) | |
| # 2. test — unittest 矩阵 (Python 3.11 / 3.13) | |
| # 3. perms — 三个组件的可执行位校验 (本项目历史反复踩的坑: | |
| # 编辑器/工具常把 100755 改回 100644, 导致用户下载后 | |
| # 无法直接执行。CI 在此兜底拦截) | |
| # | |
| # 触发: push 到 main、所有 PR。 | |
| # ============================================================================= | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| # 只装 ruff; 运行时三个组件零第三方依赖 | |
| - name: Install ruff | |
| run: pip install ruff==0.15.17 | |
| # 注意: 三个组件是「无后缀单文件脚本」, ruff 默认只扫 .py, | |
| # 必须显式把组件路径传进去, 否则会漏检核心代码。 | |
| - name: ruff check | |
| run: | | |
| ruff check \ | |
| packages/acp-bridge/zcode-acp-bridge \ | |
| packages/agent-help/zcode-agent-help \ | |
| packages/mcp-server/zcode-mcp-server \ | |
| shared/ \ | |
| tests/ | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # 代码纯标准库、无 3.10+ 专有语法; 取一个常见发行版版本 + 最新稳定版 | |
| # 覆盖兼容面, 不铺太宽省 CI 时长。 | |
| python-version: ["3.11", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # 测试用 stdlib unittest, 无需安装任何依赖 | |
| - name: Run tests (projection differ) | |
| run: python3 tests/test_projection_differ.py -v | |
| - name: Run tests (event translator) | |
| run: python3 tests/test_event_translator.py -v | |
| perms: | |
| name: Executable bit check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 校验三个组件在 git 里保持可执行 (100755)。 | |
| # 历史上编辑器/Edit 类工具多次把权限改回 100644, 用户下载后 | |
| # 无法直接 ./zcode-xxx 运行。这一步专门兜底。 | |
| - name: Verify components are executable | |
| run: | | |
| set -e | |
| fail=0 | |
| for f in \ | |
| packages/acp-bridge/zcode-acp-bridge \ | |
| packages/agent-help/zcode-agent-help \ | |
| packages/mcp-server/zcode-mcp-server; do | |
| mode=$(git ls-files --stage -- "$f" | awk '{print $1}') | |
| if [ "$mode" != "100755" ]; then | |
| echo "❌ $f 模式为 $mode, 应为 100755 (可执行)" | |
| echo " 修复: git update-index --chmod=+x -- \"$f\"" | |
| fail=1 | |
| else | |
| echo "✓ $f → 100755" | |
| fi | |
| done | |
| exit $fail |