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

Update Ruby to 3.0.2 #48

Merged
merged 8 commits into from
Nov 11, 2021
Merged

Conversation

katrinleinweber
Copy link
Contributor

@katrinleinweber katrinleinweber commented Nov 9, 2021

Thanks to @iHiD's advice in #41, I think this resolves #40 in a more complete way (and also replaces the botched attempt #47):

  1. Upgrades all places with ruby… version numbers.
  2. Adds 2 tests for the probably popular Ruby 3 syntax features "rightward assignment" and "endless method definition". I've excluded 3 of the "Other Notable New Features", because they don't seem relevant in this test-runner context, or are still experimental.
  3. Bumps gems to newer versions:
    • mandate, as advised & released
    • json, to resolve ArgumentError: wrong number of arguments (given 2, expected 1) in TestRunnerTest#…
    • parser, to stop warning: parser/current is loading parser/ruby27, which recognizes 2.7.x-compliant syntax, but you are running 3.0.2.
  4. Documents some upgrade & testing advice.

I confirmed locally that these succeed:

  1. docker build .
  2. bundle exec rake test => 13 runs, 23 assertions, 0 failures, 0 errors, 0 skips
  3. act --job rubocop && act --job test

Either json 2.6.1 or File.write seems to append an additional \n
at the end of the parsed results.json. Thus, both assertion
argument need to be treated the same now.
@katrinleinweber katrinleinweber requested a review from a team as a code owner November 9, 2021 09:16
Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

It might be worth adding a fixture to https://github.com/exercism/ruby-test-runner/tree/main/test/fixtures that verifies that Ruby 3.0.2 syntax can be used successfully in an exercise.

@katrinleinweber
Copy link
Contributor Author

Good idea! That's indeed what got me started 😤😄 :

syntax error, unexpected '=', expecting ';' or '\n'

should not appear for

  def method_name  = 

I'll start with that or similar, but would also look into adding the "Other Notable New Features" from the release post.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Great! @iHiD care to take a look?

@@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@e27aee156d42e38ff8a4c2fc97b125c4087cbcc7
uses: ruby/setup-ruby@b00551441a6fa3d528f3443dbff264a934b6e316
Copy link
Contributor Author

@katrinleinweber katrinleinweber Nov 10, 2021

Choose a reason for hiding this comment

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

There was another release in the meantime, which reminded me that I generally wanted to ask:

  1. why the sha is pinned?
  2. whether there are specific criteria, which version to pin?

Just out of curiosity, though. Not a blocker to the functionality of this PR.


I guess we could also do

Suggested change
uses: ruby/setup-ruby@b00551441a6fa3d528f3443dbff264a934b6e316
uses: ruby/setup-ruby@v1.85.0

or even …

Copy link
Member

Choose a reason for hiding this comment

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

  1. Sha is pinned because the "version" is based on a tag, which could be maliciously retagged in the future. Because actions effectively have write access to the codebase, if someone later got access to the setup-ruby repo and pushed and retagged their bad push as 1.85.0 then we'd be in trouble.
  2. The latest sha is generally fine :)

@iHiD
Copy link
Member

iHiD commented Nov 10, 2021

I'll release a new (non-beta) mandate and then we can make that final change and merge. I'm away from my laptop for most of the day, but will try and get this done later or tomorrow. Thanks! :)

@iHiD
Copy link
Member

iHiD commented Nov 11, 2021

@katrinleinweber https://twitter.com/iHiD/status/1458779603430948864 :)

See https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/,
but excluding:

- "in is changed …" because that's behaviour
- "Find pattern …" because it's "experimental"
- "Hash#except …" because the test runner doesn't care
   from where the student's code loads this method.
@iHiD
Copy link
Member

iHiD commented Nov 11, 2021

Awesome. Let's do it! Thanks :)

@iHiD iHiD merged commit e25f8dd into exercism:main Nov 11, 2021
@iHiD iHiD added the x:size/large Large amount of work label Nov 11, 2021
@katrinleinweber katrinleinweber deleted the update-ruby-to-3.0.2 branch November 11, 2021 15:28
@katrinleinweber
Copy link
Contributor Author

Works! Thank you all for helping me complete this :-)

image

@iHiD
Copy link
Member

iHiD commented Nov 11, 2021

Awesome. Great news. Thank you so much!!

https://twitter.com/exercism_io/status/1458828715765514250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
3 participants