Skip to content

PNPM Cache does not work properly #1040

@dhorkin

Description

@dhorkin

I have a workflow file that contains these steps:

        -   name: Install pnpm
            uses: pnpm/action-setup@v2
            with:
                version: 8

        -   name: Install Cypress node dependencies
            uses: cypress-io/github-action@v6
            with:
                # just perform install
                runTests: false

        -   name: Run Cypress tests
            uses: cypress-io/github-action@v6
            with:
                spec: |
                    ${{ inputs.spec}}
                # we have already installed all dependencies above
                install: false

The resulting log when I run this action:

Install Cypress node dependencies

Run cypress-io/github-action@v6
  with:
    runTests: false
    record: false
    publish-summary: true
    component: false
  env:
    LANG: en_US.UTF-8
    LANGUAGE: en_US:en
    LC_ALL: en_US.UTF-8
    PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
Received 1296 of 1296 (100.0%), 0.0 MBs/sec
Cache Size: ~0 MB (1296 B)
/usr/bin/tar -xf /runner/_work/_temp/6a12e4a6-f1fb-4cbd-8ce3-459325a65e4b/cache.tzst -P -C /runner/_work/my_repo_name/my_repo_name --use-compress-program unzstd
Cache restored successfully
Received 0 of 335911813 (0.0%), 0.0 MBs/sec
Received 46137344 of 335911813 (13.7%), 22.0 MBs/sec
Received 134217728 of 335911813 (40.0%), 42.1 MBs/sec
Received 213909504 of 335911813 (63.7%), 50.5 MBs/sec
Received 268435456 of 335911813 (79.9%), 50.8 MBs/sec
Received 335911813 of 335911813 (100.0%), 54.5 MBs/sec
Cache Size: ~320 MB (335911813 B)
/usr/bin/tar -xf /runner/_work/_temp/a3c276a3-657e-44f5-87e6-7653ff6c6f6e/cache.tzst -P -C /runner/_work/my_repo_name/my_repo_name--use-compress-program unzstd
Cache restored successfully
/home/runner/setup-pnpm/node_modules/.bin/pnpm install --frozen-lockfile
Lockfile is up to date, resolution step is skipped
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +1407
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1407, reused 0, downloaded 113, added 112
Progress: resolved 1407, reused 0, downloaded 446, added 446
Progress: resolved 1407, reused 0, downloaded 656, added 656
Progress: resolved 1407, reused 0, downloaded 924, added 925
Progress: resolved 1407, reused 0, downloaded 1250, added 1251
Progress: resolved 1407, reused 0, downloaded 1404, added 1406
Progress: resolved 1407, reused 0, downloaded 1405, added 1407, done
...

While it does indicate there is a 320MB cache, the cache actually isn't working. You can see at the end of the log that it is still downloading packages.

Compare this to the result of running rm -rf node_modules && pnpm install --frozen-lockfile on my local machine:

╰─ rm -rf node_modules && pnpm install --frozen-lockfile ─╯
Lockfile is up to date, resolution step is skipped
Packages: +1407
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/username/.local/share/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 1407, reused 1405, downloaded 0, added 1407, done

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions