cache icon indicating copy to clipboard operation
cache copied to clipboard

Cache action on Windows doesn't seem to restore to the expected place

Open vsajip opened this issue 2 years ago • 6 comments

On Windows, the cache action doesn't seem to restore files to the locations they come from. This is unexpected.

In the workflow, the intention is to use the cache to cache a file downloaded to ${env:USERPROFILE}\bin.

If you examine the workflow runs, you'll see that the first run (with nothing in the cache) succeeds, but the second run (with something in the cache) fails. The reason appears to be that the location where the cached file is stored isn't used to save and restore the file. The command shown in the Post Cache step appears to show success:

C:\Windows\System32\tar.exe --posix -z -cf cache.tgz -P -C D:/a/action-testbed/action-testbed --files-from manifest.txt
Cache Size: ~0 MB (30 B)
Cache saved successfully
Cache saved with key: Windows-jython

However, the cache size (0 bytes) is a little ominous.

On the failing run, the restore command doesn't restore anything:

Received 30 of 30 (100.0%), 0.0 MBs/sec
Cache Size: ~0 MB (30 B)
C:\Windows\System32\tar.exe -z -xf D:/a/_temp/815c88b3-9fd6-467a-9b41-d246370a5f9a/cache.tgz -P -C D:/a/action-testbed/action-testbed
Cache restored successfully
Cache restored from key: Windows-jython

So it looks as if certain locations, e.g. under ${env:USERPROFILE}, aren't served by the cache, but I couldn't see this documented anywhere. The restoring command is restoring to D:/a/action-testbed/action-testbed which is the location for files in the repository under test.

At the very least, the cache step should fail with a suitably informative error if it doesn't support the path: specified in the step.

vsajip avatar Oct 25 '21 15:10 vsajip

Bump, same issue but weirder. https://github.com/illusion0001/trdrop/runs/4663132721?check_suite_focus=true#step:3:13

 Cache Size: ~391 MB (410412174 B)
C:\Windows\System32\tar.exe -z -xf D:/a/_temp/9f79d597-a9ab-4ab5-8d1b-abed3911434d/cache.tgz -P -C D:/a/trdrop/trdrop
C:/downloads/opencv-4.5.1/build_64/: Can't create '\\\\?\\C:\\downloads\\opencv-4.5.1\\build_64'
C:/downloads/opencv-4.5.1/build_64/3rdparty/: Can't create '\\\\?\\C:\\downloads\\opencv-4.5.1\\build_64\\3rdparty'
C:/downloads/opencv-4.5.1/build_64/apps/: Can't create '\\\\?\\C:\\downloads\\opencv-4.5.1\\build_64\\apps'
C:/downloads/opencv-4.5.1/build_64/bin/: Can't create '\\\\?\\C:\\downloads\\opencv-4.5.1\\build_64\\bin'
C:/downloads/opencv-4.5.1/build_64/CMakeCache.txt: Can't create '\\\\?\\C:\\downloads\\opencv-4.5.1\\build_64\\CMakeCache.txt'

https://github.com/illusion0001/trdrop/actions/runs/1635887343/workflow

    #steps:
      - uses: actions/cache@v2
        id: cache
        with:
          path: |
            C:\downloads\opencv-4.5.1\build_64
            C:\Qt\5.15.2
          key: ${{ runner.os }}-Qt5152-OpenCV451

illusion0001 avatar Dec 30 '21 09:12 illusion0001

Seems to be exclusive to v2, rolling back to v1 made cache work on Windows

illusion0001 avatar Jan 31 '22 04:01 illusion0001

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] avatar Apr 03 '23 08:04 github-actions[bot]

Still needs fixing, so not actually stale IMO

vsajip avatar Apr 03 '23 12:04 vsajip

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] avatar Oct 22 '23 08:10 github-actions[bot]

It still appears to not be working on v3. I get the error

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

where the path (${env:USERPROFILE}/bin/jython.jar) most definitely does exist, see this workflow.

vsajip avatar Oct 23 '23 08:10 vsajip

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] avatar May 11 '24 08:05 github-actions[bot]

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

github-actions[bot] avatar May 17 '24 08:05 github-actions[bot]