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

Cache additional paths #638

Closed
axelboc opened this issue Dec 5, 2022 · 1 comment
Closed

Cache additional paths #638

axelboc opened this issue Dec 5, 2022 · 1 comment
Labels
feature request New feature or request to improve the current logic

Comments

@axelboc
Copy link

axelboc commented Dec 5, 2022

Description:

I'd like to be able to pass more paths to actions/cache in addition to the package manager's store directory. Something like this:

- uses: actions/setup-node@v3
  with:
    node-version-file: 'package.json'
    cache: 'pnpm'
    other-cache-paths: |
      ~/.cache/Cypress

Justification:

I use Cypress for E2E testing and pnpm for managing dependencies. In the CI, I use actions/setup-node with cache: 'pnpm', but when the CI runs pnpm install, the Cypress binary ends up in ~/.cache/Cypress, which is outside of the pnpm store directory, so it doesn't get cached. I'd like to be able to cache this additional path without having to add a separate actions/cache job or moving the Cypress cache folder.

Indeed, if I add a separate job, I end up with a separate cache key even though the two caches depend on the same file, pnpm-lock.yaml. This means that I then have to be very careful to always call the two jobs together in every CI job. If I don't, I can end up with one cache but not the other (when one job succeeds but not the other), which is bad: if the pnpm store is cached but not the Cypress binaries, pnpm install doesn't run the post-install scripts, the Cypress binaries don't get downloaded, and my Cypress tests fail.

Changing the Cypress cache folder, for instance to put it inside the pnpm store directory, is not ideal either, as it's done via an env var which has to be declared when both installing and running Cypress. And again, I have to remember to set the env var in every job, which adds complexity to my CI workflows.

Alternatively, instead of having a dedicated key for specifying additional cache paths, perhaps it would be worth introducing a more general way to extend the underlying actions/cache configuration. 🤷

@dmitry-shibanov
Copy link
Contributor

Hello @axelboc. Thank you for your feature request. We're not planing to implement extra field to provide caching paths. According to ADR the cache logic should cover basic use cases. If you need more flexible customization you should use actions/cache.

For now I'm going to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

2 participants