setup-msys2
setup-msys2 copied to clipboard
Save package cache as a post build step
This action is pretty neat, but one thing that would be nice is if saving the package cache could be deferred until after the build is done.
This would be ideal because I have a build script that installs many dependencies (and where it's not really practical to list them out directly in the workflows yml), so it would be nice if it cached those packages too. Not entirely sure if this is possible, although I see actions/cache does it as a post build step.
Sounds good. https://github.com/actions/cache/blob/0781355a23dac32fd3bac414512f4b903437991a/action.yml#L20
I wonder why it's not practical to list them for you?
There's a lot of packages to install, plus I also use the same build script outside of CI for manual invocations, so it would be nice to not have to list out the packages twice but have it work in both cases
My concern with this request is that I use the resulting MSYS2 environment both for building and for testing a package. Hence, the package is installed before running the tests, but I don't want that to remain in the cache. Also, I don't think it's reasonable to keep uninstalling undesired packages. Therefore, I would propose users defining when to do the caching through an specific step. From a technical point of view, we can distribute two Actions or entrypoints:
steps:
- uses: msys2/setup-msys2@v2
- run: install your deps here
- run: do something else
- uses: msys2/setup-msys2/cache@v2
- run: install things which are not to be kept
- run: test whatever
There's a lot of packages to install, plus I also use the same build script outside of CI for manual invocations, so it would be nice to not have to list out the packages twice but have it work in both cases
Note that you can define the list of packages in a file and have that file loaded and passed to setup-msys2.
My concern with this request is that I use the resulting MSYS2 environment both for building and for testing a package. Hence, the package is installed before running the tests, but I don't want that to remain in the cache.
Note that only downloads end up in the cache, not things you install. So this is still an issue for our MSYS2 CI where we download random makedepends which we don't want to cache for the next run, but not for a somewhat static sets of tasks.
We could also add an option to tell the action when to save the cache (in the default case the post-action would then just do nothing)
Note that you can define the list of packages in a file and have that file loaded and passed to setup-msys2.
That's good to know, I do multiarch builds though (both 32/64 bit), so having the post-build cache is definitely easier.
This would be very helpful!
@MehdiChinoune
What shell are you running Install prerequisites
in? Because it doesn't work for me. Neither like this, nor with shell: msys2 {0}
.