run-vcpkg fails when using gnu tar for actions/cache on Windows (for zstd support)
See original GitHub issueactions/cache falls back to tar with gzip if it can’t find gnu tar. This is the default expected behavior on Windows due to the default configuration. However, it is possible to make zstd compressed caches if gnu tar is inserted into $PATH ahead of bsdtar. The recommended workaround is to prepend to path in a step before the actions/cache step. Eg. https://github.com/actions/cache/issues/888
- if: ${{ runner.os == 'Windows' }} # Workaround required when using cache action across operating systems. See https://github.com/actions/cache/issues/591
name: Use GNU tar not BSD tar
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
This works fine with regular actions/cache
Cache Size: ~536 MB (561804504 B)
"C:\Program Files\Git\usr\bin\tar.exe" --use-compress-program "zstd -d" -xf D:/a/_temp/dad43f6a-[26](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:12:27)d7-4781-b681-f7c0a747994a/cache.tzst -P -C D:/a/Cataclysm-DDA/Cataclysm-DDA --force-local
Cache restored successfully
...
Post job cleanup.
"C:\Program Files\Git\usr\bin\tar.exe" --posix --use-compress-program "zstd -T0" -cf cache.tzst --exclude cache.tzst -P -C D:/a/Cataclysm-DDA/Cataclysm-DDA --files-from manifest.txt --force-local
Cache Size: ~536 MB (561930170 B)
Cache saved successfully
Cache saved with key: ccache-master-Windows-msvc--[2](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:42:2)02208260[5](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:42:5)28
But it causes run-vcpkg
to fail on cache creation (in my configuration, at least)
Saving a new cache entry, because primary key was missed or a fallback restore key was hit.
Caching paths: 'D:/a/Cataclysm-DDA/b/vcpkg_cache,D:\a\Cataclysm-DDA\b\vcpkg,!D:\a\Cataclysm-DDA\b\vcpkg\installed,!D:\a\Cataclysm-DDA\b\vcpkg\vcpkg_installed,!D:\a\Cataclysm-DDA\b\vcpkg\packages,!D:\a\Cataclysm-DDA\b\vcpkg\buildtrees,!D:\a\Cataclysm-DDA\b\vcpkg\downloads'
Saving cache with primary key 'runnerOS=win1920220821.1-vcpkgGitCommit=bd1ef2df[4](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:43:4)6303989eeb048eb7aa9b816aa4636[5](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:43:5)e_appendedKey=f28feabd[6](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:43:6)af844c19026d6a94ee11b62bdd22a040[7](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:43:7)09231070ad37a3f[8](https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true#step:43:8)28360d-x64-1' ...
"C:\Program Files\Git\usr\bin\tar.exe" --use-compress-program "zstd -T0" -cf cache.tzst -P -C D:/a/Cataclysm-DDA/Cataclysm-DDA --files-from manifest.txt --force-local
/usr/bin/tar: ..\b\vcpkg_cache: Cannot stat: No such file or directory
/usr/bin/tar: ..\b\vcpkg: Cannot stat: No such file or directory
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Tar failed with error: The process 'C:\Program Files\Git\usr\bin\tar.exe' failed with exit code 2
I tried forking run-vcpkg
and manually upgrading the @actions/cache
dependency to ^3.0.4
but it made no effect on the outcome.
The run-vcpkg
configuration we are using is
- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@main
id: runvcpkg
with:
# run-vcpkg tries to hash vcpkg.json but complans if it finds more than one.
# That said, we also have our custom vcpkg_triplets to hash, so we keep everything the same.
appendedCacheKey: ${{ hashFiles( 'msvc-full-features/vcpkg.json', '.github/vcpkg_triplets/**' ) }}-x64-1
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# We have to use at least this version of vcpkg to include fixes for yasm-tool's
# availability only as an x86 host tool. Keep it in sync with the builtin-baseline
# field in vcpkg.json. Caching happens as a post-action which runs at the end of
# the whole workflow, after vcpkg install happens during msbuild run.
vcpkgGitCommitId: 'bd1ef2df46303989eeb048eb7aa9b816aa46365e'
And here is a sample workflow you can look at which demonstrates the functional and nonfunctional behavior: https://github.com/akrieger/Cataclysm-DDA/runs/8030290576?check_suite_focus=true
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
It’s working great, thanks again!
fixed in https://github.com/lukka/run-vcpkg/releases/tag/v10.4
Let me know!