Skip to content

Conversation

@rjarry
Copy link
Collaborator

@rjarry rjarry commented Nov 4, 2025

Pull request builds were creating their own ccache entries in GitHub's cache storage, leading to cache bloat and potentially filling the cache quota with ephemeral data from feature branches that will never be reused.

Use actions/cache/restore (read-only) for pull request workflows to restore the main branch cache without saving new entries. Only main branch builds use actions/cache (read-write) to update the canonical cache that all subsequent builds can benefit from.

This ensures pull requests still get the performance benefit of the cached main branch build artifacts while preventing them from polluting the cache with their own entries that would only be useful if the exact same PR builds again with the same git ref.

Additionally, remove the overly broad fallback restore-keys that would match any ref. The main branch cache is sufficient for warming the cache. Also switch from ccache -sv to ccache -z to reset statistics at the start of each build for clearer per-build metrics.

Summary by CodeRabbit

  • Chores
    • Improved build pipeline efficiency by optimizing cache management for different build contexts, ensuring faster and more reliable builds across all architectures and scenarios.

Pull request builds were creating their own ccache entries in GitHub's
cache storage, leading to cache bloat and potentially filling the cache
quota with ephemeral data from feature branches that will never be
reused.

Use actions/cache/restore (read-only) for pull request workflows to
restore the main branch cache without saving new entries. Only main
branch builds use actions/cache (read-write) to update the canonical
cache that all subsequent builds can benefit from.

This ensures pull requests still get the performance benefit of the
cached main branch build artifacts while preventing them from polluting
the cache with their own entries that would only be useful if the exact
same PR builds again with the same git ref.

Additionally, remove the overly broad fallback restore-keys that would
match any ref. The main branch cache is sufficient for warming the
cache. Also switch from ccache -sv to ccache -z to reset statistics at
the start of each build for clearer per-build metrics.

Signed-off-by: Robin Jarry <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

📝 Walkthrough

Walkthrough

The changes implement PR-aware caching logic in GitHub Actions workflows. Both check.yml and package.yml are updated to split ccache handling between pull request and non-pull request events. For non-PR events, cache is saved with conditional guards. For PR events, cache is restored using matching conditional steps. Cache key composition reflects the event context using github.ref. In check.yml, ccache -sv is replaced with ccache -z. These modifications ensure appropriate cache behavior depending on workflow trigger type across deb and rpm build jobs.

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: preventing PRs from saving ccache, which aligns with the PR objectives and file changes.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11b148f and f192347.

📒 Files selected for processing (2)
  • .github/workflows/check.yml (2 hunks)
  • .github/workflows/package.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-and-tests (clang-18, none, debugoptimized, ubuntu-24.04, false)
  • GitHub Check: build-and-tests (clang-16, none, debugoptimized, ubuntu-24.04, false)
  • GitHub Check: build-and-tests (clang-15, none, debugoptimized, ubuntu-22.04, false)
  • GitHub Check: build-and-tests (gcc-14, address, debug, ubuntu-24.04, -Dfrr=enabled, true)
  • GitHub Check: build-and-tests (gcc-13, none, debugoptimized, ubuntu-24.04, -Dfrr=enabled, false)
  • GitHub Check: build-cross-aarch64
  • GitHub Check: deb
  • GitHub Check: rpm
🔇 Additional comments (6)
.github/workflows/check.yml (3)

97-110: Correct PR-aware cache split for x86_64 builds.

The conditions properly differentiate: non-PR workflows get read-write cache (lines 97–103), while PR workflows get read-only restore (lines 104–110). Restore-keys fallback to main branch only, which prevents cache bloat from ephemeral PR entries and aligns with PR objectives.


111-111: Good placement of ccache -z to reset statistics.

Resetting stats at the start (line 111) provides clean per-build metrics, with the existing ccache -sv output at line 116 capturing the results.


144-157: Correct PR-aware cache split for aarch64 builds.

Same pattern as x86_64: non-PR writes (lines 144–150), PR restores read-only (lines 151–157). Consistent key structure and main-branch fallback.

.github/workflows/package.yml (3)

42-55: Correct PR-aware cache split for deb job.

Non-PR writes (lines 42–48), PR restores read-only (lines 49–55). Build-specific key prefix (ccache-x86_64-deb-) ensures separate cache tracks between deb and rpm builds.


56-56: Good placement of ccache -z for statistics reset.

Aligns with check.yml pattern—reset before build (line 56), report after (line 66).


100-113: Correct PR-aware cache split for rpm job.

Non-PR writes (lines 100–106), PR restores read-only (lines 107–113). Consistent with deb job and check.yml workflows.


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.

@christophefontaine christophefontaine merged commit 75ba8ab into DPDK:main Nov 5, 2025
13 checks passed
@rjarry rjarry deleted the github-ccache branch November 5, 2025 11:20
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