Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to cleanup caches #838

Closed
wants to merge 1 commit into from

Conversation

BSFishy
Copy link
Contributor

@BSFishy BSFishy commented Jun 20, 2023

Description

Adds a workflow that cleans up old caches when a PR is merged. Follows the example in these docs: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries

Issues Resolved

Closes #211

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • All tests pass
    • yarn lint
    • yarn test-unit
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Matt Provost <provomat@amazon.com>
@AMoo-Miki
Copy link
Collaborator

If we are not using the cache, let's just stop caching by removing it from here.

@BSFishy
Copy link
Contributor Author

BSFishy commented Jun 20, 2023

If we are not using the cache, let's just stop caching by removing it from here.

We're using the cache. Basically it looks like this:

PR raised
 |
 V
Build and test workflow started
 |
 V
Cache doesn't exist, run a new `yarn install`
 |
 V
Build and test with packages
 |
 V
Cache packages

Then, when a change is made in the PR:

Change is made
 |
 V
Build and test workflow started
 |
 V
Cache is found, use cached packages (theoretically faster than installing from scratch)
 |
 V
Build and test with packages

At no point do we actually remove these caches, so they're left as zombies after the PR is closed. This PR adds a workflow that will delete those zombie caches, saving space for caches for new PRs or for long-standing branches like main or 1.x.

@AMoo-Miki
Copy link
Collaborator

AMoo-Miki commented Jun 20, 2023

The caches expire after 7 days of inactivity. Us deleting the cache after a PR is merged would just make it unavailable to the next run. So the cache that was created in one PR which could have benefited another PR is removed after the first one is merged; the second one does not benefit.

I think we should just let GH handle the TTL of the caches: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy

@BSFishy
Copy link
Contributor Author

BSFishy commented Jun 22, 2023

We'll leave it up to Github then :)

@BSFishy BSFishy closed this Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-delete old caches
2 participants