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)
- use variables for setting path: key when using actions/cache ?
- cache/restore fails to hit if same paths given in different order
- Digital Banking & Trust
- actions/cache/restore@v3 is trying to use node 20 instead of 16 HOT 1
- Cannot mknod: Operation not permitted
- ## List and delete cache APIs are now available for managing your Actions Cache
- Cache does not restore due to an SSL problem
- Wrong Cache restore operation HOT 3
- Dereference symlinks when creating tar balls
- steps:%0A%20%20-%20uses%3A%20actions/checkout@v3%0A%0A%20%20-%20uses:%20actions/cache/restore@v3%0A%20%20%20%20id:%20cache%0A%20%20%20%20with:%0A%20%20%20%20%20%20path:%20path/to/dependencies%0A%20%20%20%20%20%20key:%20$%7B%7B%20runner.os%20%7D%7D-$%7B%7B%20hashFiles('**/lockfiles')%20%7D%7D%0A%20%20%20%20%20%20fail-on-cache-miss:%20true%0A%0A%20%20-%20name:%20Build%0A%20%20%20%20run:%20/build.sh
- Cache Incompatibility Between ARC and Non-ARC Runners in GitHub Actions
- cache restore timeouts - only on windows, only with larger (non-default) runner HOT 1
- Extremely slow Post Setup steps for actions/cache@v3 HOT 2
- `enableCrossOsArchive` appears to be broken-- unless I'm misunderstanding something HOT 1
- If the target path doesn't match the source path, restore reports "Cache not found for input keys"
- restore-keys not being tried when another other exact key has different scope
- Thank you lord 🙏 💓
- Cache-Hit output is null HOT 1
- Unexpected errors without any logs
- `cache@v4` not honoring the `save-always` parameter HOT 1
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.