-
Notifications
You must be signed in to change notification settings - Fork 31
Fix CI setup for Windows #352
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
Conversation
af72131
to
4c69cc8
Compare
File.chmod(0o755, "bin/rails") | ||
|
||
# The error message is slightly different on Ubuntu, so we need to allow for that | ||
FileUtils.mv("test/dummy/config/application.rb", "test/dummy/config/application.rb.bak") |
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.
Picked this as an arbitrary file to remove to verify boot failure.
test/test_helper.rb
Outdated
@@ -32,7 +32,11 @@ class TestCase | |||
include RubyLsp::TestHelper | |||
|
|||
def dummy_root | |||
File.expand_path("#{__dir__}/dummy") | |||
result = File.expand_path("#{__dir__}/dummy") | |||
unless result[0] == "/" |
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 path returned on windows doesn't have the leading /
, it starts with the drive letter. So we need to 'normalize' it for the 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.
But why? The correct path on Windows wouldn't have that leading forward slash. Is it because of some URI being incorrect? If that's the case, then the solution is to use the Ruby LSP's URI builder URI::Generic.from_path
, which already handles Windows URIs.
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.
Now fixed so that isn't needed.
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.
Spoke too soon, still getting some windows failures.
@@ -46,10 +46,15 @@ def initialize | |||
Process.setsid | |||
rescue Errno::EPERM | |||
# If we can't set the session ID, continue | |||
rescue NotImplementedError | |||
# setpgrp() may be unimplemented on some platform | |||
# https://github.com/Shopify/ruby-lsp-rails/issues/348 |
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.
(Let's look into this separately).
Still seeing failures with the higher timeout... perhaps we are failing to shutdown the server properly on Windows, and it's using a ton of memory, leading to the slowness. |
7fb6a46
to
3950b0e
Compare
@@ -55,4 +55,4 @@ jobs: | |||
run: bin/rubocop | |||
|
|||
- name: Run tests | |||
run: bin/rails db:setup && bin/rails db:migrate && bin/rails test | |||
run: bundle exec rails db:setup && bundle exec rails db:migrate && bundle exec rails test |
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.
bin/rails
is failing on Windows but appears to still return a successful exit code, which was causing the build to be wrongly marked as passing.
end | ||
|
||
stdin, stdout, stderr, wait_thread = Open3.popen3( | ||
"bin/rails", | ||
"bundle", |
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.
Until we better understand the bin/rails
problem on Windows, this seems a safer approach.
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.
This will bypass Spring and be extremely slow in Core. What exactly is the problem with using bin/rails
on Windows?
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.
This will bypass Spring and be extremely slow in Core.
I initially thought it would, but it seems does still use Spring:
%% bundle exec rails c
Running via Spring preloader in process 889133
running spring after_fork
Loading development environment (Rails 7.2.0.alpha)
I think that wasn't always the case, and behaviour has changed in Rails at some point?
What exactly is the problem with using
bin/rails
on Windows?
It exits right away:
https://github.com/Shopify/ruby-lsp-rails/actions/runs/8822162407/job/24219691837
@vinistock @st0012 this is ready for another look. I propose that we get CI running for Windows again, then work on #348 separately. |
Gemfile
Outdated
@@ -20,3 +20,4 @@ gem "tapioca", "~> 0.13", require: false, platforms: :ruby | |||
gem "psych", "~> 5.1", require: false | |||
gem "rails" | |||
gem "webmock" | |||
gem "tzinfo-data" |
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.
Needed for Windows platforms. Trying to limit the platforms was causing some Bundler issues, so I've left it open.
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 issues?
@@ -4,6 +4,9 @@ | |||
require "test_helper" | |||
require "ruby_lsp/ruby_lsp_rails/runner_client" | |||
|
|||
# tests are hanging in CI. https://github.com/Shopify/ruby-lsp-rails/issues/348 |
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.
I narrowed it down to this file.
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.
Do we still need to skip this test on Windows? If so, let's ship this, but please prioritize unskipping it so that we don't go long with skipped tests.
Another possible approach is to prefix the binstub calls with I've verified this works in CI. It does kinda make sense that the binstub on its own wouldn't work on windows since the |
15bd20b
to
686ff88
Compare
@@ -36,7 +36,7 @@ class Test < ActiveSupport::TestCase | |||
# The last 3 are for the test declaration. | |||
assert_equal(6, response.size) | |||
assert_match("Run", response[3].command.title) | |||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | |||
assert_match(%r{(ruby )?.*bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) |
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.
Due to #353
686ff88
to
613c85a
Compare
@@ -36,7 +36,7 @@ class Test < ActiveSupport::TestCase | |||
# The last 3 are for the test declaration. | |||
assert_equal(6, response.size) | |||
assert_match("Run", response[3].command.title) | |||
assert_equal("bin/rails test /fake.rb:2", response[3].command.arguments[2]) | |||
assert_match(%r{(ruby )?bin/rails test /fake\.rb:2}, response[3].command.arguments[2]) |
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.
Due to #353
be6666c
to
318f642
Compare
@vinistock all passing now. |
318f642
to
5a82483
Compare
@@ -4,6 +4,9 @@ | |||
require "test_helper" | |||
require "ruby_lsp/ruby_lsp_rails/runner_client" | |||
|
|||
# tests are hanging in CI. https://github.com/Shopify/ruby-lsp-rails/issues/348 |
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.
Do we still need to skip this test on Windows? If so, let's ship this, but please prioritize unskipping it so that we don't go long with skipped tests.
I should've rebased before merging, as there are some failures in |
Closes #351 but we still need to address #348.