A line ending invariant alternative to hashFiles
See original GitHub issueDescribe the enhancement Sometimes cached data is sufficiently cross-platform to be reused across runners on Windows and the Unix OSes. A problem arises if the cache key needs to be computed by hash-summing text files, which produces differing hash sums on the same file if it was e.g. checked out by git in text mode applying auto-conversion to the line endings.
This workflow run failed to hit the cache in the Windows test
job, even though the preceding update-deps
job on Linux had stored it.
Code Snippet
It would be nice if a hashTextFiles
function was available that would canonicalize line endings for the hash input:
test:
needs: update-deps
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- id: cargo-registry
name: Restore cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashTextFiles('**/Cargo.lock') }}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
FB TMK PDQ WTF - The Hacker Factor Blog
PDQ and TMK+PDQF were designed to operate at high scale, supporting video-frame-hashing and real-time applications.
Read more >What's the strategy for handling CRLF (carriage return, line ...
For me the best strategy(less problems to solve) is: keep all text files with LF inside git repo even if you are working...
Read more >Specification v1.0-beta – OpenCyphal Development Team
2023-06-03 Specification v1.0-beta. 1 definition = line (end_of_line line)* # An empty file is a valid definition. Trailing end-of-line is ...
Read more >https://release.debian.org/proposed-updates/bookwo...
+ Such new versions will be similar in spirit to the present version, + but may differ in detail to address new ......
Read more >SUSE Linux Enterprise Point of Service Guide
This guide contains instructions on how to install, manage and deploy SUSE® Linux Enterprise Point of Service. Learn which components constitute a SUSE ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure cargo would honor it when writing an updated lock file. More generally, forcing Unix-style endings on a file would inconvenience many developers just so a CI workflow can run correctly, which I think is not a good tradeoff.
A real-world use case for this is caching a local Maven repository, calculating the cache key from
${{ hashFiles('**/pom.xml') }}
, which is a frequent use case in many projects. This yields one set of cache files for Linux and MacOS, but another one one Windows. As was discussed above, using.gitattributes
and influence all users just so as to fix caching on CI is not an adequate solution, way too invasive.See also: