Skip to content

ci: migrate to octocov - #5

Open
Devin-Yeung wants to merge 2 commits into
masterfrom
migrate-to-octocov
Open

ci: migrate to octocov#5
Devin-Yeung wants to merge 2 commits into
masterfrom
migrate-to-octocov

Conversation

@Devin-Yeung

@Devin-Yeung Devin-Yeung commented Feb 6, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Integrated code coverage reporting into the CI/CD pipeline. Coverage metrics including code-to-test ratios, test execution timing, and code change metrics are now automatically tracked and measured. Reports are generated and displayed on pull requests and the default branch, with results archived in GitHub artifacts.

@coderabbitai

coderabbitai Bot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

These changes introduce Octocov integration into the CI/CD and development environments. A new Nix package definition for Octocov is added, integrated into the development setup, configured via a new .octocov.yml file, and incorporated into the GitHub Actions workflow as a reporting step.

Changes

Cohort / File(s) Summary
CI/CD Integration
.github/workflows/ci.yml, .octocov.yml
Added Octocov report step to CI workflow (k1LoW/octocov-action@v1) and introduced new .octocov.yml configuration file defining coverage settings, code-to-test ratios, diff reporting, PR commenting, and branch-gated summary/report generation.
Development Environment
devenv.nix
Added octocov package reference to devenv packages list via pkgs.callPackage ./nix/pkgs/octocov.nix.
Nix Package Definition
nix/pkgs/octocov.nix
New Nix expression for building Octocov v0.74.4 from source using buildGoModule, with vendorHash, disabled tests, stripped symbols via ldflags, and MIT license metadata.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop hop, coverage gleams so bright!
Octocov tracks our code day and night,
Nix packages woven with care,
CI workflows now aware,
Quality metrics in golden light!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: migrate to octocov' directly and clearly summarizes the main change: introducing octocov into the CI pipeline and configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch migrate-to-octocov

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

7-8: ⚠️ Potential issue | 🟠 Major

Insufficient permissions for Octocov artifact storage.

The .octocov.yml configures artifact:// datastores for diff and report, which require write access to upload artifacts. The current contents: read permission will cause these features to fail.

🔧 Suggested fix to add required permissions
 permissions:
   contents: read
+  actions: write

Alternatively, scope permissions to the coverage job only if you want to keep test job minimal:

coverage:
  name: coverage / ${{ matrix.runner }}
  permissions:
    contents: read
    actions: write
🤖 Fix all issues with AI agents
In @.octocov.yml:
- Around line 1-25: The CI workflow needs permission to write GitHub Actions
artifacts used by octocov's datastores (artifact://${GITHUB_REPOSITORY}); update
the workflow permissions block (where permissions currently has contents: read)
to also include actions: write so the octocov-action can create/update the
artifact datastore used by diff and report.

In `@nix/pkgs/octocov.nix`:
- Around line 27-28: The package metadata string meta.description in octocov.nix
has an unbalanced parenthesis; update the description value for the meta
attribute (meta.description) to close the missing parenthesis at the end of the
string so the sentence reads correctly (e.g., add the missing ")" to the
description text).
🧹 Nitpick comments (2)
.github/workflows/ci.yml (1)

37-38: Job name is inconsistent with actual tool used.

The job is named codecov but now uses Octocov for reporting. Consider updating the name to reflect the actual tooling.

✏️ Suggested naming update
 coverage:
-    name: codecov / ${{ matrix.runner }}
+    name: coverage / ${{ matrix.runner }}
nix/pkgs/octocov.nix (1)

20-20: Consider documenting why tests are disabled.

doCheck = false skips upstream tests. If this is intentional (e.g., tests require network access or specific CI setup), a brief comment would help future maintainers understand the decision.

📝 Add explanatory comment
+  # Tests require network access / specific CI setup
   doCheck = false;

Comment thread .octocov.yml
Comment on lines +1 to +25
# generated by octocov init
coverage:
if: true
exclude:
- "**/*.pb.go"
- "**/cmd/**/*.go"
codeToTestRatio:
code:
- "**/*.go"
- "!**/*_test.go"
test:
- "**/*_test.go"
testExecutionTime:
if: true
diff:
datastores:
- artifact://${GITHUB_REPOSITORY}
comment:
if: is_pull_request
summary:
if: true
report:
if: is_default_branch
datastores:
- artifact://${GITHUB_REPOSITORY}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check permissions in CI workflow
rg -n "permissions:" -A 10 .github/workflows/ci.yml

Repository: Devin-Yeung/proglog

Length of output: 313


🏁 Script executed:

#!/bin/bash
# Check if there are any artifact-related steps in the workflow
rg -n "artifact" .github/workflows/ci.yml

# Also check the octocov documentation or see if there's any setup for artifacts
fd -e "yml" -e "yaml" .github/workflows/ | xargs rg -l "artifact"

Repository: Devin-Yeung/proglog

Length of output: 442


🏁 Script executed:

#!/bin/bash
# Check if there are any artifact-related steps in the workflow
rg -n "artifact" .github/workflows/ci.yml

# Check all workflow files
fd . '.github/workflows/' -e yml -e yaml | xargs rg -l "artifact"

Repository: Devin-Yeung/proglog

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check workflow files more simply
ls -la .github/workflows/

# Search for artifact in workflow files
grep -r "artifact" .github/workflows/ 2>/dev/null || echo "No artifact references found"

# Check octocov config
cat .octocov.yml | grep -A 2 "datastore"

Repository: Devin-Yeung/proglog

Length of output: 374


🏁 Script executed:

#!/bin/bash
# Look for any documentation about octocov setup
find . -name "*.md" -o -name "*.txt" | xargs grep -l "octocov" 2>/dev/null || echo "No octocov docs found"

# Check the full ci.yml to see if octocov is installed or run
cat .github/workflows/ci.yml

Repository: Devin-Yeung/proglog

Length of output: 1898


🌐 Web query:

octocov-action GitHub artifact datastore permission requirements

💡 Result:

For k1LoW/octocov-action using the artifact://... datastore (GitHub Actions Artifacts), the practical permission requirements come from (a) octocov’s “artifact datastore” constraints and (b) GitHub’s artifact APIs.

1) Required token / environment

octocov’s artifact datastore requires a token and repo context (normally satisfied automatically in Actions via GITHUB_TOKEN / GITHUB_REPOSITORY). It also notes that writing reports to the artifact datastore can only be done from GitHub Actions runs in the same repository. [1][2]

2) GitHub token permissions you need

If you explicitly scope GITHUB_TOKEN permissions in your workflow, use:

  • Read existing datastore artifacts (diff / fetch prior reports):

    • permissions: actions: read (covers listing/getting/downloading artifacts). [3]
  • Write/update the datastore artifact (e.g., overwrite requires deleting old artifact then uploading a new one):

    • permissions: actions: write (needed to delete artifacts; “overwrite” patterns typically delete + recreate). [3]

Additionally, if you run octocov features that comment on PRs, you’ll also need pull-requests: write (and note: forked PRs won’t have the write permissions needed). [1]

Minimal examples

# If you only need to read prior reports from artifact datastore
permissions:
  contents: read
  actions: read
# If you need to update/overwrite the artifact datastore report
permissions:
  contents: read
  actions: write

Sources: octocov artifact datastore docs/notes [1][2], GitHub REST API artifact permissions (read vs write) [3].

References
[1] https://github.com/k1LoW/octocov
[2] https://pkg.go.dev/github.com/k1LoW/octocov
[3] https://docs.github.com/en/rest/actions/artifacts


Add actions: write permission for octocov artifact datastore.

The .octocov.yml configures diff and report datastores using artifact://${GITHUB_REPOSITORY}, which requires the ability to write GitHub Actions artifacts. The current workflow has only permissions: contents: read, but octocov needs permissions: actions: write to update the artifact datastore. Without this, the octocov-action step will fail when attempting to write coverage reports.

Update the workflow permissions:

permissions:
  contents: read
  actions: write
🤖 Prompt for AI Agents
In @.octocov.yml around lines 1 - 25, The CI workflow needs permission to write
GitHub Actions artifacts used by octocov's datastores
(artifact://${GITHUB_REPOSITORY}); update the workflow permissions block (where
permissions currently has contents: read) to also include actions: write so the
octocov-action can create/update the artifact datastore used by diff and report.

Comment thread nix/pkgs/octocov.nix
Comment on lines +27 to +28
meta = {
description = "Octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor typo in description: missing closing parenthesis.

The description has an unbalanced parenthesis.

✏️ Fix typo
   meta = {
-    description = "Octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics";
+    description = "Octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics)";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
meta = {
description = "Octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics";
meta = {
description = "Octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics)";
🤖 Prompt for AI Agents
In `@nix/pkgs/octocov.nix` around lines 27 - 28, The package metadata string
meta.description in octocov.nix has an unbalanced parenthesis; update the
description value for the meta attribute (meta.description) to close the missing
parenthesis at the end of the string so the sentence reads correctly (e.g., add
the missing ")" to the description text).

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 38.552%. remained the same
when pulling 28c2c19 on migrate-to-octocov
into 3a66e69 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants