Skip to content
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

Save package cache as a post build step #92

Open
jtanx opened this issue Nov 22, 2020 · 8 comments
Open

Save package cache as a post build step #92

jtanx opened this issue Nov 22, 2020 · 8 comments

Comments

@jtanx
Copy link

jtanx commented Nov 22, 2020

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.

@lazka
Copy link
Member

lazka commented Nov 22, 2020

Sounds good. https://github.com/actions/cache/blob/0781355a23dac32fd3bac414512f4b903437991a/action.yml#L20

I wonder why it's not practical to list them for you?

@jtanx
Copy link
Author

jtanx commented Nov 22, 2020

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

@eine
Copy link
Collaborator

eine commented Nov 22, 2020

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

@eine
Copy link
Collaborator

eine commented Nov 22, 2020

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.

@lazka
Copy link
Member

lazka commented Nov 22, 2020

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)

@jtanx
Copy link
Author

jtanx commented Nov 22, 2020

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.

@txtsd
Copy link

txtsd commented Apr 29, 2022

This would be very helpful!

@txtsd
Copy link

txtsd commented Jun 1, 2022

@MehdiChinoune
What shell are you running Install prerequisites in? Because it doesn't work for me. Neither like this, nor with shell: msys2 {0}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants