-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Caching #235
Comments
Does it mean caching the plugins themselves? Or does it mean caching the tools installed by asdf? |
We want to cache anything that is downloaded when running With the cache action, it would look something like this: - uses: actions/cache@v2
with:
path: |
~/.asdf/installs
~/.asdf/plugins
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }} Currently we can't use the cache action with the asdf action. Because the asdf action runs |
In my use case caching works as expected:
|
OK. We will make some major improvements in the near future, so let's do it together. |
Many thanks @0x6a68, your snippet proved very useful (I'm caching the Erlang build which takes ages get currently, as described in asdf-vm/asdf-erlang#165). For those interested, the full script is available at thbar/ex-portmidi#4 |
@jmcvetta I have seen people using Additionally, you can skip the |
I think you could close this @jthegedus, the cache action works well.
Thanks for all the hints above |
Some benchmark from my abstract project:
Looks like cache will be very useful (since @afirth snippet is long). |
Thanks for the great snippet, @afirth; I expect this will speed up our workflows considerably! I agree that caching would be an excellent improvement to bake into the action itself. Even if the snippet exists, only a small percentage of users of the action will find it, and it downloads asdf itself twice in the event of a cache hit. In case this helps others, you only need to specify |
When trying to restore the cache currently, we get issues because it seems like |
@snowe2010, can you offer more details? We are using the approach I described successfully, and we do use the node plugin. See ScribeMD/pre-commit-action for an example. |
Thanks @afirth, this solution works on our project as well, should we add this into the README file so other developer can follow it 😄 |
It can works without the |
It would be great to document the recipe more visibly, but it would need to be corrected first as mentioned previously:
|
@Kurt-von-Laven I think it is due to using a custom build machine that is shared with projects that have different node versions. The node version somehow gets mangled or not updated correctly. |
@snowe2010, what “it” are you referring to? Are you asking a question, and if so, what question? What are you trying to achieve, and how are you currently going about it? |
To give you more information might take a while. I pretty much just trashed the asdf caching for the projects I was having issues on because I couldn't get node to work correctly. |
Makes sense. To try to help you I would need to see the relevant excerpt of your workflow and any pertinent errors, warnings, logs, etc., but obviously your call whether it's worth investigating. |
Just coming here to say that I also used that and it works great. https://github.com/react-native-community/rn-diff-purge/blob/master/.github/workflows/new_release.yml |
Idea: could this make use of the same I realize it's adjacent to the discussion here, crosslinking it: |
The action seems to pick existing data properly now, adding this to your pipeline should work - name: Cache asdf
uses: actions/cache@v3
with:
path: |
~/.asdf
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} |
works like a charm:
steps:
- name: Setup ASDF itself
uses: asdf-vm/actions/setup@v2
- name: Restore ASDF tools from cache
id: asdf-tools-cache
uses: actions/cache@v3
with:
key: asdf-tools-${{ hashFiles('.tool-versions') }}
restore-keys: |
asdf-tools-
path: |
${{ env.ASDF_DIR }}/plugins
${{ env.ASDF_DIR }}/installs
- name: Install ASDF tools on cache-miss
if: ${{ steps.asdf-tools-cache.outputs.cache-hit != 'true' }}
uses: asdf-vm/actions/install@v2
- name: Reshim installed ASDF tools
shell: bash
run: asdf reshim |
Any reason not to simply use |
Definitely, according to the documentation That's why install asdf first, restore previously installed plugins/tools, and reshim to match current versions from .tool-versions file. |
actions/cache#1328 adds documentation re. this to the cache action. |
Summary: asdf install shouldn't have to be done all that much. So cache it. Thanks to asdf-vm/actions#235 Test Plan: CI
It would be very useful if the Github Actions cache system could be integrated with this action. It should be able to save significant time when installing a large list of tools.
The text was updated successfully, but these errors were encountered: