Open Algunenano opened 4 years ago
In the end I was able to do this by using cache@v2 directly with something like this:
env:
EM_VERSION: 1.39.18
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup cache
id: cache-system-libraries
uses: actions/cache@v2
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{ runner.os }}${{env.EM_VERSION}}
- uses: mymindstorm/setup-emsdk@v5
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Build library
run: make -j2
- name: Run unit tests
run: make check
With this the build step went from ~2m 10s to ~30 seconds.
Feel free to close this or incorporate it to the docs if you think it's worth it.
Thanks for the request! I don't think that I can do much about this outside of adding to docs. I'm not aware of a way to cache things after the action finishes executing. I think more time can be saved if I have the action detect if the cache folder exists and not download from the cache if it isn't needed.
Thanks for the request! I don't think that I can do much about this outside of adding to docs. I'm not aware of a way to cache things after the action finishes executing.
It's possible to run something as a post-run step by adding something like
runs:
post: 'post.js'
to actions.yml
.
The approach from the README and https://github.com/mymindstorm/setup-emsdk/issues/6#issuecomment-654913731 does not actually work.
If setup-emsdk did not hit the cache, it will use emsdk-main
as directory in the build environment, but both setup-emsdk and actions/cache
will only cache emsdk-cache
, which contains a copy of emsdk-main
before the build happens. Only if the cache was hit, emsdk-cache
will actually end up with system libs inside.
I imagine it worked by accident during testing because setup-emsdk
hit the cache once but actions/cache
did not, so it was initially populated correctly.
First of all, thanks a lot for putting this out there; I've started using it today and it worked flawlessly in the first try.
This is not an issue but a feature request. It seems like the cache is being stored at the end of
Run mymindstorm/setup-emsdk@v5
, so system libraries built during the "normal" compilation are not cached.In my test build, generating these libraries take ~1m 40s (out of ~2m). Extract:
Is there any way to setup a post run step to the build (either manually in each job or by adding an option to the action) to get those system libraries to also be cached? As far as I know, these generated system libraries only depend on the emcc version, so caching everything together should be safe.