Git Product home page Git Product logo

cache-action's Issues

Post run action takes too much time occasionally

Some runs of post run action for coursier/cache-action@v6 take minutes to finish. The behavior is flipping, other runs are done under one second. We're using proprietary runners.

Screenshot 2024-03-05 at 16 51 37

Could you please guess what might be the cause of this slow step?

Get cache entry failed error

We have started to get this error:
Screen Shot 2020-10-26 at 9 37 17 AM

I am not sure what the source of it, but perhaps you can help us to troubleshoot.

sbt-ivy2-cache cache not found after upgrading to v4

It looks that after upgrading from coursier/cache-action@v3 to v4 there is some problem that makes cache restore failure.

With v4 lot of dependencies are always downloaded and sbt-ivy2-cache cache not found error is produced
coursier/cache-action@v4 output:

Run coursier/cache-action@v4
/bin/uname -s
Linux

Received 60583331 of 60583331 (100.0%), 122.4 MBs/sec
Cache Size: ~58 MB (60583331 B)
/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/1e9e417e-d565-433d-8aad-b175b1c3e3eb/cache.tzst -P -C /home/runner/work/project/project
coursier cache restored from key Linux-coursier-4de5856a70311a16d18c97754ced62ce52e589c7

sbt-ivy2-cache cache not found

...
[sbt logs shows here lot of dependecies downloads]
...

Post Run coursier/cache-action@v4

Post job cleanup.
Cache hit occurred on key Linux-coursier-4de5856a70311a16d18c97754ced62ce52e589c7, not saving coursier cache.

With v3 everything seems to work as expected
coursier/cache-action@v3 output:

Run coursier/cache-action@v3
/bin/uname -s
Linux

Received 60583331 of 60583331 (100.0%), 112.2 MBs/sec
Cache Size: ~58 MB (60583331 B)
/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/7fe01672-eac7-493a-8d58-cebd8850d80a/cache.tzst -P -C /home/runner/work/project/project
coursier cache restored from key Linux-coursier-4de5856a70311a16d18c97754ced62ce52e589c7

Received 54312530 of 54312530 (100.0%), 105.9 MBs/sec 
Cache Size: ~52 MB (54312530 B)
/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/e6d4c9de-0e6b-49e1-b4d3-7d26ab113c71/cache.tzst -P -C /home/runner/work/project/project
sbt cache restored from key Linux-sbt-4de5856a70311a16d18c97754ced62ce52e589c7

...
[sbt logs shows here no dependecies downloads]
...

Post Run coursier/cache-action@v3

Cache hit occurred on key Linux-sbt-4de5856a70311a16d18c97754ced62ce52e589c7, not saving sbt cache.
Post job cleanup.
Cache hit occurred on key Linux-coursier-4de5856a70311a16d18c97754ced62ce52e589c7, not saving coursier cache.
Cache hit occurred on key Linux-sbt-4de5856a70311a16d18c97754ced62ce52e589c7, not saving sbt cache.

Could it be key sbt key has changed and it's not found anymore or something related?

Migration to Node.js 20 wanted

Thanks for the great project! I'm using it for all my projects.

Currently, on the actions page GitHub shows the following warning:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: coursier/cache-action@v6. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Consider adding option to disable cache key fallback

The current behaviour of the cache is to fallback to a different cache key on cache miss. It would be good if this behaviour could be disabled, or if the user could define a cache key prefix which applies to all cache keys.

The main driver behind this is avoiding unnecessary downloads / uploads for repos that have multiple builds, with some having only a handful of dependencies or different scala versions

coursier cache keys:
  coursier-lint-scala-code-475cd933d4d254d8267377454164c8ad6db554de
  coursier-lint-scala-code-
  coursier-

< Cache download logs >

Cache restored successfully
coursier cache miss, fell back on coursier-build-b930455d2f9b4f12b182a5c0f86b8680b4479aed.
coursier cache will be saved in post run job.

I'm happy to contribute if you agree with adding this feature but don't have the capacity to work on it at the moment - might need a nudge in the right direction though

Upgrade to node 16

Actions using Node 12 are considered deprecated and encouraged to upgrade to Node 16.
For reference: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

I wonder if all that is needed is just changing this line.

runs:
-  using: 'node12'
+  using: 'node16'
  main: 'dist/restore/index.js'
  post: 'dist/save/index.js'
  post-if: 'success()'

And refreshing the package-lock.json using Node 16.

If so, I am more than happy to help.
But, if something else is required I would need assistance / guidance.

See also: coursier/setup-action#281

Set `cache-hit-...` output

actions/cache does set the output cache-hit if the cache was hit. Have a look at the docs: https://github.com/actions/cache#skipping-steps-based-on-cache-hit

Can we have the same here?
Looking at the implementation of actions/cache that shouldn't be too hard:

We would need an output for each cache however:

  • cache-hit-coursier
  • cache-hit-sbt-ivy2-cache
  • cache-hit-mill
  • cache-hit-ammonite

Based on the referenced example, we could for example:

...
    if: steps.cache.outputs.cache-hit-coursier != 'true'
...

Transient errors in post-job cache action

scalameta/metals#2608 (comment)

Post job cleanup.
coursier cache key:
  coursier-unit-matrix-c72830702e1d2b18a132b9d6e3742571e19e9466-33aa363d8c15033b2a8ed0d8c299d77f17660736
Saving coursier cache
C:\windows\System32\tar.exe --posix -z -cf cache.tgz -P -C D:/a/metals/metals --files-from manifest.txt
Warning:  Cache service responded with 429 during upload chunk.
  
sbt-ivy2-cache cache key:
  sbt-ivy2-cache-unit-matrix-c72830702e1d2b18a132b9d6e3742571e19e9466-57ca911780629f6d13612b672c8a32e66547f7b0
Saving sbt-ivy2-cache cache

D:\a\_actions\coursier\cache-action\v6\dist\node_modules\@actions\cache\lib\internal\cacheHttpClient.js:177
                        autoClose: false
^
Error: Cache upload failed because file read failed with EBADF: bad file descriptor, read
    at ReadStream.<anonymous> (D:\a\_actions\coursier\cache-action\v6\dist\node_modules\@actions\cache\lib\internal\cacheHttpClient.js:177:1)
    at ReadStream.emit (events.js:210:5)
    at internal/fs/streams.js:167:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5)

Suspicious warning 'reserveCache failed' in Post Cache

We're using coursier/cache-action@v5: https://github.com/zio/zio-telemetry/blob/master/.github/workflows/ci.yml#L46

In the Post Cache scala dependencies step, we're seeing suspicious warnings:

Post job cleanup.
Saving coursier cache
Warning:  reserveCache failed: Cache already exists. Scope: refs/heads/master, Key: Linux-coursier-3079bd8f16e7a25e57b7c35b9b13090eb7092b1f, Version: 1e08b80f3462916ac2d5654f6b399c900980cc0f9b928b367a6df70ad7ddd959
Saving sbt-ivy2-cache cache
Warning:  reserveCache failed: Cache already exists. Scope: refs/heads/master, Key: Linux-sbt-ivy2-cache-91f8e0fa8ca1f9c6c77811374a8bcb945b2387c8, Version: 9635c9698008b57d9157eed8e70fa13373c2bf90a51d9edde39fe4b528f54439

https://github.com/zio/zio-telemetry/runs/1797302607?check_suite_focus=true#step:9:3

Is this an expected behavior? The fact that it's a warning makes us not 100% sure that we're using coursier/cache-action correctly.

/cc @mijicd

Consider moving major tags after releases

According to the GitHub Actions toolkit versioning recommendations (https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations), major version tags should be moved to point to the ref of the current release. This would allow anyone binding to v6 to get the latest fixes, while others could bind to something like 6.1 if they need a specific commit.
For this repo, this would also require what is currently v6 to be renamed to v6.0 so that v6 can move to the latest version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.