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

feat: add support for pnpm (install and cache deps) #586

Merged
merged 3 commits into from Jul 27, 2022
Merged

feat: add support for pnpm (install and cache deps) #586

merged 3 commits into from Jul 27, 2022

Conversation

Kocal
Copy link
Contributor

@Kocal Kocal commented Jul 25, 2022

Close #145

Comment on lines +139 to 143
} else if (usePnpm()) {
o.inputPath = NPM_CACHE_FOLDER
} else {
o.inputPath = NPM_CACHE_FOLDER
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be redundant with the else branch, but I prefer to be explicit here.

@Kocal Kocal mentioned this pull request Jul 25, 2022
@Kocal
Copy link
Contributor Author

Kocal commented Jul 26, 2022

Friendly ping @admah 🙏

@admah
Copy link
Contributor

admah commented Jul 26, 2022

@Kocal thank you for submitting this. I will be taking a look at it tomorrow.

@Kocal
Copy link
Contributor Author

Kocal commented Jul 27, 2022

Thanks a lot :)

Copy link
Contributor

@admah admah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. Looks great!

@admah admah merged commit 30008f1 into cypress-io:master Jul 27, 2022
@github-actions
Copy link

🎉 This PR is included in version 4.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Kocal
Copy link
Contributor Author

Kocal commented Jul 27, 2022

Thanks you for merging :)

@fubhy
Copy link

fubhy commented Jul 28, 2022

Thanks for this PR!

Just a quick heads up that this doesn't work in pnpm backend monorepos where Cypress is run from a subdirectory (so when specifying working-directory because it still looks for package-lock.json in that subdirectory. So you are still required to do the installation in a seperate step.

In general I'm somewhat surprised that and have a feeling that this github action is trying to do to much in one. Installing npm/pnpm/yarn packages and caching them is a well-solved problem. In case of pnpm for instance caching the store is actually preferable (instead of caching the node modules directory). So I'm wondering if it would maybe be better to simply remove all that stuff from this github action altogether and leave that to the use and only be concerned with actually running cypress.

@Kocal
Copy link
Contributor Author

Kocal commented Jul 28, 2022

Yeah I also agree with you.

I think all the install/caching dependencies things were here because it was painful/verbose-for-nothing, at the beginning of GitHub Actions, exemple:

- name: Setup node
   uses: actions/setup-node@v1
   with:
     node-version: 10

- name: Get npm cache directory
  id: npm-cache-dir
  run: |
    echo "::set-output name=dir::$(npm config get cache)"

- uses: actions/cache@v3
  id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
  with:
    path: ${{ steps.npm-cache-dir.outputs.dir }}
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

- run: npm install

But since https://github.com/actions/setup-node/releases/tag/v2.2.0, you can simply use the cache input

 - name: Setup node
   uses: actions/setup-node@v3
   with:
    node-version: '14'
    cache: 'npm'
- run: npm install

So I'm wondering if it would maybe be better to simply remove all that stuff from this github action altogether and leave that to the use and only be concerned with actually running cypress.

IMO this action should only:

  • run cypress verify and/or cypress install if needed,
  • run cypress run

and that's all.

But that's another issue I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails if using pnpm
3 participants