8ff992e74c
PR #3 触发新 ci.yml 第一次跑 golangci-lint,爆出 47 个 lint 错误,全部是上游 perfect-panel/server + hi-server 历史代码的存量 (errcheck / unused functions), 不是本批改动引入的。 新 ci.yml 的初衷是把红挡在 merge 前。47 个 legacy lint 错误会让每一个新 PR 都被堵住、无法 merge,等于把 lint check 变成 'PR 全部红,所有人靠经验跳过' 的反模式 — 这正是我们想避免的。 切到 only-new-issues 模式:只 flag 本 PR diff 引入的新 lint 问题,让 CI 对 增量改动保持纪律,同时不阻塞 legacy backlog。 并加 fetch-depth: 0,因为 only-new-issues 需要拿 base ref 算 diff。 存量 47 个 lint 问题独立 issue 跟踪,由后端工程师按优先级清。 Co-authored-by: multica-agent <github@multica.ai>
73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- internal
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-test:
|
|
name: Build, vet, test
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Download modules
|
|
run: go mod download
|
|
|
|
- name: Build
|
|
run: go build ./...
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Test
|
|
run: go test -race -count=1 ./...
|
|
|
|
lint:
|
|
name: golangci-lint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# Fetch base ref so golangci-lint can diff against it for only-new-issues.
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
args: --timeout=5m
|
|
# Legacy codebase has ~47 pre-existing lint issues (errcheck / unused
|
|
# carried over from upstream perfect-panel/server). Only flag NEW
|
|
# issues introduced by this PR so CI stays useful without forcing a
|
|
# mass cleanup. Backlog cleanup tracked separately.
|
|
only-new-issues: true
|