-
Notifications
You must be signed in to change notification settings - Fork 499
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
Windows Actions CI - use $ErrorActionPreference for bundler install step #1531
Conversation
.github/workflows/ci.yml
Outdated
bundle config --local path .bundle/gems | ||
bundle config --local without docs lint coverage | ||
# warning output can confuse Powershell in CI, (multi-line scripts & exit codes) | ||
$env:RUBYOPT = '-W0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if bundler call is split into a separate step? Does it also fail to print warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mojavelinux and what's the point storing gems in .bundle/gems
? Ain't everything supposed to work regardles of gems location? Whole CI VM will be dropped anyway after build is finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if bundler call is split into a separate step? Does it also fail to print warnings
It's not about it failing to print warnings. It's about warnings causing the step to fail when they shouldn't.
There's been discussion in RubyGems about this, in that warnings are printed when a user has no control over the gem in question. The idea was to change the warnings to only show when the gem is built, not when it is installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of path is no about caching. It's about testing the installation of the CLI correctly and in isolation. Without specifying a path, the CLI location test has to be partially faked.
Oh, you mean it exits with 1 on warnings? That's weird. |
Re gem location ( I didn't set up caching. Using |
Yes, see some of the previous actions jobs. Quite the PITA. I've had the issue before (and also on Appveyor). As I mentioned in ruby/setup-ruby#13, I do not have the issue running the commands locally. Someday I have to track the issue down re PowerShell configuration... |
I would avoid caching unless there's a strong need to improve build times, because it can hide bugs when gems are available because they were cached and not because there's a dependency on them. |
Oh, I didn't realize that. Then no need for this step. I was just following the README https://github.com/eregon/use-ruby-action#caching-bundle-install (which I now see says that Bundler is already there). |
It also forces Bundler to install the CLI (the bin scripts) for the current gem, which then allows me to test the CLI properly. |
But why do we get warnings when |
.github/workflows/ci.yml
Outdated
bundle config --local path .bundle/gems | ||
bundle config --local without docs lint coverage | ||
# warning output can confuse Powershell in CI, (multi-line scripts & exit codes) | ||
$env:RUBYOPT = '-W0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet trick!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except don't we need to unset it afterwards so it doesn't remain set while running tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except don't we need to unset it afterwards so it doesn't remain set while running tests?
No. Big difference between Azure Pipelines / GitHub Actions and Travis / AppVeyor. In Actions, changes to the environment do not affect subsequent steps, unless one uses something like:
echo '::set-env name=JOBS::'-j$((1 + $(nproc --all)))
Sometimes it's helpful, often not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info!
So my question still stands, what is the warning? And how is this different from the warning when
|
Could you once again give a link to workflow run with warnings? AFAIR, there was something about prawn-tables, but not about config options you use. |
That was just the last message logged. It has nothing to do with this situation.
Here's an example: https://github.com/asciidoctor/asciidoctor-pdf/runs/416845301 (view the raw log) |
@mojavelinux have you tried splitting that in separate steps so it becomes clear which exact comand returns 1? |
Here's what I'm saying. If I run this it works fine:
If I run this, it fails:
Why does it die in one case and not in the other? It's exactly the same set of instructions. The only difference is that there are 3 commands instead of 1. Btw, the same thing happens if I write directly to .bundle/config instead of using I get that using -W0 is the fix. I just want to know why it is needed in the second case. |
The command that fails is |
Have at it. As I've mentioned, I could not repo this locally. See |
I've been able to confirm that using separate steps also solves the problem. I'm going to go with that approach instead. Thanks for helping us troubleshoot this, @MSP-Greg! Much appreciated! |
Give me a second, running CI now... |
a558830
to
88d47a9
Compare
Sure thing, take your time. |
Thanks. I changed it to use $ErrorActionPreference. I'll write some code to locally see if I can determine what's going on. Don't know what you'd prefer... |
But you didn't remove |
88d47a9
to
68bece6
Compare
I knew that. No, I did not. Sorry, fixed. |
Yeah, that worked. Wow, now we have like 3 different ways of solving this issue. I'll quickly summarize:
Does that look right? |
Yes. I still can't repo this locally. Every command seems to exiting with zero. I hate this. I think $ErrorActionPreference = 'Continue' is probably the best, as it shows what seems to be the problem... |
Thanks again! I'll stick with the final result then. Cheers! |
Splitting steps would keep build script cross-platform. You don't need that right now, though. |
I went ahead and did both. That way we can monitor output in the interim, but disable the setting when it comes time to go cross platform. |
At present, all Actions Windows Rubies have Bundler installed. If an update is needed, doing so with
gem update --system
is probably a better idea.