-
Notifications
You must be signed in to change notification settings - Fork 131
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
Run CI against minimum supported Sorbet version #1252
Open
sambostock
wants to merge
4
commits into
main
Choose a base branch
from
ci-sorbet-compatibility
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
source("https://rubygems.org") | ||
gem("rails", "~> 6.1.0", require: false) | ||
@specified_rails = true | ||
|
||
gemspec path: ".." | ||
|
||
gem("minitest") | ||
gem("minitest-hooks") | ||
gem("minitest-reporters") | ||
gem("pry-byebug") | ||
gem("rubocop-shopify", require: false) | ||
gem("rubocop-sorbet", ">= 0.4.1") | ||
gem("rubocop-rspec", require: false) | ||
gem("ruby-lsp", require: false) | ||
|
||
group(:deployment, :development) do | ||
gem("rake") | ||
end | ||
|
||
group(:development, :test) do | ||
gem("smart_properties", require: false) | ||
gem("frozen_record", require: false) | ||
gem("sprockets", require: false) | ||
gem("rails", "~> 6.1.0", require: false) | ||
gem("state_machines", require: false) | ||
gem("activerecord-typedstore", require: false) | ||
gem("sqlite3") | ||
gem("identity_cache", require: false) | ||
gem( | ||
"cityhash", | ||
git: "https://github.com/csfrancis/cityhash.git", | ||
ref: "3cfc7d01f333c01811d5e834f1495eaa29f87c36", | ||
require: false | ||
) | ||
gem("activeresource", require: false) | ||
gem("google-protobuf", require: false) | ||
gem("graphql", require: false) | ||
gem("shopify-money", require: false) | ||
gem("sidekiq", require: false) | ||
gem("nokogiri", require: false) | ||
gem("config", github: "rubyconfig/config", branch: "master", require: false) | ||
gem("aasm", require: false) | ||
gem("bcrypt", require: false) | ||
gem("xpath", require: false) | ||
|
||
# net-smtp was removed from default gems in Ruby 3.1, but is used by the `mail` gem. | ||
# So we need to add it as a dependency until `mail` is fixed: | ||
# https://github.com/rails/rails/blob/0919aa97260ab8240150278d3b07a1547489e3fd/Gemfile#L178-L191 | ||
gem("net-smtp", "0.3.1", require: false) | ||
end | ||
|
||
group :test do | ||
gem("webmock") | ||
end | ||
|
||
gem "kramdown", "~> 2.4" | ||
eval_gemfile "../Gemfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
source("https://rubygems.org") | ||
gem("rails", github: "rails/rails", branch: "main", require: false) | ||
@specified_rails = true | ||
|
||
gemspec path: ".." | ||
|
||
gem("minitest") | ||
gem("minitest-hooks") | ||
gem("minitest-reporters") | ||
gem("pry-byebug") | ||
gem("rubocop-shopify", require: false) | ||
gem("rubocop-sorbet", ">= 0.4.1") | ||
gem("rubocop-rspec", require: false) | ||
gem("ruby-lsp", require: false) | ||
|
||
group(:deployment, :development) do | ||
gem("rake") | ||
end | ||
|
||
group(:development, :test) do | ||
gem("smart_properties", require: false) | ||
gem("frozen_record", require: false) | ||
gem("sprockets", require: false) | ||
gem("rails", github: "rails/rails", branch: "main", require: false) | ||
gem("state_machines", require: false) | ||
gem("activerecord-typedstore", require: false) | ||
gem("sqlite3") | ||
gem("identity_cache", require: false) | ||
gem( | ||
"cityhash", | ||
git: "https://github.com/csfrancis/cityhash.git", | ||
ref: "3cfc7d01f333c01811d5e834f1495eaa29f87c36", | ||
require: false | ||
) | ||
gem("activeresource", require: false) | ||
gem("google-protobuf", require: false) | ||
gem("graphql", require: false) | ||
gem("shopify-money", require: false) | ||
gem("sidekiq", require: false) | ||
gem("nokogiri", require: false) | ||
gem("config", github: "rubyconfig/config", branch: "master", require: false) | ||
gem("aasm", require: false) | ||
gem("bcrypt", require: false) | ||
gem("xpath", require: false) | ||
|
||
# net-smtp was removed from default gems in Ruby 3.1, but is used by the `mail` gem. | ||
# So we need to add it as a dependency until `mail` is fixed: | ||
# https://github.com/rails/rails/blob/0919aa97260ab8240150278d3b07a1547489e3fd/Gemfile#L178-L191 | ||
gem("net-smtp", "0.3.1", require: false) | ||
end | ||
|
||
group :test do | ||
gem("webmock") | ||
end | ||
|
||
gem "kramdown", "~> 2.4" | ||
eval_gemfile "../Gemfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# Extract minimum supported version from gemspec | ||
minimum_sorbet_version = File.read("tapioca.gemspec")[ | ||
# spec.add_dependency("sorbet-static-and-runtime", ">= 1.2.3456") | ||
# ^^^^^^^^ | ||
/"sorbet-static-and-runtime", ">= ([^"]+)"/, | ||
1, | ||
] | ||
|
||
gem("sorbet-static-and-runtime", minimum_sorbet_version) | ||
|
||
eval_gemfile "../Gemfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not convinced on the need to pollute the default Gemfile just for the sake of avoiding duplication in the gemfiles used for tests.
What do you think about creating an ERB template for the test gemfiles that could be parameterized based on the Rails version we want to test and the sorbet version parsed from the gemspec?
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 thing is that if we do that, we still end up duplicating the rest of the Gemfile, which leads to it becoming out of sync (as it currently is on
main
).I based this approach off the approach taken by Shopify/maintenance_tasks, although I used instance variables differently due to differences in the arguments to
gem
(specifically, the presence ofrequire: false
).Specifically with regards to using a template, that would mean we'd have to have a step in CI that renders the template before
bundle install
reads it, but that would necessarily mean doing it before installing any gems, which might be problematic.Honestly, the cleanest solution would be if we were able to do something like
But AFAIK Bundler doesn't support anything like that.
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.
IMO removing that duplication (and the chance for them to get out of sync) justifies the change here.
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.
Not saying this is better, but in this project I use env var to control which version to use (from Rails 5 to main).
Pros:
Cons: