Skip to content

Code Coverage Report in PRs#3693

Draft
OrangeAndGreen wants to merge 2 commits intomasterfrom
CCCT-2305-PR_code_coverage_report
Draft

Code Coverage Report in PRs#3693
OrangeAndGreen wants to merge 2 commits intomasterfrom
CCCT-2305-PR_code_coverage_report

Conversation

@OrangeAndGreen
Copy link
Copy Markdown
Contributor

https://dimagi.atlassian.net/browse/CCCT-2305

Product Description

No user-facing change

Technical Summary

Moved the jacoco code coverage report earlier in the build process (so we're more likely to get the report even if a later step fails).
Configured the coverage report to post as a comment on the PR.

Safety Assurance

Safety story

These changes do not affect the actual app that gets built, they are just a reporting metric during the build.

Automated test coverage

None

QA Plan

None

@OrangeAndGreen OrangeAndGreen self-assigned this May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Code Coverage

There is no coverage information present for the Files changed

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

📝 Walkthrough

Walkthrough

The PR updates the commcare-android GitHub Actions workflow to enhance JaCoCo code coverage reporting. The Build job now includes a new step that generates the JaCoCo test report, uploads it as an artifact to a nested jacoco directory, and posts a comment on pull requests with the coverage results using the madrapps/jacoco-report action. This replaces the previous JaCoCo reporting approach with an automated PR comment feature that displays coverage metrics directly in the pull request.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding code coverage report functionality to pull requests.
Description check ✅ Passed The description covers key sections including a ticket link, technical summary, and safety assurance with explanations for why no test coverage or QA is needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CCCT-2305-PR_code_coverage_report

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
.github/workflows/commcare-android-pr-workflow.yml (1)

23-26: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add permissions: pull-requests: write to the job — the action will fail without it.

The madrapps/jacoco-report action's official documentation requires permissions: pull-requests: write at the job level, and explicitly notes that without the appropriate permission, the GITHUB_TOKEN won't have sufficient access to write the coverage comment. If the repository's default token permission is set to read-only, the step will fail with HttpError: Resource not accessible by integration, which will in turn fail the entire job, blocking the Assemble Release apk and subsequent steps.

🔒 Proposed fix — add permissions to the job
   build-test-assemble:
     name: Build
     runs-on: ubuntu-latest
+    permissions:
+      pull-requests: write
+      contents: read
     steps:

Also applies to: 100-107

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/commcare-android-pr-workflow.yml around lines 23 - 26, The
GitHub Actions job "build-test-assemble" must declare job-level permissions to
allow the madrapps/jacoco-report step to write coverage comments; add a
permissions block with "pull-requests: write" to the build-test-assemble job
(and mirror the same change for the other job around lines 100-107) so the
GITHUB_TOKEN has sufficient access and the jacoco-report step doesn't fail with
"Resource not accessible by integration".
🧹 Nitpick comments (1)
.github/workflows/commcare-android-pr-workflow.yml (1)

102-102: 💤 Low value

madrapps/jacoco-report@v1.7.1 is one patch behind the current release.

The latest published version on the GitHub Marketplace is v1.7.2. Consider updating to pick up any bug fixes.

-        uses: madrapps/jacoco-report@v1.7.1
+        uses: madrapps/jacoco-report@v1.7.2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/commcare-android-pr-workflow.yml at line 102, Update the
GitHub Action version reference for the jacoco report step: replace the use of
"madrapps/jacoco-report@v1.7.1" with "madrapps/jacoco-report@v1.7.2" so the
workflow uses the latest marketplace release; ensure the change is applied to
the workflow step that currently references madrapps/jacoco-report@v1.7.1.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/commcare-android-pr-workflow.yml:
- Around line 92-107: The three coverage steps ("Generate JaCoCo Report",
"Upload JaCoCo Report", and "Comment JaCoCo Coverage on PR") can fail and should
not block the build; update each of those job steps in the workflow to include
continue-on-error: true so failures in jacocoTestReport, artifact upload, or the
PR comment action won't stop subsequent steps like Restore Keystore or Assemble
Release apk.

---

Outside diff comments:
In @.github/workflows/commcare-android-pr-workflow.yml:
- Around line 23-26: The GitHub Actions job "build-test-assemble" must declare
job-level permissions to allow the madrapps/jacoco-report step to write coverage
comments; add a permissions block with "pull-requests: write" to the
build-test-assemble job (and mirror the same change for the other job around
lines 100-107) so the GITHUB_TOKEN has sufficient access and the jacoco-report
step doesn't fail with "Resource not accessible by integration".

---

Nitpick comments:
In @.github/workflows/commcare-android-pr-workflow.yml:
- Line 102: Update the GitHub Action version reference for the jacoco report
step: replace the use of "madrapps/jacoco-report@v1.7.1" with
"madrapps/jacoco-report@v1.7.2" so the workflow uses the latest marketplace
release; ensure the change is applied to the workflow step that currently
references madrapps/jacoco-report@v1.7.1.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2344aa7e-c030-49de-aa89-8236cc9d7755

📥 Commits

Reviewing files that changed from the base of the PR and between 3daf861 and 391ebd3.

📒 Files selected for processing (1)
  • .github/workflows/commcare-android-pr-workflow.yml

Comment thread .github/workflows/commcare-android-pr-workflow.yml
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

⛔ CodeRabbit does not have permission to push changes to this repository. Please ensure CodeRabbit has Contents: Read and write permission.

@OrangeAndGreen OrangeAndGreen added the skip-integration-tests Skip android tests. label May 6, 2026
Added continue-on-error in case code coverage reporting encounters any errors.
Upgraded jacoco-report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-integration-tests Skip android tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant