Comments (8)
Aha, interesting. I tried to come up with something clever like that, but failed :-)
Really I'd like to include the caching inside the action (as discussed on another issue), but this should work in the meantime, I'll give it a go. Thanks!
from cache.
@DanTup you could incorporate the date into your key, to ensure that every day you create a new cache. Unused caches will already be evicted after 7 days, so you don't need to worry about that (see docs)
Example:
# http://man7.org/linux/man-pages/man1/date.1.html
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash # For Windows, Linux and macOS default to bash already
- uses: actions/cache@v1
with:
path: ~/.cache/directory
key: ${{ runner.OS }}-build-${{ steps.get-date.outputs.date }}
Leaving off restore-key
if you don't want any other caches from previous dates.
from cache.
Really I'd like to include the caching inside the action
Yep I think that would be an ideal scenario for any setup
action where you knew explicitly what you could cache
from cache.
@DanTup in the case of something like Dart that is already hosted on a very fast CDN like google I very much doubt you are going to gain a huge amount in terms of time. The file still needs to be downloaded to the VM for each job you are just choosing to download from Azure storage vs Google storage at that point.
from cache.
@chrispat you're right - I used that as an example because it was easy to explain. In reality it's only around 8 seconds to download and extract Dart so it's not worth caching. the VS Code install and Flutter downloads are much slower though. Flutter comes as either a zip file (which is quite large) or a git clone which downloads some bits on-demand. It currently takes several minutes so I'd like to try and speed that up (doing it inside the setup-flutter action would be more flexible though - for ex. we can read the engine hash from a local file to use as a cache key).
from cache.
https://dart.dev/tools/sdk/archive sends this query to get info about the latest version (copied from chrome developer tools):
curl 'https://storage.googleapis.com/dart-archive/channels/stable/release/latest/VERSION' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://dart.dev/tools/sdk/archive' -H 'Origin: https://dart.dev' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36' --compressed
You can use the revision field inside response for the cache key, this way you will only need to redownload it when it's actually necessary
from cache.
Yeah, though doing all that in a single command inside the yaml file is rather messy to save a few seconds. It'd be much better with #55 :)
from cache.
Including the date in your cache key is a way to achieve time-based expiration.
It'd be much better with #55 :)
#55 is now closed, see https://github.com/actions/toolkit/tree/master/packages/cache for the @actions/cache
package.
from cache.
Related Issues (20)
- cache restore on versions 3 and 4 not working HOT 6
- engineering finace tshingombe cash flow HOT 2
- Restore action doesn't actually fail workflow even when fail-on-cache-miss is true HOT 2
- N claims? failed Accusations and it is funny
- Using cache with git tags HOT 1
- 🎁 #SubscribersGift HOT 2
- Repo looks empty
- workarounds for cache size quotas/limits?
- zstdmt does not exist HOT 1
- Net efx ptions HOT 1
- Home | Task
- Failed to restore: getCacheEntry failed: Cache service responded with 500 HOT 5
- Signing certificate with thumbprint *** not found in store HOT 7
- Incomplete key restores arbitrary cache object
- > ## Description HOT 3
- Sinlee94 HOT 1
- [ HOT 4
- > > * > [2024-03-01T17:38:57.4236128Z ##[debug]Starting: Set up job
- > ## Description
- Duplicated cache due to concurrency HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cache.