Skip to content

Conversation

@romanc
Copy link
Collaborator

@romanc romanc commented Sep 8, 2025

Description

Caching in GHA workflows is currently sub-optimal because we didn't understand the rules of when to create caches that can be reused. GitHub imposes the following rules on cache sharing. Caches can be restored by a workflow if

  1. they were created by a previous run of the workflow
  2. they were created by the target branch of this PR

We currently save and restore caches from PRs, which means we get the cache boost from 1) starting with the second run of a PR. Since we use a merge queue, we never run PR workflows on merge to develop. We thus never profit from the second case. This PR "solves" the issue by having an explicit cache creation workflow that runs when ever we merge into develop. This PR will create caches that can be reused (as intended by 2) above) by any PR targeting the develop branch.

The translate test workflow of this repository is re-used in other repository as a hook. This PR should (if I understand the docs correctly) generate translate test data caches that can be re-used by workflows from other repositories.

How Has This Been Tested?

This is a propagation of PR NOAA-GFDL/NDSL#202 in NDSL, which works as advertised. I'll double check after the first run that this also works as intended in this repository. If not, I'll do follow-up PRs in a timely manner.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation: N/A
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules: N/A
  • New check tests, if applicable, are included: N/A
  • Targeted model if this changed was triggered by a model need/shortcoming: N/A

@romanc romanc requested a review from fmalatino September 8, 2025 08:40
actions/cache takes care of this already (even if we just do the lookup
and don't actually download the cache).
@romanc romanc changed the title ci: effective cache sharing between PRs ci: Effective cache sharing between PRs Sep 8, 2025
@fmalatino fmalatino added this pull request to the merge queue Sep 8, 2025
Merged via the queue into NOAA-GFDL:develop with commit d00d30c Sep 8, 2025
4 checks passed
@romanc romanc deleted the romanc/ci-create-cache-on-main-branch branch September 8, 2025 12:24
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