abnobdoss opened a new pull request, #2669:
URL: https://github.com/apache/iceberg-rust/pull/2669
## Which issue does this PR close?
- None. This is a CI maintenance change based on observed GitHub Actions
cache churn.
## What changes are included in this PR?
This changes the existing `swatinem/rust-cache` steps so that they still
restore caches on pull requests, but only save new caches from pushes to `main`.
The issue is that GitHub Actions caches are scoped by ref. A cache saved
from a PR run is stored under a ref like `refs/pull/<id>/merge`, while the
reusable caches for future PRs come from `refs/heads/main`. When PR runs also
upload Rust caches, those PR-scoped caches can consume the repository cache
quota and evict the reusable `main` caches.
During a recent cache audit, the repository cache was dominated by PR-scoped
Rust caches:
| Ref | Cache size |
| --- | ---: |
| `refs/pull/2667/merge` | ~7.9 GiB |
| `refs/pull/2668/merge` | ~6.3 GiB |
| `refs/heads/main` | ~34 KiB |
That meant the retained large Rust caches were tied to individual PR refs,
while `main` had no large reusable Rust cache entries.
This matters because PRs can restore from `main` caches, but not from other
PR refs. When the `main` Rust caches are evicted, PR builds run cold. In the
recent CI audit, the gap between cold and warm Rust build jobs was roughly:
| Job | Cold PR runtime | Warm-cache runtime | Avoidable time |
| --- | ---: | ---: | ---: |
| `CI / build (ubuntu-latest)` | ~8-9 min | ~2.5 min | ~5-6 min |
| `CI / build (macos-latest)` | ~7-11 min | ~2-3 min | ~5-8 min |
| `CI / build (windows-latest)` | ~20-23 min | ~11-15 min | ~7-9 min |
Across recent PR CI volume, keeping the reusable `main` build caches
available was estimated to save roughly 2,000-2,500 GitHub Actions
runner-minutes per week for the `CI / build` matrix alone. Other
Rust-cache-backed jobs may also benefit, but this estimate intentionally only
counts the clearest build-matrix impact.
Concretely, this PR:
- Adds `save-if: ${{ github.event_name == 'push' && github.ref ==
'refs/heads/main' }}` to existing `swatinem/rust-cache` steps.
- Applies the change to the main Rust CI workflow and the public API
workflow.
- Keeps cache restore behavior unchanged for pull requests and other
workflow runs.
Expected effect:
- PRs can still restore reusable `main` caches.
- PR runs no longer upload pull-request-scoped Rust caches.
- The repository should retain the reusable `main` Rust caches more
consistently instead of cycling through large PR-only caches.
## Are these changes tested?
- Not run locally; this is a GitHub Actions workflow-only change.
- The change uses the existing `swatinem/rust-cache` `save-if` option and
does not alter the build, check, or test commands.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]