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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摚 Plan for Ruby 3.0 support (Released!) #17931

Closed
ainame opened this issue Jan 9, 2021 · 30 comments
Closed

馃摚 Plan for Ruby 3.0 support (Released!) #17931

ainame opened this issue Jan 9, 2021 · 30 comments
Assignees

Comments

@ainame
Copy link
Contributor

ainame commented Jan 9, 2021

馃憢 Hello, fastlane community!

Ruby 3.0 support was released at v2.183.0. Please give it a try and give us feedback on this issue.
https://github.com/fastlane/fastlane/releases/tag/2.183.0

The plan is now hidden under "Details".

Please react with 馃憤 emoji on this issue if you are waiting for Ruby 3.0 support!

This is @ainame who recently became a core contributor 馃殌 I'm pleased to announce that I will be working on getting Ruby 3.0 support in fastlane. So this ticket is to track the progress and let fastlane users be aware of the work being addressed.

TL; DR

  • Use Ruby 2.4-2.7 until 3.0 migration is done
  • Don't send us a bug report about installation failure with Ruby 3.0 as it will cause duplication a lot
  • Help us if we need to test any for the migration in future 馃檹

Ruby 3.0 and currently supported versions

Ruby 3.0 was released on 25th December 2020. It's a major version update but its source code compatibility with 2.x should be good. There are performance improvements and interesting new features implemented.

However, fastlane hasn't officially supported Ruby 3.0 yet. Please read the below section for details. The currently supported versions are Ruby 2.4-2.7. I highly recommend that you upgrade Ruby version to 2.6 or 2.7. Ruby 2.4 is now in EOL period, which means there will be no security fix for it. Ruby 2.5 will be the same soon.

https://www.ruby-lang.org/en/downloads/branches/

If you try to install fastlane against Ruby 3.0, it actually succeeds with the version "2.54.1" BUT it is too old and deliver won't work for the latest App Store Connect APIs. Please don't use it.

How far is fastlane away from Ruby 3.0?

Ruby 2.7's warnings

Before going to Ruby 3.0, we should make sure the last version in 2.x series "2.7" is supported correctly. It's very important because 2.7 warns us if there are chances of breaking with some deprecation messages to prepare Ruby 3.0 migration. #15856

It's been recognised, in fact, fastlane can run on Ruby 2.7, which is the latest version in 2.x series. However, despite the fact, fastlane project hasn't guaranteed that all the testing specs pass with Ruby 2.7 on CI yet. This will be resolved on #17861

Blocker to install fastlane to Ruby 3.0

Right now, we have the dependency google-api-client that we have a strict limit in the flexibility of version resolving.

spec.add_dependency('google-api-client', '>= 0.37.0', '< 0.39.0') # Google API Client to access Play Publishing API

However, within those versions, none of them allows us to install it to Ruby 3.0 env. We need to adopt 0.44.2 or later googleapis/google-api-ruby-client#900.

Replace unmaintained gem

There is also slack-notifier gem which was popular to send messages to Slack but however, it doesn't seem to be actively maintained. So we might need to replace that gem with other or one made by ourselves.

To run unit tests

rspec/spec-mocks rspec/rspec-mocks#1394 also still has some issues for Ruby 3.0. We need to wait for it to be fixed.

Drop Ruby 2.4 support

We'd like to drop 2.4 support when we officially release "Ruby 3.0" support. It's mainly because rubygems we are using also did the same. So the more rubygems do that the harder we keep supporting old versions; e.g. #18339. Essentially the Ruby core team has ended security support for 2.4 last year. So it's good to update your Ruby version to keep your environment secure.

googleapis/google-api-ruby-client#2841
googleapis/signet#178

Todo

This is a rough plan to work on the migration.

  1. Enable CI for Ruby 2.7 [CI] support Ruby 2.7 on Circle CI聽#17861~
  2. Prepare Danger a CI check to prevent master/main branch to cause regressions of 2.7 warnings before enabling Ruby 3.0 on CircleCI [Ruby 3.0] Fix Ruby 2.7's deprecation warnings聽#18021
  3. Fix deprecation warnings with Ruby 2.7 if there are any to improve the source code compatibility with 3.0
  4. Work on other migrations
  5. Release the version that supports Ruby 3.0 officially

For 3-5, depending on how big impact changes will have, we might cut a work branch to stack up changes and release RC branch. If it will not be too big, changes will be merged into master gradually.

@ainame ainame self-assigned this Jan 9, 2021
@ainame ainame pinned this issue Jan 9, 2021
@fastlane-bot

This comment has been minimized.

@ainame
Copy link
Contributor Author

ainame commented Jan 12, 2021

% rbenv local 2.7.2
% bundle install
% RUBYOPT="-W:deprecated" bundle exec rspec --pattern */**/*_spec.rb 2> stderr.txt
% cat stderr.txt | grep warning: > warnings.txt

With those commands, I got some warnings that need to be fixed for Ruby 3.0 (including other normal warnings).

https://gist.github.com/ainame/d7f1c4d2fb07f139d3a0f064d4cbda75

I'll be fixing them and sending PRs once #17861 gets merged. Maybe I should create a Danger lint rule to check if there are such warnings appearing on rspec output.

@ainame
Copy link
Contributor Author

ainame commented Jan 17, 2021

I'm accumulating fixes onto this branch.
https://github.com/ainame/fastlane/commits/fix-ruby2.7-warnings

@mikehardy
Copy link
Contributor

I recognize this is off-topic but it doesn't appear there are too many subscribers - just wanted to say thanks! open source maintenance is usually a thankless job but shouldn't be, and fastlane in particular is so useful to me, thanks for helping. Cheers @ainame

@ainame
Copy link
Contributor Author

ainame commented Jan 21, 2021

#17861 and #17892 got merged! We'll be able to test fastlane with Ruby 2.7 finally!!

@ainame
Copy link
Contributor Author

ainame commented Jan 21, 2021

This PR will be the one to 馃敧 deprecated warnings as much as I found in fastlane itself and I could fix.
#18021

However, I left this method due to the difficulty to fix. I guess this may involve a refactoring on call sites.

def initialize(options, xcodebuild_list_silent: false, xcodebuild_suppress_stderr: false)

I identified that xcodebuild_list_silent and xcodebuild_suppress_stderr were introduced #5491 in order to make logs better for Crashlytics integrations, however, that was removed in
#11601 so now nothing uses that option (at least) within fastlane project. So I will remove the options, too.

It's an off topic but I realised FastlaneCore::CommandExecutor never deal with stdout and stderr separately. So that it can't provide a universal option just to suppress stderr which is equivalent of 2> /dev/null. Maybe we can provide something like a global option to deal with stderr somehow to keep logging nicer. I will open a ticket about it at some point.

@ainame
Copy link
Contributor Author

ainame commented Jan 23, 2021

I realised that without keeping monitoring warnings, there may be regressions of my fixes for warnings. So I will work on Danger checks for it. Added this to the TODO list.

Prepare Danger to prevent master branch to cause regressions of 2.7 warnings before enabling Ruby 3.0 on CircleCI

@ainame
Copy link
Contributor Author

ainame commented Feb 2, 2021

I've also started working on document pages to clarify the currently supported Ruby versions.
fastlane/docs#1018
#18189

This is done.

@RamblinWreck77
Copy link

Just here to cheer everyone on! Looking forward to a 3.0-compatible release. :)

@ainame
Copy link
Contributor Author

ainame commented Feb 24, 2021

This PR is now ready to review! 馃殌
#18021

It took me a while to implement a CI check that prevents regressions without using Danger. It turned out we won't be able to enable Danger for forked repositories as it can leak GitHub's access token.

@ainame
Copy link
Contributor Author

ainame commented Mar 10, 2021

#18021 has got merged. From now on no new code that is not ready for Ruby 3.0 in terms of "Separation of positional and keyword arguments" can be merged. It will be prevented by CI as far as it's covered by unit tests.

And also @joshdholtz the lead maintainer and I discussed dropping Ruby 2.4 support. We'd like to drop 2.4 support when we officially release "Ruby 3.0" support. It's mainly because rubygems we are using also did the same. So the more rubygems do that the harder we keep supporting old versions; e.g. #18339. Essentially the Ruby core team has ended security support for 2.4 last year. It's good to update your Ruby version to keep your environment secure.

googleapis/google-api-ruby-client#2841
googleapis/signet#178

@ainame
Copy link
Contributor Author

ainame commented Mar 14, 2021

While working on this improvement #18278 in order to find undiscovered issues as my side project, I could find another issue in the codebase for Ruby 3.0馃檪
#18395

@ainame
Copy link
Contributor Author

ainame commented Apr 10, 2021

Replacement of slack-notifier is ready馃殌 #18537

I'll submit the PR shortly.
ainame/fastlane@30555fc...replace-slack-notifier

@ainame
Copy link
Contributor Author

ainame commented Apr 16, 2021

Bumping rubocop version to the latest is on the way...
#18564

@ainame
Copy link
Contributor Author

ainame commented Apr 23, 2021

highline 1.7.x is not compatible with Ruby 3.0. I'll be migrating it to 2.x.
JEG2/highline#248

@ainame
Copy link
Contributor Author

ainame commented Apr 27, 2021

In order to update highline gem, we first need to bump commander by stopping using the forked one https://github.com/fastlane/commander.
I will submit a couple of PRs for it one by one.

#18599

@mikehardy
Copy link
Contributor

You are on the ultimate yak shave @ainame :-), thanks so much for your work here

@ainame
Copy link
Contributor Author

ainame commented Apr 27, 2021

@mikehardy It's my pleasure. Yeah, it is yak shaving but that's the only way to get things done right here馃槀
I will keep things up-to-date or resolve tech-debt stuff for the next major change from time to time as long as I maintain fastlane馃槄

@ainame
Copy link
Contributor Author

ainame commented May 1, 2021

I will work on google-api-client migration that's been blocking us to use Ruby 3.0 finally. It seems like it's not only about version bumping but also we need to adopt the new way of distribution of the gem split by its service. I'll first investigate what Google services are used in fastlane.

https://github.com/googleapis/google-api-ruby-client/blob/master/google-api-client/OVERVIEW.md

@ainame
Copy link
Contributor Author

ainame commented May 8, 2021

#18646 was needed to remove really old deprecation馃槃

And finally, it's getting really close to the goal馃弮 #18656

@ainame
Copy link
Contributor Author

ainame commented May 8, 2021

This PR is ready to review and test! I appreciate it if anyone can volunteer to test the below branch as it updates google-api-client gem. It shouldn't have any breaking changes but want to ensure that 馃檱

gem 'fastlane', git: 'https://github.com/fastlane/fastlane.git', branch: 'ai/migrate-google-api-client'

#18656

@mikehardy

This comment has been minimized.

@mikehardy
Copy link
Contributor

On a different machine a brew update today gave me a new gcc/llvm/etc (which was hinted at as a resolution for my issue in the comment I hid, above) and I was able to successfully create a Gemfile with your git source above and run bundle update

I ran bundle exec fastlane <etc> with your git source and it appeared to execute as before to build an iOS app and push it to the TestFlight servers.

I suspect that with the google-apis being the thing you really want to test, someone that uses Fastlane to interact with the Play Store would be your ideal test scenario yes? Hopefully someone else can give that a test, but I can verify at least for a typical TestFlight / iOS build scenario, there is no regression

Thanks for your continued effort in this area, looking forward to ruby 3 support when it's ready 馃槂

@ainame
Copy link
Contributor Author

ainame commented May 10, 2021

@mikehardy Thank you for giving it a try. Your feedback using my branch with real-world Fastfile is very important to me. Glad to hear it worked馃槃

@ainame
Copy link
Contributor Author

ainame commented May 14, 2021

Hello, there馃憢 It's going to be released tommorrow!
Thank you for waiting for Ruby 3.0 patiently.
https://twitter.com/joshdholtz/status/1393019142119231494?s=21

@ainame
Copy link
Contributor Author

ainame commented May 14, 2021

It's released! 馃帀 I'll leave this issue open for a while to gather further feedback regarding Ruby 3.0.
https://github.com/fastlane/fastlane/releases/tag/2.183.0

Note that there is a known issue where rdoc v6.3.1 causes fastlane's installation failure. You can work around it by either using bundler + Gemfile or --no-doc flag.
#18642

@ainame ainame changed the title 馃摚 Plan for Ruby 3.0 support 馃摚 Plan for Ruby 3.0 support (Released!) May 14, 2021
@ainame
Copy link
Contributor Author

ainame commented May 17, 2021

This issue might be related to the last change
#18698

Issues in supply were resolved now

@ainame
Copy link
Contributor Author

ainame commented Jun 5, 2021

There will be a breaking change in Ruby 3.1.0 due to psych bumped to v4.0.0, which has a breaking change for fastlane.
https://github.com/ruby/ruby/blob/3208a5df2dfb429752a130a36274464e9924cf44/ext/psych/lib/psych/versions.rb#L5

It's reported here #18768

psych is a default gem bundled in Ruby itself. You can update the version if you want. The latest release was a major version bump and included the breaking change that affects http-cookie gem that fastlane depends on internally.

I'll submit a PR to http-cookie repo to resolve the actual cause of the issue.

@ainame
Copy link
Contributor Author

ainame commented Jun 5, 2021

This will also be broken with psych v4.0. We need to use keyword arguments for YAML.safe_load

cookies = YAML.safe_load(
itc_cookie_content,
[HTTP::Cookie, Time], # classes allowlist
[], # symbols allowlist
true # allow YAML aliases
)

@ainame
Copy link
Contributor Author

ainame commented Jun 8, 2021

It's been a while since released. I'm going to close this ticket.
Going forward, I'm planning to add CI checks against Ruby head in order to find issues like the above ahead.

@ainame ainame closed this as completed Jun 8, 2021
@fastlane fastlane locked and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants