kousu / cache Goto Github PK
View Code? Open in Web Editor NEWThis project forked from actions/cache
Cache dependencies and build outputs in GitHub Actions
License: MIT License
This project forked from actions/cache
Cache dependencies and build outputs in GitHub Actions
License: MIT License
TravisCI is limited in what folders it will cache, but it is smart about detecting when they have been updated: https://docs.travis-ci.com/user/caching/.
In contrast, GithubCI's caching mechanism expects that you can pre-compute, from only the contents of your repo, a cache key to identify your cache. Caches are write-once in Github. The closest thing to updating a cache is by using restore-keys
eg.
- name: Download annex cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.annex-cache
key: annex-${{ hashFiles('**/*.nii.gz, **/*.nii') }}
restore-keys: |
annex-
In this, annex-
is a prefix of every cache, so if the exact cache doesn't exist yet, the most recently generated cache will be downloaded instead.
This is inconvenient, and can even fail if:
I don't want to have to think about all that.
The idea of this fork is to behave more like Travis: download the most recent cache, but then upload. So far, it needs to be used like this:
- name: caching
uses: kousu/cache@main
with:
path: .cache
key: mycache-${{ hashFiles('.cache') }}
restore-keys: |
mycache-
because I haven't found where or if hashFiles()
is available in the Github javascript libraries, it needs to be fed in from the Workflow language. You need to make sure the path used in hashFiles()
matches the path used in path:
and that the restore-keys:
prefix matches the prefix used in key:
. Another caveat is that hashFiles is strictly limited, I guess as an anti-abuse measure, to reading files within your repo, so you'll need to, I dunno, rsync or symlink or something to cache things in e.g. ~/.npm or ~/.cache/pip.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.