cypress-io / cypress-example-kitchensink

This is an example app used to showcase Cypress.io testing.

Home Page:https://example.cypress.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parallel workflow fails

MikeMcC399 opened this issue · comments

.github/workflows/parallel.yml is failing.

"The cypress npm package is installed, but the Cypress binary is missing."

See actions/workflows/parallel.yml

  • 4728528638 was successful (chore(deps): update cypress to 12.10.0) in the renovate/cypress branch.

  • 4733087948 failed #640 on merge into the master branch.

Run npm start &

> cypress-example-kitchensink@0.0.0-development start
> node ./scripts/start.js

Running "serve --listen 8080 --no-request-logging --no-clipboard"...
The cypress npm package is installed, but the Cypress binary is missing.

We expected the binary to be installed here: /home/runner/.cache/Cypress/12.10.0/Cypress/Cypress

Reasons it may be missing:

- You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /home/runner/.cache/Cypress

Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.

Alternatively, you can run 'cypress install' to download the binary again.

https://on.cypress.io/not-installed-ci-error

----------

Platform: linux-x64 (Ubuntu - 22.04)
Cypress Version: 12.10.0
 INFO  Accepting connections at http://localhost:8080
Error: Process completed with exit code 1.

Analysis

  • #640 auto-generated by renovate updated to Cypress 12.10.0 by changing package-lock.json only. There was no change made to package.json which uses semantic versioning

"cypress": "^12.1.0",

The workflow is keying the cache on package.json. This is incorrect, because dependencies are being installed with npm ci, not npm install:

# we use the exact restore key to avoid Cypress binary snowballing
# https://glebbahmutov.com/blog/do-not-let-cypress-cache-snowball/
- name: Cache Cypress binary
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package.json') }}

Immediate Suggestions

  1. Install Cypress as an exact version. This works better with renovate. It will also cause package.json to be updated, thus ensuring a cache renewal by .github/workflows/parallel.yml
  2. Modify .github/workflows/parallel.yml to key the caching of Cypress against package-lock.json instead of package.json.

Further Suggesstions

I suggest also as an enhancement to migrate:

to use https://github.com/cypress-io/github-action.

Users should not have to worry about caching when this issue is already solved by the JavaScript action https://github.com/cypress-io/github-action. The existing parallel.yml and single.yml examples are complex. Users would benefit from being presented with simpler examples that they can build upon.

  • PR #646 provides a workaround for this issue

@mjhenkes

Thanks for pushing my fixes through 👍🏻

All is now good 🙂 !!

image