When caching Cypress binary on CI, it is easy to start carrying LOTS of installed binary versions, increasing cache size and time it takes to restore cache on each CI build.
Imagine you start using Cypress v3.5.0 and cache ~/.cache folder like we advise in https://on.cypress.io/caching. Initially, you will have just v3.5.0 there.
Then you upgrade to v3.6.0 in package.json file. The CI build does the following
~/.cache folder with 3.5.0~/.cache has both 3.5.0 and 3.6.0~/.cache folder as new cacheBoom, after a few version upgrades you have lots of old binary versions, making cache size easily pass 1GB
In current Cypress version v3.8.0 we have the following commands related to the binary cache
$ npx cypress cache
Usage: cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
-h, --help output usage information
I propose we add one more command cypress cache prune that removes all versions from the binary cache folder but the current one. Then one could run this command on CI like this
Real-world example was in https://github.com/cypress-io/cypress-example-kitchensink/pull/335 where GitHub Action could not cache the binary folder with 2 versions of Cypress while trying to test new version via RenovateBot update
Would love to see this command added! Cypress cache is over 2GB now, installing every update since 3.5.0.
+1
The code for this is done in cypress-io/cypress#8766, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 5.4.0.
This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.4.0, please open a new issue.
Most helpful comment
Would love to see this command added! Cypress cache is over 2GB now, installing every update since 3.5.0.