Fix Ruby installation (#41263)

Summary:
Starting from Monday, Ruby jobs using Xcode 14.1 started failing on PRs but not on main.
While CircleCI is investigating why this is happening, we found a way to make sure that we can install Ruby even when the cache misses.

## Changelog:
[Internal] - Make sure we can install ruby 3.2.0 when rbenv cache misses.

Pull Request resolved: https://github.com/facebook/react-native/pull/41263

Test Plan: CircleCI is green

Reviewed By: blakef

Differential Revision: D50885897

Pulled By: cipolleschi

fbshipit-source-id: 9a452fd24d779cc14c86c7a8a4e3bf8ec62d0ceb
This commit is contained in:
Riccardo Cipolleschi
2023-11-01 09:00:07 -07:00
committed by Facebook GitHub Bot
parent 0c0d02298e
commit 7e7fefd2c1
+8 -3
View File
@@ -46,9 +46,14 @@ commands:
echo "rbenv found; Skipping installation"
fi
brew reinstall libyaml
gem install psych -- --with-libyaml-dir=$(brew --prefix libyaml)
export RUBY_CONFIGURE_OPTS=--with-libyaml-dir=$(brew --prefix libyaml)
xcode=$(xcodebuild -version | cut -d' ' -f2 | head -n 1)
# For some reason, the Xcode 14.1 machnine is already properly configured.
if [[ $xcode != '14.1' ]]; then
brew reinstall libyaml
gem install psych -- --with-libyaml-dir=$(brew --prefix libyaml)
export RUBY_CONFIGURE_OPTS=--with-libyaml-dir=$(brew --prefix libyaml)
fi
# Install the right version of ruby
if [[ -z "$(rbenv versions | grep << parameters.ruby_version >>)" ]]; then