AlexStocks commented on code in PR #1085: URL: https://github.com/apache/dubbo-go-pixiu/pull/1085#discussion_r4534914212
########## .github/workflows/admin-build.yml: ########## @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +name: Admin CI + +permissions: + contents: read + +on: + push: + paths: + - 'admin/**' + - 'cmd/admin/**' + - 'go.mod' + - 'go.sum' + - '.github/workflows/admin-build.yml' + pull_request: + paths: + - 'admin/**' + - 'cmd/admin/**' + - 'go.mod' + - 'go.sum' + - '.github/workflows/admin-build.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + admin-build: + name: Admin Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version-file: 'go.mod' + cache: true + + - name: Download Go modules + run: sh .github/scripts/download-go-modules.sh + + - name: Build Admin backend + run: go build -o /tmp/pixiu-admin ./cmd/admin + + - uses: actions/setup-node@v5 + with: + node-version: 22 + cache: npm + cache-dependency-path: admin/web/package-lock.json + + - name: Build Admin frontend + working-directory: admin/web + run: | + npm ci --ignore-scripts + npm run build Review Comment: [P2] 前端构建门禁不检测类型错误与单测,admin/web 的类型/契约回归在本 job 下静默通过 **触发条件**:任何改动 `admin/web/**` 且只引入 TypeScript 类型错误、或使既有用例(`admin/web/tests/api-contract.test.ts`、`src/features/config/*Model.test.ts`)失败的 PR。 **实际影响**:本 job 只会在 rolldown 打包失败时变红。`vite build` 走 transpile-only 路径,不做类型检查;而 `admin/web/package.json` 已定义 `typecheck`(`tsc --noEmit`)与 `test`(`vitest run`)脚本,当前仓库 CI 中没有任何 job 调用它们(`github-actions.yml` 只有 Go 相关 job)。结果是类型错误与 16 个既有用例的回归可以静默合入 develop,而 "Admin Build" 绿灯会被读作"前端已通过构建验证"。 **证据**(在 head `db52ab9d` 的 `admin/web` 上本地实测,Node v22.22.2): - `npm ci --ignore-scripts` → exit 0;`npm run build` → exit 0(vite 8.3.4,2000 modules 转换,与 PR 正文的描述一致) - 基线 `npm run typecheck` → exit 0(`tsc --noEmit` 干净);`npm test` → exit 0(3 文件 / 16 用例全绿)。即补上这两步不会让 job 上线即红 - 变异反证:向 `src/main.tsx` 追加 `const __probe_typecheck: number = "definitely-a-string";`(文件 sha256 `5caf66b7…` → `ac4098c9…`,跑完已还原)后,`npm run build` 仍 exit 0 并输出 `✓ built in 1.85s`;同一文件 `npm run typecheck` → exit 2,报 `src/main.tsx(31,7): error TS2322: Type 'string' is not assignable to type 'number'` **修复方向**:在第 69-71 行的 frontend step 中补入已被定义的两步: ```yaml run: | npm ci --ignore-scripts npm run typecheck npm test npm run build ``` 若担心 `npm test` 的耗时,至少补 `npm run typecheck`(本地 `tsc --noEmit` 为秒级)。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
