Skip to content

ci: add HTTP build cache + merge_group trigger - #12

Merged
jamesarich merged 3 commits into
mainfrom
ci/build-cache
Jul 21, 2026
Merged

ci: add HTTP build cache + merge_group trigger#12
jamesarich merged 3 commits into
mainfrom
ci/build-cache

Conversation

@jamesarich

@jamesarich jamesarich commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the shared remote HTTP Gradle build cache (the same mechanism meshtastic-sdk uses), so CI reuses task outputs across runs.

What changed

  • gradle/build-cache.settings.gradle (new): configures a remote(HttpBuildCache) from GRADLE_CACHE_URL / GRADLE_CACHE_USERNAME / GRADLE_CACHE_PASSWORD (env/CI secrets, or local.properties for local use). Push is enabled only when credentials are present, so fork PRs (which have no secrets) are pull-only and can't poison the cache.
  • settings.gradle.kts: apply(from = "gradle/build-cache.settings.gradle").
  • .github/workflows/ci.yml: passes the three GRADLE_CACHE_* secrets as workflow env.

Required repo secrets (please add)

GRADLE_CACHE_URL, GRADLE_CACHE_USERNAME (meshtastic), GRADLE_CACHE_PASSWORD. Absent them, the remote cache simply disables itself (local cache still works) — CI is never broken.

Notes

actionlint clean. Nothing hardcoded — all three values come from secrets. Config-cache stays off here (the plugin under test is config-cache-incompatible); the build cache is independent of that.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved CI workflow support for merge queue validation.
    • Added Gradle build caching to speed up builds.
    • Enabled secure credential handling for shared remote cache access.
    • Local caching remains available when remote caching is not configured.

Add a shared HTTP build cache (gradle/build-cache.settings.gradle),
applied from settings.gradle.kts and configured from the GRADLE_CACHE_URL
/ GRADLE_CACHE_USERNAME / GRADLE_CACHE_PASSWORD env vars (CI secrets). Push
is enabled only when credentials are present, so fork PRs (no secrets) are
pull-only and cannot poison the cache. ci.yml now passes those secrets.

Part of the Meshtastic KMP library standard alignment (shared build cache,
matching meshtastic-sdk).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jamesarich, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b071f085-a8f4-4312-a29c-c84efb18ee1e

📥 Commits

Reviewing files that changed from the base of the PR and between 6603ae8 and 0598dc6.

📒 Files selected for processing (1)
  • gradle/build-cache.settings.gradle
📝 Walkthrough

Walkthrough

The project adds configurable local and remote Gradle build caching, applies the configuration from the root settings script, and supplies cache credentials through CI workflow environment variables. The workflow also supports merge_group events.

Changes

Gradle build cache

Layer / File(s) Summary
Build cache configuration
gradle/build-cache.settings.gradle, settings.gradle.kts
Configures local and conditional remote HTTP caching, credential handling, cache pushing, and applies the external settings script.
CI cache wiring
.github/workflows/ci.yml
Adds the merge_group trigger and exposes Gradle cache settings from repository secrets.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hops through Gradle’s lane,
Caches bloom from local rain.
Secrets guide the remote door,
Merge groups join the build once more.
Fluffy checks turn green with cheer!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: adding an HTTP Gradle build cache and a merge_group CI trigger.

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.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jamesarich
jamesarich marked this pull request as ready for review July 21, 2026 19:19
@jamesarich jamesarich changed the title ci: add remote HTTP Gradle build cache ci: add HTTP build cache + merge_group trigger Jul 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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/ci.yml:
- Around line 10-13: Move GRADLE_CACHE_URL, GRADLE_CACHE_USERNAME, and
GRADLE_CACHE_PASSWORD from the workflow-level env into the env block of the
“Build & Test” step, ensuring these credentials are unavailable to checkout,
setup, artifact upload, and other steps.
- Line 11: The CI workflow currently sources GRADLE_CACHE_URL from secrets,
preventing fork pull requests from using the remote cache. Update
GRADLE_CACHE_URL in .github/workflows/ci.yml at lines 11-11 to use the
repository variable while keeping cache credentials in secrets;
gradle/build-cache.settings.gradle at lines 39-54 requires no direct change
because it will receive the URL through the corrected workflow configuration.

In `@gradle/build-cache.settings.gradle`:
- Around line 47-48: Remove the unconditional allowInsecureProtocol and
allowUntrustedServer settings from the shared build-cache configuration,
preserving HTTPS/TLS-only behavior by default. If insecure access is required
for local development, gate both settings behind an explicit local-only opt-in
rather than enabling them for shared or CI builds.
- Around line 41-50: Update the cache push condition near the existing
credentials block so credentials alone do not enable writes. Require both
available credentials and a trusted workflow event, allowing pushes only for
push or merge_group executions while keeping pull-only behavior for pull request
runs.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f5daf7f-076c-4262-b8f3-62a0df044884

📥 Commits

Reviewing files that changed from the base of the PR and between 05a7098 and 6603ae8.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • gradle/build-cache.settings.gradle
  • settings.gradle.kts

Comment thread .github/workflows/ci.yml
Comment on lines +10 to +13
env:
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the workflow with line numbers
cat -n .github/workflows/ci.yml | sed -n '1,220p'

Repository: meshtastic/gradle-flatpak-sources

Length of output: 1457


Scope the cache credentials to the Build & Test step only. Workflow-level env makes them available to checkout, setup, artifact upload, and every later step in the job.

🤖 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/ci.yml around lines 10 - 13, Move GRADLE_CACHE_URL,
GRADLE_CACHE_USERNAME, and GRADLE_CACHE_PASSWORD from the workflow-level env
into the env block of the “Build & Test” step, ensuring these credentials are
unavailable to checkout, setup, artifact upload, and other steps.

Comment thread .github/workflows/ci.yml
merge_group:

env:
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

set -euo pipefail

printf '\n== ci.yml ==\n'
cat -n .github/workflows/ci.yml | sed -n '1,220p'

printf '\n== build-cache.settings.gradle ==\n'
cat -n gradle/build-cache.settings.gradle | sed -n '1,220p'

Repository: meshtastic/gradle-flatpak-sources

Length of output: 3878


🏁 Script executed:

set -euo pipefail
cat -n .github/workflows/ci.yml | sed -n '1,220p'
printf '\n---\n'
cat -n gradle/build-cache.settings.gradle | sed -n '1,220p'

Repository: meshtastic/gradle-flatpak-sources

Length of output: 3834


Source GRADLE_CACHE_URL from a repository variable .github/workflows/ci.yml currently reads it from secrets, so fork PRs get no URL and gradle/build-cache.settings.gradle disables the remote cache entirely. Keep the credentials in secrets and the URL in a non-secret variable so forks remain pull-only.

📍 Affects 2 files
  • .github/workflows/ci.yml#L11-L11 (this comment)
  • gradle/build-cache.settings.gradle#L39-L54
🤖 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/ci.yml at line 11, The CI workflow currently sources
GRADLE_CACHE_URL from secrets, preventing fork pull requests from using the
remote cache. Update GRADLE_CACHE_URL in .github/workflows/ci.yml at lines 11-11
to use the repository variable while keeping cache credentials in secrets;
gradle/build-cache.settings.gradle at lines 39-54 requires no direct change
because it will receive the URL through the corrected workflow configuration.

Comment thread gradle/build-cache.settings.gradle Outdated
Comment thread gradle/build-cache.settings.gradle Outdated
Addresses CodeRabbit review of the shared build-cache script:
- Drop allowInsecureProtocol/allowUntrustedServer — the cache server presents
  a valid public TLS cert, so enforce HTTPS + certificate validation.
- Write to the cache only on trusted events (push/merge_group/local) with
  credentials present, so pull_request runs stay pull-only and cannot poison
  the cache.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jamesarich
jamesarich merged commit c3d4c5a into main Jul 21, 2026
3 checks passed
@jamesarich
jamesarich deleted the ci/build-cache branch July 21, 2026 20:29
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.

1 participant