Skip to content

Clarify caching of npm / Yarn / pnpm dependencies #304

Closed
@borekb

Description

@borekb

I was excited to see the blog post GitHub Actions: Setup-node now supports dependency caching. However, it's not clear to me what this caching actually means. From the README:

README.md

Caching yarn dependencies:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
  with:
    node-version: '14'
    cache: 'yarn'
- run: yarn install
- run: yarn test

Yarn caching handles both yarn versions: 1 or 2.

Caching can mean many things when it comes to Yarn 2, for example, these questions come to mind:

  • Is the node_modules folder cached?
  • When Yarn runs in the PnP mode, is .yarn/cache cached instead?
  • Or is it the local cache of downloaded tarballs (~/.cache/yarn) that is cached?
  • How is the caching done? Is it a local filesystem that is re-attached for future runs of the job or is the "slow" approach of @actions/cache that just uploads / downloads files to some S3-like blob storage? (I think we tested it and it wasn't even faster than downloading dependencies from registry.npmjs.com over and over.)

Some clarifications would be appreciated 🙏.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions