-
Notifications
You must be signed in to change notification settings - Fork 81
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
[CI] Deduplicate actions/cache
directives
#340
Comments
Hi @joshlf, |
I apologize for any inconvenience. It appears that the https://github.com/orgs/community/discussions/25220#discussioncomment-3246922 |
Thanks for finding that workaround! Honestly probably not worth the complexity given that this is a very minor problem to begin with. If there's no good solution, it's probably fine to just leave it as-is. I'm gonna close this, but feel free to comment if you figure something else out! |
Would it perhaps be interesting to use a local action? I do that in Comprehensive Rust: This has worked out great for us in the last 12 months or so. |
Oh yeah that's perfect! I'll re-open the issue with that suggestion. Thanks, @mgeisler! |
@joshlf , I have created a PR as a patch for this issue. Can you please review it and suggest changes in it if required. |
* fixed cache dupe call * add shell * Removed duplicate calls for caching in CI. Resolves #340 * fixed multiple runs * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> --------- Co-authored-by: Joshua Liebow-Feeser <[email protected]>
* fixed cache dupe call * add shell * Removed duplicate calls for caching in CI. Resolves google#340 * fixed multiple runs * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> * removed whitespace .github/workflows/ci.yml Co-authored-by: Joshua Liebow-Feeser <[email protected]> --------- Co-authored-by: Joshua Liebow-Feeser <[email protected]>
We have a
generate_cache
job in CI which pre-populates a cache that is re-used by other jobs:zerocopy/.github/workflows/ci.yml
Lines 410 to 442 in 3bb9a54
In each dependent job, we do the following:
needs: generate_cache
actions/cache
action configuration:zerocopy/.github/workflows/ci.yml
Lines 77 to 81 in 3bb9a54
As of this writing, we copy that exact text five times. It'd be great if we could reduce the duplication.
Mentoring instructions
As proposed here by @mgeisler:
Create a separate
cache.yml
file in.github/workflows
Populate it with a job that performs these steps:
zerocopy/.github/workflows/ci.yml
Lines 77 to 81 in 3bb9a54
Replace uses of that pattern in
ci.yml
with an invocation of that file, ie:Old/obsolete mentoring instructions
As discussed in this StackOverflow comment,
The task is to figure out whether there's a way to use that technique to define a new action in
ci.yml
that we can re-use in other steps. If there's an easy, simple syntax for this, we should do it. If it would require a lot of complexity, then it's not worth it.The text was updated successfully, but these errors were encountered: