Repository navigation
ci: 新增 proto 自举门禁 job(dogfood gates) - #37
Merged
Merged
Conversation
- CI 用官方 protoc release zip 解到 /usr/local:protobuf.yaml 的 google/protobuf 依赖是本地路径 /usr/local/include,apt 的 protobuf-compiler 装在 /usr/include 对不上 - 安装 buf v1.74.0(format 默认引擎与 breaking 依赖;lint 引擎内置) - checkout fetch-depth: 0:breaking 缺省物化 origin/main 作 base - 缓存 ~/.cache/protobuild/deps,key 按 protobuf.yaml 哈希 - 四条门禁已本地验证全绿(macOS,protoc 33.4 / buf 1.74.0)
原实现 os.Getenv("GOPATH") 为空时 filepath.Join 得到相对 "pkg/mod",
GitHub runner 上不导出 GOPATH,导致 vendor 解析 gomod 源时校验
"subdirectory not found"(protobuild PR#37 proto job 实测复现)。
解析优先级:go env GOMODCACHE(权威,反映实际 go get 落盘位置)
> $GOPATH/pkg/mod > $HOME/go/pkg/mod(go 的默认)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
在仓库自身 CI(
.github/workflows/ci.yml)新增protojob,用 protobuild 自己的命令对本仓库proto/与 vendor 产物做自举门禁:同步更新 AGENTS.md 的 CI 描述。
关键设计点
/usr/local(pin v36.2):protobuf.yaml的google/protobuf依赖是本地路径/usr/local/include/google/protobuf,apt 的protobuf-compiler装在/usr/include对不上,这是 CI 化最容易踩的坑format默认引擎与breaking需要 buf 二进制(lint引擎内置,无需安装)checkoutfetch-depth: 0:breaking缺省物化origin/main作 base,浅检出没有该 ref~/.cache/protobuild/deps,key 按protobuf.yaml哈希go run .(Taskfile 同款惯例):门禁盯的是当前 PR 代码的行为,而非已发布二进制验证
actionlint对新 job 零告警(剩余 2 条setup-go@v4过旧告警为基线 lint/test job 自带;新 job 用 v5)没做的(可后续)
gen同步门禁(protobuild gen && git diff --exit-code):需要 CI 装 protoc 插件(go/retag),是整条链最重的部分,本次按轻量方案先不引入追加:修复 gomod 源解析 bug(d95f1ee)
首次 CI 真跑暴露出 protobuild 自身 bug:
depresolver.NewManager用os.Getenv("GOPATH")推导模块缓存目录,GitHub runner 不导出 GOPATH → 得到相对路径pkg/mod→vendor校验报 "subdirectory 'proto/retag' not found in module"。修复:解析优先级改为
go env GOMODCACHE(权威,反映 go get 实际落盘)>$GOPATH/pkg/mod>$HOME/go/pkg/mod;带 TDD 回归测试(TestNewManagerGomodPathWithoutGopathEnv、TestResolveGomodPath),本地已用env -u GOPATH go run . vendor复现并验证修复。