question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A line ending invariant alternative to hashFiles

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mzabaluevcommented, May 26, 2020

Also consider using a .gitattributes file to control the line endings on windows

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.

0reactions
kriegaexcommented, Aug 1, 2021

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:

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found