pnpm / action-setup

Install pnpm package manager
https://github.com/marketplace/actions/setup-pnpm
MIT License
899 stars 87 forks source link

Node.js caching like `actions/setup-node` #70

Open privatenumber opened 1 year ago

privatenumber commented 1 year ago

Request

When downloading the Node.js version specified in .npmrc#use-node-version, cache the Node.js like actions/setup-node so it can be setup faster next time

Motivation

I would like to migrate from using a .nvmrc file to specify the development Node.js version, to using pnpm's use-node-version.

Currently on GitHub actions, I can configure actions/setup-node to read from .nvmrc, and it will download & cache the Node.js version so it only takes about 3s to setup.

However, when I move to using pnpm with this action, it doesn't seem to cache the downloaded Node.js and it adds about 8s to the pnpm setup:

Before

Running pnpm recursive install...
  Lockfile is up to date, resolution step is skipped
  Progress: resolved 1, reused 0, downloaded 0, added 0
  .                                        | +386 ++++++++++++++++++++++++++++++++
  Packages are hard linked from the content-addressable store to the virtual store.
    Content-addressable store is at: /home/runner/.local/share/pnpm/store/v3
    Virtual store is at:             node_modules/.pnpm
  Progress: resolved 386, reused 0, downloaded 49, added 45
  Progress: resolved 386, reused 0, downloaded 147, added 144
  Progress: resolved 386, reused 0, downloaded [24](https://github.com/privatenumber/resolve-pkg-maps/actions/runs/3667467601/jobs/6199946930#step:4:26)7, added 243
  Progress: resolved 386, reused 0, downloaded 379, added 378
  Progress: resolved 386, reused 0, downloaded 386, added 386, done
  .../esbuild@0.15.18/node_modules/esbuild postinstall$ node install.js
  .../esbuild@0.15.18/node_modules/esbuild postinstall: Done
  Done in 6.7s

After

Running pnpm recursive install...
  Fetching Node.js 16.15.1 ...
  Packages are hard linked from the content-addressable store to the virtual store.
    Content-addressable store is at: /home/runner/.local/share/pnpm/store/v3
    Virtual store is at:             node_modules/.pnpm
  Lockfile is up to date, resolution step is skipped
  Progress: resolved 1, reused 0, downloaded 0, added 0
  .                                        | +386 ++++++++++++++++++++++++++++++++
  Progress: resolved 386, reused 0, downloaded 28, added [23](https://github.com/privatenumber/resolve-pkg-maps/actions/runs/3667468515/jobs/6199947937#step:3:25)
  Progress: resolved 386, reused 0, downloaded 86, added 80
  Progress: resolved 386, reused 0, downloaded 159, added 151
  Progress: resolved 386, reused 0, downloaded 229, added 222
  Progress: resolved 386, reused 0, downloaded [27](https://github.com/privatenumber/resolve-pkg-maps/actions/runs/3667468515/jobs/6199947937#step:3:29)9, added 273
  Progress: resolved 386, reused 0, downloaded [34](https://github.com/privatenumber/resolve-pkg-maps/actions/runs/3667468515/jobs/6199947937#step:3:36)6, added 344
  Progress: resolved 386, reused 0, downloaded 384, added 384
  Progress: resolved 386, reused 0, downloaded 386, added 386, done
  .../esbuild@0.15.18/node_modules/esbuild postinstall$ node install.js
  .../esbuild@0.15.18/node_modules/esbuild postinstall: Done
  Done in 14.5s