From 206cd51efd6d43e2734e7086f5211474d58350f1 Mon Sep 17 00:00:00 2001 From: Blizzard Date: Fri, 17 Jul 2026 09:41:41 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E8=A1=A5=20desktop=20=E8=A6=86=E7=9B=96?= =?UTF-8?q?=20=E2=80=94=E2=80=94=20go=20=E6=A8=A1=E5=9D=97=E8=BF=9B?= =?UTF-8?q?=E5=85=B3=E5=8D=A1=20+=20=E4=B8=89=E4=B8=AA=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E8=B7=91=20vitest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 两个此前的盲区: - sundynix-desktop 的 Go 模块不在 go.work,go job 的四模块循环从来没测过它 ——app.go 桥方法(download 残file/另存为)的单测在 CI 一次没跑过。 新开 desktop job 用 macos-latest:免装 gtk/webkit(linux 编 wails 一堆 CGO 头), 且 darwin 才是实际发行目标;go:embed 需要 frontend/dist,先 npm build。 - web job 只跑 tsc:desktop 68 例、admin 41 例、web 3 例 vitest 全都不进关卡。 统一补 npm test。 全部命令本地(macOS,与 runner 同环境)原样跑过:前端构建/go build+vet+test/ 三处 vitest 112 例全绿;YAML 解析与 GOWORK 引号校验过。 Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f354b4..527815f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: done web: - name: Frontend · tsc + name: Frontend · tsc + vitest runs-on: ubuntu-latest strategy: fail-fast: false @@ -46,11 +46,44 @@ jobs: node-version: "20" cache: npm cache-dependency-path: ${{ matrix.dir }}/package-lock.json - - name: install + typecheck + - name: install + typecheck + test(三个前端都有 vitest,此前只跑 tsc,测试从没进过关卡) working-directory: ${{ matrix.dir }} run: | npm ci npx tsc --noEmit + npm test + + # desktop 的 Go 模块不在 go.work 里,上面的 go job 从来没测过它(app.go 的 + # download/另存为等桥方法有单测但 CI 一次没跑过)。用 macos runner:一来免装 + # gtk/webkit(linux 编 wails 要一堆 CGO 头),二来 darwin 才是实际发行目标。 + # go:embed frontend/dist 要求先出前端产物,故先 npm build。 + desktop: + name: Desktop · go build + test (macOS) + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.25" + cache-dependency-path: sundynix-desktop/go.sum + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + cache-dependency-path: sundynix-desktop/frontend/package-lock.json + - name: 前端构建(供 go:embed) + working-directory: sundynix-desktop/frontend + run: | + npm ci + npm run build + - name: go build + vet + test + working-directory: sundynix-desktop + env: + GOWORK: "off" # 必须加引号:YAML 裸 off 会被解析成布尔 false + run: | + go build ./... + go vet ./... + go test ./... py: name: mcp-py · sandbox guard