github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Cypress does not pick up Node version set by Action

Open sergiubcn opened this issue 3 years ago • 4 comments

Issue: Cypress does not pick up the NodeJS version set by another GH Action

Versions: Cypress 9.x

Steps to reproduce:

  1. 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.
  2. 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.

sergiubcn avatar Dec 09 '21 08:12 sergiubcn

Thanks for reporting @sergiubcn - just like to add we're seeing exactly the same behaviour in our workflows.

magnetikonline avatar Dec 15 '21 02:12 magnetikonline

Is that fixed now? I am seeing the same issue when I update cypress to 9.*

BioCarmen avatar Dec 16 '21 18:12 BioCarmen

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

image

unickq avatar Jan 07 '22 13:01 unickq

There's another issue filed for this, with a proposed (temporary) workaround: https://github.com/cypress-io/github-action/issues/489#issuecomment-1021379037

rbayliss avatar Jan 31 '22 19:01 rbayliss

@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.

MikeMcC399 avatar Jul 14 '23 05:07 MikeMcC399

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.

sergiubcn avatar Jul 14 '23 06:07 sergiubcn