From 5d25b577623d475caa8fbc58de8a9a756d0e1fa3 Mon Sep 17 00:00:00 2001 From: TianTian Date: Fri, 28 Aug 2026 05:25:40 +0800 Subject: [PATCH] ci: run type check, lint and builds on push and PR The repo has no automation, but it does take outside PRs, so every contributor has to assert by hand that they ran the gate. Two jobs, both on ubuntu-latest / Node 22: extension pnpm install --frozen-lockfile, check-types, lint, production esbuild installer npm ci, npm run build The steps are split rather than folded into `pnpm run package` so a failure names itself in the job list. pnpm is set up before setup-node because setup-node's `cache: pnpm` needs pnpm on PATH to locate the store. test:server is deliberately not wired up yet. 5 of the 38 test files read the developer's machine and cannot pass on a clean runner: agentOrchestrator.integration, autoSummarize, chatSummary and providerRuntime go through loadSqlite3(), which createRequire's @vscode/sqlite3 out of an installed Cursor; protocol.test.ts:232 asserts a block that only exists when the real ~/.ccursor/knowledge-base.json has entries. The workflow carries a comment with the details and the one-step diff to add once those are decoupled. --- .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 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..2e50863 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + extension: + name: Cursor++ + runs-on: ubuntu-latest + defaults: + run: + working-directory: Cursor++ + steps: + - uses: actions/checkout@v7 + + # pnpm 必须先于 setup-node 就位 —— setup-node 的 `cache: pnpm` + # 需要 PATH 上已有 pnpm 才能定位 store 目录。 + - uses: pnpm/action-setup@v6 + with: + version: 10 + + - uses: actions/setup-node@v7 + with: + node-version: 22 + cache: pnpm + cache-dependency-path: Cursor++/pnpm-lock.yaml + + - run: pnpm install --frozen-lockfile + + - name: Type check + run: pnpm run check-types + + - name: Lint + run: pnpm run lint + + # 与 `pnpm run package` 的产物一致,但 check-types / lint 已单独跑过, + # 这里只验证 production bundle 能构建出来。 + - name: Build + run: node esbuild.js --production + + # 注意: `pnpm run test:server` 暂未接入 —— 38 个测试文件里有 5 个依赖 + # 开发机环境,在干净 runner 上必然失败: + # + # agentOrchestrator.integration / autoSummarize / chatSummary / + # providerRuntime + # database/sqlite.ts 的 loadSqlite3() 从**已安装的 Cursor**里 + # createRequire('@vscode/sqlite3'),runner 上没有 Cursor 就抛 + # "Failed to load @vscode/sqlite3"。CURSOR_APP_ROOT 能改路径, + # 但改不出一个不存在的 Cursor。 + # + # protocol.test.ts:232 + # 断言 preamble 含 ,而这段只有在真实的 + # ~/.ccursor/knowledge-base.json 里有条目时才会出现。 + # + # 这 5 个文件解耦掉宿主依赖之后, 在 Build 之前加一步即可: + # - name: Tests + # run: pnpm run test:server + + installer: + name: installer + runs-on: ubuntu-latest + defaults: + run: + working-directory: installer + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-node@v7 + with: + node-version: 22 + cache: npm + cache-dependency-path: installer/package-lock.json + + - run: npm ci + + - name: Build + run: npm run build