Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add a code coverage badge to CI

未关闭 适合新手
#19 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
github-actions, go

调研方向

从 .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 内容生成。

描述

documentation enhancement help wanted
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
  1. In CI, produce a coverage profile:

    • go test -coverprofile=coverage.out ./...
    • total via go tool cover -func=coverage.out | tail -1 (prints something like total: (statements) 62.3%).
  2. Publish a badge — two options:

    Option A — no third party (recommended, fits the project's local-first ethos).
    Generate an SVG (for example with github.com/AlexBeauchemin/gobadge), commit it to a badges branch, and reference it:
    coverage
    The publish step needs permissions: contents: write and should run only on push to main.

  3. 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/plan and cmd/metcode have no tests, so the percentage reflects that.
主要语言
Go
星标
1
派生
2
平均合并
1 小时 31 分钟
30 天内合并 PR
7

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Edwin-metcalf/MetCode 的其他 Issue

查看 Edwin-metcalf/MetCode 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。