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

PNPM cache issue #633

Closed
grahamsmallenroly opened this issue Nov 9, 2022 · 7 comments
Closed

PNPM cache issue #633

grahamsmallenroly opened this issue Nov 9, 2022 · 7 comments

Comments

@grahamsmallenroly
Copy link

grahamsmallenroly commented Nov 9, 2022

Hi

We are using github-action 4.20 with PNPM. We get the following caching error on subsequent runs (once the cache has been created).

Run cypress-io/github-action@v4
with:
install: false
working-directory: typescript/frontend/student
config: baseUrl=....
wait-on-timeout: 120
spec: cypress/e2e/full-regression/cas-checklist/history/**/*

record: false
component: false

env:
CI: false
NODE_OPTIONS: --max-old-space-size=16384
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
Skipping install because install parameter is false
Error: The cypress npm package is installed, but the Cypress binary is missing.

We expected the binary to be installed here: /home/runner/.cache/Cypress/10.9.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 - 20.04)
Cypress Version: 10.9.0
at /home/runner/work/cas-shield/cas-shield/node_modules/.pnpm/cypress@10.9.0/node_modules/cypress/lib/errors.js:348:17 {
known: true
}
Error: The cypress npm package is installed, but the Cypress binary is missing.

We expected the binary to be installed here: /home/runner/.cache/Cypress/10.9.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 - 20.04)
Cypress Version: 10.9.0

@thmsobrmlr
Copy link

@grahamsmallenroly Did you make any progress on this? We're running into the same issue.

@grahamsmallenroly
Copy link
Author

Hey. I no longer have this issue. We are using the following template

  - name: Cypress run history
    uses: cypress-io/github-action@v4
    with:
      install: false
      working-directory: [...]
      config: baseUrl=[...]
      wait-on-timeout: 120
      spec: |
        cypress/e2e/full-regression/[...]
    env:
      CYPRESS_RECORD_KEY: [...]
      GITHUB_TOKEN: [...]

@RobbieTheWagner
Copy link

So what was the fix here? I can never seem to get the binary

@MikeMcC399
Copy link
Collaborator

@RobbieTheWagner

So what was the fix here? I can never seem to get the binary

There is a working example shown in the README. If that doesn't help, then you can open a new issue.

@RobbieTheWagner
Copy link

The README example does not work. I need to cypress install every time, which is fine I guess.

@MikeMcC399
Copy link
Collaborator

@RobbieTheWagner

The README example does not work. I need to cypress install every time, which is fine I guess.

That is not supposed to be the way it works and the example does work correctly here in this repository. If you could open a new issue and post a link to your workflow I can take a look. It may be a caching issue.

@MikeMcC399
Copy link
Collaborator

In the example from https://github.com/cypress-io/github-action/blob/master/README.md#pnpm for this monorepo, the references to the directory examples/basic-pnpm need to be removed if the workflow is copied elsewhere, otherwise the caching will not work:

name: pnpm-workflow
on: push
jobs:
  basic-pnpm:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Install pnpm
        run: npm install -g pnpm@8
      - name: Get pnpm store directory
        shell: bash
        run: |
          echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
      - name: Setup pnpm cache
        uses: actions/cache@v4
        with:
          path: ${{ env.STORE_PATH }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-pnpm-store-
      - name: Cypress run
        uses: cypress-io/github-action@v6

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

No branches or pull requests

4 participants