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

Build on JRuby again #1383

Merged
merged 14 commits into from
Feb 28, 2020
Merged

Build on JRuby again #1383

merged 14 commits into from
Feb 28, 2020

Conversation

vincent-psarga
Copy link
Contributor

@vincent-psarga vincent-psarga commented Jan 13, 2020

Summary

Thanks to the generation of Protobuffers in pure Ruby, we should be able to build cucumber on JRuby again.

Details

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Refactor (code change that does not change external functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I've added tests for my code
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@olleolleolle olleolleolle changed the title Build on Ruby again Build on JRuby again Jan 13, 2020
@olleolleolle
Copy link
Contributor

(I made edits to the title and description, to account for the J of JRuby.)

@vincent-psarga
Copy link
Contributor Author

(I made edits to the title and description, to account for the J of JRuby.)

Thanks, I did that PR a bit too quickly :/

@luke-hill
Copy link
Contributor

This PR also lends itself to perhaps (either alongside or simultaneously), removing appveyor and getting circleci to build windows. That's where the failures are most prevalent, JRuby and windows.

Note: this may definitelly not be the best way to proceed, but the long term idea is
to drop the `step` nesting, so spending time fixing this issue would be lost.
@vincent-psarga
Copy link
Contributor Author

Note: I disabled one of the scenario to make this work (features/docs/defining_steps/nested_steps.feature:111 which involves using step.
As the long term idea is to disable nesting steps(see #1362), spending time fixing this seems counter productive. That said, if someone knows how to get this scenario pass again, feel free :)

I also had to tweak a bit one test. If seems that Ruby does not set RbConfig::CONFIG['rubyarchdir'] which is used by BacktraceFilter. It seemed logical that the unit test also checked if this was set.

@vincent-psarga
Copy link
Contributor Author

This PR also lends itself to perhaps (either alongside or simultaneously), removing appveyor and getting circleci to build windows. That's where the failures are most prevalent, JRuby and windows.

Getting the build running on CircleCI/Windows (and removing AppVeyor) is planned yes, but not in this PR.
The idea here is simply to activate JRuby again (as the cucumber-messages gem now uses a pure Ruby Protobuffers handling).

@luke-hill
Copy link
Contributor

It's failing for russian letters being converted somewhere.

The good news is all of the main scenarios pass. It's the language specific ones that come up smelly fishy

@vincent-psarga
Copy link
Contributor Author

Ok, I've spent a fair amount of time on trying to figure out why this fails but don't get anywhere. If anyone has a deeper knowledge of JRuby and/or why this may happen, have fun :)

The only way I add to get it working was to replace content of examples/i18n/ru/step_definitions/calculator_steps.rb with:

Given('я ввожу число {int}') do |number|
  calc.push number
end

Given('затем ввожу число {int}') do |number|
  calc.push number
end

When('нажимаю {string}') do |operation|
  calc.send operation
end

When('я нажимаю {string}') do |operation|
  calc.send operation
end

Then('результатом должно быть число {float}') do |expected|
  calc.result.should == expected
end

Given('я сложил {int} и {int}') do |first_number, second_number|
  calc.push first_number
  calc.push second_number
  calc.send '+'
end

But that's definitely cheating :/

@vincent-psarga
Copy link
Contributor Author

Oh and if someone want to figure that out, bumping to 9.2.9 does not help (the same error is there)

@vincent-psarga
Copy link
Contributor Author

Ok, this I've disabled a few examples for i18n and JRuby (namely 'ru', 'uk' and 'uz') as we can't define step definitions there (note that Greek or Japanese work).

I think it's more an issue with JRuby than with Cucumber. I was thinking about adding a file under 'docs/jruby-limitations.md' (which would be linked from the README) telling that we can not use keywords as step definitions for those languages (in the ruby code, the features files still support those)

Would that be enough to merge this PR ?

Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

docs/jruby-limitations.md Outdated Show resolved Hide resolved
docs/jruby-limitations.md Outdated Show resolved Hide resolved
@vincent-psarga
Copy link
Contributor Author

Thanks for the corrections :)
(and I'm scared to be able to do one click commits from Github interface :D )

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we document 9.2 but run CI against 9.1?? I don't use JRuby so there may be an obvious reason

end

def jruby_disabled_examples?(lang)
return unless RUBY_PLATFORM == 'java'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop will flag this. Linespace after guard clause.

README.md Outdated
@@ -28,7 +28,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber.
* Ruby 2.5
* Ruby 2.4
* Ruby 2.3
* JRuby 9.1
* JRuby 9.1 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "JRuby 9.1, 9.2"?

Suggested change
* JRuby 9.1 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md))
* JRuby 9.1, JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth checking it still build with JRuby 9.1, but that's just a task to add to CircleCI, should not be much of a trouble.
I'll add that :)

@@ -1,6 +1,6 @@
# Cucumber and JRuby limitations

`cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), although some of the features
`cucumber` can be executed on `JRuby` (tested with `9.1`and `9.2`), although some of the features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`cucumber` can be executed on `JRuby` (tested with `9.1`and `9.2`), although some of the features
`cucumber` can be executed on `JRuby` (tested with `9.1` and `9.2`), although some of the features

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it seems we have even more problems with JRuby 9.1 (apparently it's failing with language he).
I guess it's safer to just indicate 9.2

@vincent-psarga
Copy link
Contributor Author

Is there a reason we document 9.2 but run CI against 9.1?? I don't use JRuby so there may be an obvious reason

I bumped to 9.2 but forgot to update the documentation (which is done now).
No better reason than human error :D

@vincent-psarga vincent-psarga merged commit 190ffb0 into master Feb 28, 2020
@luke-hill luke-hill deleted the enable-jruby-ci-again branch August 22, 2023 11:00
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

Successfully merging this pull request may close these issues.

3 participants