From 9fc359731739266bee9dc827b70b2c0b85877d0b Mon Sep 17 00:00:00 2001 From: Blizzard Date: Tue, 23 Jun 2026 16:11:17 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=8A=A0=20GitHub=20Actions=20=E2=80=94?= =?UTF-8?q?=E2=80=94=20Go/=E5=89=8D=E7=AB=AF/mcp-py=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 工程保障地基:每次 push / PR 自动跑回归,防止改动悄悄破坏现有功能。 - go:4 模块 build + vet + test(bus 用内嵌 NATS,无需外部服务) - web:desktop/frontend + admin 各跑 npm ci + tsc --noEmit(矩阵并行) - py:mcp-py pip install -e . + sandbox 守卫测试(pytest,缺则 fallback harness) 带 concurrency 取消旧运行、npm/pip/go 缓存。 Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1caba9b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: CI + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + +# 同一分支新 push 取消上一次未完成的运行,省 CI 时间。 +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + go: + name: Go · build + vet + test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.25" + cache-dependency-path: "**/go.sum" + - name: build + vet + test(4 模块;bus 用内嵌 NATS,无需外部服务) + run: | + set -e + for m in sundynix-shared sundynix-gateway sundynix-dispatcher sundynix-mcp-go; do + echo "::group::$m" + (cd "$m" && go build ./... && go vet ./... && go test ./...) + echo "::endgroup::" + done + + web: + name: Frontend · tsc + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + dir: [sundynix-desktop/frontend, sundynix-admin] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + cache-dependency-path: ${{ matrix.dir }}/package-lock.json + - name: install + typecheck + working-directory: ${{ matrix.dir }} + run: | + npm ci + npx tsc --noEmit + + py: + name: mcp-py · sandbox guard + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + - name: install + test(无 Docker 时测降级路径) + working-directory: sundynix-mcp-py + run: | + python -m pip install --upgrade pip + python -m pip install -e . pytest + PYTHONPATH=src:tests python -m pytest tests/ -q || \ + PYTHONPATH=src:tests python -c "import test_sandbox as t; \ + fns=[getattr(t,n) for n in dir(t) if n.startswith('test_')]; \ + [ (f(),print('PASS',f.__name__)) for f in fns ]; print(f'{len(fns)} passed')"