You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the cypress-io/github-action processes a project with a pnpm-lock.yaml lockfile from the pnmp package manager it should cache dependencies from the pnpm store. The location of the store can be found from the command pnpm store path.
Why is this needed?
The cypress-io/github-action caches dependencies from npm and from Yarn Classic for other project types (see Installation for lockfile names). Not providing this functionality for pnpm projects is inconsistent.
The benefit for users of pnpm projects with larger volumes of dependencies lies in shorter run times for workflows, providing results faster. Additionally all GitHub plans have either limits on the number of action minutes used or a cost associated with action minutes, so reducing run times is also beneficial to keep inside limits or to reduce costs. (See About Billing for GitHub Actions).
## Other
As a workaround PR test: add npm caching to pnpm examples #1043 is proposed which manually adds caching into the workflow since it is not available in the action itself. Edit: This is now available as an example.
Edit: Workaround removed.
See the README > pnpm section for current recommendations.
The noted workaround here isn't suggested anymore, and actually the current recommendation in the README is not to cache at all for pnpm. That sucks. I want to switch to pnpm for improved CI performance, but this limitation nukes most of that benefit.
Sorry that the workaround was left in this issue! I have commented it out now.
I suggest you benchmark your original configuration and then measure the timing after you convert to pnpm. I would not assume anything about the benefits of caching without trying it out first. Some actions can even be slower if GitHub provided caches are used.
If you decide you must have caching for pnpm then an alternative may be to set up a workflow which does not use this action (cypress-io/github-action). You can find an example of a similar workflow on https://github.com/cypress-io/cypress-example-kitchensink/blob/master/.github/workflows/single.yml for npm. This is however out-of-scope for this repo and if you want to discuss this further, then you may find there are other Cypress users in the Cypress technical community on Discord with similar interests. (click on button)
Thanks Mike. pnpm install without a cache takes about a minute. With a cache takes about half that.
I'm paying for Cypress.io, and want to use parallel test support, so I don't think setting up custom Cypress workflows is practical.
BTW, I was considering using yarn zero installs as an alternative to that, but Cypress also doesn't support yarn pnp properly, so that's not an option.
If you are a paying customer of Cypress Cloud you can also use the https://www.cypress.io/support channel to express your needs for better pnpm support. I'm simply an external contributor, so my insight into Cypress' plans is limited to what is published publicly.
BTW, I was considering using yarn zero installs as an alternative to that, but Cypress also doesn't support yarn pnp properly, so that's not an option.
There is an E2E example of Cypress with Yarn Modern PnP in this repo. Cypress has problems with Component Testing together with Yarn Modern PnP and I have a couple of issues open on this subject.
@jennifer-shehane that just installs pnpm and optionally runs pnpm install. AFAICT, it does zero caching. Even if it did, it would certainly still have the same issue that results in the suggestion not to use caching at all.
The intention of this enhancement request (Add dependency caching to pnpm #1044) is to provide built-in support for pnpm caching in the cypress-io/github-action. The recent discussion is however about doing this in a workflow.
Activity
bmulholland commentedon Jul 25, 2024
The noted workaround here isn't suggested anymore, and actually the current recommendation in the README is not to cache at all for pnpm. That sucks. I want to switch to pnpm for improved CI performance, but this limitation nukes most of that benefit.
bmulholland commentedon Jul 25, 2024
Is there no other workaround in the meantime? CI pnpm caching just isn't possible with cypress?
MikeMcC399 commentedon Jul 26, 2024
@bmulholland
Sorry that the workaround was left in this issue! I have commented it out now.
I suggest you benchmark your original configuration and then measure the timing after you convert to pnpm. I would not assume anything about the benefits of caching without trying it out first. Some actions can even be slower if GitHub provided caches are used.
If you decide you must have caching for pnpm then an alternative may be to set up a workflow which does not use this action (
(click on button)
cypress-io/github-action). You can find an example of a similar workflow on https://github.com/cypress-io/cypress-example-kitchensink/blob/master/.github/workflows/single.yml for npm. This is however out-of-scope for this repo and if you want to discuss this further, then you may find there are other Cypress users in the Cypress technical community on Discord with similar interests.bmulholland commentedon Jul 26, 2024
Thanks Mike. pnpm install without a cache takes about a minute. With a cache takes about half that.
I'm paying for Cypress.io, and want to use parallel test support, so I don't think setting up custom Cypress workflows is practical.
BTW, I was considering using yarn zero installs as an alternative to that, but Cypress also doesn't support yarn pnp properly, so that's not an option.
bmulholland commentedon Jul 26, 2024
FWIW, the recommendation not to cache anything is opposite to what cypress.io recommends: https://docs.cypress.io/guides/continuous-integration/introduction#Caching
MikeMcC399 commentedon Jul 26, 2024
@bmulholland
Good to have the measurements!
There is also a parallel recording example in the same repo https://github.com/cypress-io/cypress-example-kitchensink/blob/master/.github/workflows/parallel.yml which could be adapted to pnpm.
If you are a paying customer of Cypress Cloud you can also use the https://www.cypress.io/support channel to express your needs for better pnpm support. I'm simply an external contributor, so my insight into Cypress' plans is limited to what is published publicly.
There is an E2E example of Cypress with Yarn Modern PnP in this repo. Cypress has problems with Component Testing together with Yarn Modern PnP and I have a couple of issues open on this subject.
jennifer-shehane commentedon Jul 26, 2024
@MikeMcC399 What about recommending the use of this action with our GHA, where we aren't responsible for this: https://github.com/pnpm/action-setup
I just ran across it so didn't extensively look at it.
bmulholland commentedon Jul 29, 2024
@jennifer-shehane that just installs pnpm and optionally runs pnpm install. AFAICT, it does zero caching. Even if it did, it would certainly still have the same issue that results in the suggestion not to use caching at all.
MikeMcC399 commentedon Jul 29, 2024
@bmulholland / @jennifer-shehane
The intention of this enhancement request (Add dependency caching to pnpm #1044) is to provide built-in support for pnpm caching in the
cypress-io/github-action. The recent discussion is however about doing this in a workflow.I've opened a new enhancement request Provide pnpm workflow caching without action enhancement #1227 to track and work on providing a recommendation for pnpm caching in workflows. Edit: completed.
MikeMcC399 commentedon Feb 17, 2025
MikeMcC399 commentedon Feb 17, 2025
I have now learned that the project
.npmrcfor pnpm with Cypress needs to include:See https://pnpm.io/npmrc#side-effects-cache
Edit: This is now added to the documentation and example
MikeMcC399 commentedon Feb 24, 2025
feat: remove cypress install v2
feat: remove cypress install v2 (#664)