github-action
github-action copied to clipboard
Cypress does not pick up Node version set by Action
Issue: Cypress does not pick up the NodeJS version set by another GH Action
Versions: Cypress 9.x
Steps to reproduce:
- Configure a GH Actions pipeline as follows: (a) set up a NodeJS version other than
12
(which is used by default in the Cypress GH Action) and (b) execute any Cypress test. - Notice the NodeJS version that Cypress uses.
Prerequisites: (a) a GH repo and (b) a GH workflow yml
config.
Conclusions: Regardless of the NodeJS version set by actions/setup-node@v2
Cypress still uses the default 12
. This is working as expected with Cypress 8.x.
Example: https://github.com/sergiubcn/cy-ci-node/runs/4467813743?check_suite_focus=true https://github.com/sergiubcn/cy-ci-node/blob/master/.github/workflows/cicd.yml
Note: This does not reproduce locally if setting various NodeJS versions via nvm use
.
If it actually turns out to be an issue with Cypress I'll gladly move this ticket to that repo.
Thanks for reporting @sergiubcn - just like to add we're seeing exactly the same behaviour in our workflows.
Is that fixed now? I am seeing the same issue when I update cypress to 9.*
Cypress 9.2.0
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
- run: node -v
- name: Cypress run
uses: cypress-io/github-action@v2
There's another issue filed for this, with a proposed (temporary) workaround: https://github.com/cypress-io/github-action/issues/489#issuecomment-1021379037
@sergiubcn
This is an old issue and I wanted to give you some feedback that what you describe is the correct way that github-action works. It is the consequence of using Cypress Module API introduced in github-action@v2
. Calling Cypress this way allows Cypress to return detailed results to github-action
. It does however tie Cypress to using the version of Node.js which is defined in action.yml. For github-action@v5
this is currently Node.js 16.16.0
. GitHub currently only offers the node16
environment for the runs.using option of GitHub JavaScript Actions.
It is now documented in the README > Node.js section.
I suggest to now close this issue as as far as I can see there is nothing which should be corrected in github-action
regarding this topic.
Thanks for the explanation @MikeMcC399 ! It is a bit counterintuitive, but it definitely helps that it's documented. I'm closing this issue because it's not blocking me in any way, but if other participants feel this is unsatisfactory for their situation they can reopen it.