Add a code coverage badge to CI
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- github-actions, go
- 领域
- ci-cd, documentation
调研方向
从 .github/workflows/ci.yml 中唯一的 build-test 作业和 README 第 15 行的 CI 徽章开始。添加 go test -coverprofile=coverage.out ./...,并用 go tool cover -func 读取总覆盖率,然后添加一个仅在推送到 main 时运行、且需要 contents: write 的步骤。选项 A 的文字有误,因此请与维护者确认使用哪个徽章选项。完成标准是:每个 PR 都运行覆盖率,徽章只在 main 上更新,并且 README 将其显示在 CI 徽章旁边。
由索引模型根据 Issue 内容生成。
描述
What
Measure test coverage in CI and surface it as a badge in the README, next to the existing CI badge.
Current state
.github/workflows/ci.yml has one job, build-test, running go build ./..., go vet ./..., a gofmt check, and go test ./.... The README shows the CI badge at the top (line 15).
Proposed change
-
In CI, produce a coverage profile:
go test -coverprofile=coverage.out ./...- total via
go tool cover -func=coverage.out | tail -1(prints something liketotal: (statements) 62.3%).
-
Publish a badge — two options:
Option A — no third party (recommended, fits the project's local-first ethos).
Generate an SVG (for example withgithub.com/AlexBeauchemin/gobadge), commit it to abadgesbranch, and reference it:
coverage
The publish step needspermissions: contents: writeand should run only on push tomain. -
Add the chosen badge to the README next to the CI badge.
Acceptance criteria
- CI computes coverage on every push and PR.
- Badge renders in the README and updates on
main(not on every PR). - Existing CI steps (build, vet, gofmt, test) keep running unchanged.
- Note in the issue/PR that
internal/planandcmd/metcodehave no tests, so the percentage reflects that.
- 主要语言
- Go
- 星标
- 1
- 派生
- 2
- 平均合并
- 1 小时 31 分钟
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Edwin-metcalf/MetCode 的其他 Issue
-
Recover tool calls wrapped in a markdown code fence可能已有人在做 @jay23606 今天认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 82/100
Edwin-metcalf/MetCode#18 ·
-
Scanln only accepts a bare y + clear the stream可能已有人在做 @jay23606 今天认领。 未关闭enhancement good first issue
难度 2/5 1-3 小时 新手友好度 68/100
Edwin-metcalf/MetCode#16 · 1 条评论 ·
-
testing
难度 2/5 1-3 小时 新手友好度 88/100
Edwin-metcalf/MetCode#9 ·
-
Add a Makefile未关闭enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 76/100
Edwin-metcalf/MetCode#8 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 84/100
Edwin-metcalf/MetCode#7 ·
查看 Edwin-metcalf/MetCode 的全部 Issue
相似的 Issue
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 90/100
jordansmall/spindrift#5575 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
JakeChampion/lang#12684 ·
维护者通常 1 天内回复
-
goose sub-agent runs are never indexed: blame finds no session for any file a `delegate` child wrote未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
C-bug O-community X-blathers-triaged
难度 2/5 1-3 小时 新手友好度 78/100
cockroachdb/cockroach#176150 · 1 条评论 ·
维护者通常 12 天内回复
-
triage
难度 2/5 1-3 小时 新手友好度 86/100
wakatime/wakatime-cli#1649 ·
维护者通常 1 天内回复