name: CI # 只认 main:push 到 main、以及任何以 main 为目标的 PR。 # 开发分支(feat/*)自己 push 不跑 CI,靠合入 main 前的 PR 把关。 on: push: branches: [main] pull_request: branches: [main] # 同一分支新 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, sundynix-web] 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')"