actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.37k stars 1.16k forks source link

Cache of pnpm node_modules does not work properly on windows-latest, but works on ubuntu-latest and macos-latest #1251

Closed kinland closed 2 months ago

kinland commented 9 months ago

I'm working on a fork of pnpm/action-setup that has built-in caching. It works fine on ubuntu-latest and macos-latest, but it fails on windows-latest

Best as I can tell, actions/cache is not handling Windows junctions properly, but I'm not really sure from looking at the logs.

Here are a few links to jobs in a run that are relevant:

  1. Test empty cache with run_install (empty-object, ubuntu-latest)
  2. Test offline cache with run_install (empty-object, ubuntu-latest)
  3. Test empty cache with run_install (empty-object, windows-latest)
  4. Test offline cache with run_install (empty-object, windows-latest)

The first two jobs work fine. The macos-latest version similarly works fine. Of particular note, in #1 above, in Post Run the action job:

/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/pnpm-action-setup/pnpm-action-setup --files-from manifest.txt --use-compress-program zstdmt Cache Size: ~30 MB (31267968 B)

But in #3:

"C:\Program Files\Git\usr\bin\tar.exe" --posix -cf cache.tzst --exclude cache.tzst -P -C D:/a/pnpm-action-setup/pnpm-action-setup --files-from manifest.txt --force-local --use-compress-program "zstd -T0" Cache Size: ~3 MB (3493661 B)

Despite installing the same npm packages, the Windows install cache is apparently only 10% of the size... so it's no surprise that job #4 fails; it restores the 3MB cache and then fails installing the first package:

ERR_PNPM_NO_OFFLINE_TARBALL  A package is missing from the store but cannot download it in offline mode. The missing package may be downloaded from https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz.

The workflow being tested is this one: https://github.com/kinland/pnpm-action-setup/blob/feature/add-cache/action.yml And the test workflow that calls the above workflow is this one: https://github.com/kinland/pnpm-action-setup/blob/feature/add-cache/.github/workflows/test.yaml

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 5 days since being marked as stale.