-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Drop CI support for Ruby < 2.3 #259
Conversation
@JonRowe @benoittgt Please take a look. |
This comment has been minimized.
This comment has been minimized.
ci/.travis.yml
Outdated
matrix: | ||
include: | ||
- rvm: jruby-1.7 | ||
env: JRUBY_OPTS='--dev --1.8' | ||
- rvm: 2.7.1 |
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.
You can remove the diff lcs version builds too, and set the minimum diff lcs version.
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.
Should I use ">= 1.4.3", "< 2.0"
?
I'll make those changes separately.
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.
>= 1.4.4
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.
Can you just add it as a commit to the prs.
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.
Sure, but which one? 😄 I have those four generated from this PR, also those ones from which I've extracted these changes.
I plan to send a few more series:
- update rake to 13, and cucumber to 2.4 (broke my teeth trying to run 1.3 locally) <--- will add diff-lcs update here
- rethink
define_optimized_require_for_rspec
- fix kwargs delegation
- update JRuby to 9.1.17.0/ add JRuby 9.2
- get rid of most of the
<<-
/chomp
/unindent
/undent
/gsub
in favour of<<~
Do you have some suggestions for this plan?
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.
update rake to 13, and cucumber to 2.4 (broke my teeth trying to run 1.3 locally) <--- will add diff-lcs update here
Please just add diff-lcs to these PRs, any gem which mentions it in the gemspec just set the minimum version and remove the diff lcs builds.
*rethink
define_optimized_require_for_rspec
I want to keep this, it is a lot of churn just to remove a generated method.
fix kwargs delegation
We may find this is impossible due to the hash behaviour, I suspect we will need to keep ruby 2 keywords for quite some time.
get rid of most of the <<-/chomp/unindent/undent/gsub in favour of <<~
That can wait until later prs, its subjective please don't combine it into your mega PRs they are already too hard to review.
update JRuby to 9.1.17.0/ add JRuby 9.2
Do this seperatly as I'm also working on this for main
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 plan to send a few more series
I'd like to emphasize and elaborate on the above statement ☝️ to remove all the ambiguity.
I plan to send series (dev+support+core+mocks+expectations) of PRs for each of those changes separately.
After this current one is merged.
All against 4-0-dev
.
define_optimized_require_for_rspec
I want to keep this
👍
Please just add diff-lcs to these PRs, any gem which mentions it in the gemspec just set the minimum version and remove the diff lcs builds.
Will do in a follow-up 👍
fix kwargs delegation
this is impossible due to the hash behaviour, I suspect we will need to keep ruby 2 keywords for quite some time.
That's is the plan, to use ruby2_keywords
, there's no other way around. I intend to use this comment as the guideline.
@@ -9,14 +9,20 @@ SPECS_HAVE_RUN_FILE=specs.out | |||
MAINTENANCE_BRANCH=`cat maintenance-branch` | |||
|
|||
# Don't allow rubygems to pollute what's loaded. Also, things boot faster |
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.
Can we revert all these changes for now, it makes diffing harder and its easy to clean up post release.
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.
With an exception of BRANCH_TO_CLONE
trick, we can. But we equally can just set s.required_ruby_version = '>= 2.3.0'
and clean everything else after the release 😆
Jokes aside, rspec-mock
has undertaken the smallest change, just +360 −880 of all repos. Not much compared to +45 -145 induced by this update.
All of the changes to ci/script/functions.sh
and ci/script/predicate_functions.sh
consist of removals and simple changes a-la is_mri_2plus
-> is_mri
. That can be skimmed through really quickly during the review (of the total 4-0-dev
-> main
merge I suppose).
Except for the BRANCH_TO_CLONE
trick that is in rspec-*
repos' 4-0-dev
, but not on main
, and not here, in rspec-dev
anywhere. I've added it to this PR to avoid it being overwritten with rake ci:update_files
next time we update 4-0-dev
.
@@ -1,67 +1,21 @@ | |||
function is_mri { | |||
if ruby -e "exit(!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby')"; then |
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.
Can we revert all these changes for now, it makes diffing harder and its easy to clean up post release.
gem install bundler -v '1.17.3' | ||
fi | ||
yes | gem update --system | ||
yes | gem install bundler |
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.
Can we revert all these changes for now, it makes diffing harder and its easy to clean up post release.
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.
Hi @pirj good work here, just some changes to drop more builds and a request to revert some changes for easy of diffing until after release
I would leave this PR hanging until we release 4.0. To sum it up, it feels like a lot of extra work upfront, and also re-doing of the same removals I've done here at a later point in time. I don't feel too enthusiastic about doing that that compared to the overhead of reviewing this. |
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.
Some notes to the future self.
@@ -8,6 +8,8 @@ on: | |||
pull_request: | |||
branches: | |||
- '*' | |||
env: | |||
RSPEC_CI: true |
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.
Forces rspec-rails
to depend on 4.0.0.pre
. See https://github.com/rspec/rspec-rails/blob/934276b0e12b21ad44bac54494c42f5a93e08a33/rspec-rails.gemspec#L48
@@ -383,7 +383,8 @@ namespace :ci do | |||
|
|||
desc "Update build files" | |||
task :update_files do | |||
update_ci_files_in_repos | |||
opts = { except: %w[ rspec-rails ] } | |||
update_ci_files_in_repos(opts) |
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.
Do not send CI file updates to rspec-rails
.
@@ -9,11 +9,8 @@ if is_mri; then | |||
clone_repo "rspec-core" | |||
clone_repo "rspec-expectations" | |||
clone_repo "rspec-mocks" | |||
clone_repo "rspec-rails" | |||
|
|||
if rspec_support_compatible; then |
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.
All builds are rspec-support compatible.
if rspec_support_compatible; then | ||
clone_repo "rspec-support" | ||
fi | ||
clone_repo "rspec-rails" "main" |
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 all builds (Ruby 2.3, Ruby 2.4) builds are rspec-rails
compatible.
It's an unnecessary step to check it out for those builds, but I'll leave this improvement for later.
export RUBYOPT="--disable=gem" | ||
fi | ||
|
||
function clone_repo { | ||
if [ ! -d $1 ]; then # don't clone if the dir is already there | ||
travis_retry eval "git clone https://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH" | ||
if [ -z "$2" ]; then | ||
BRANCH_TO_CLONE="$MAINTENANCE_BRANCH" |
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.
Because rspec-rails
is alienated from other repos, there's no 4-0-dev
branch there, and we clone main
.
ci/.travis.yml
Outdated
env: | ||
- JRUBY_OPTS='--dev' | ||
- RSPEC_CI='true' |
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.
You don't need this, its only used by Github to recognise windows CI.
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.
As far as I remember, rspec-rails
sub-build breaks with #259 (comment)
I'd rather keep this line since probably we'll get rid of this file altogether soon anyway.
ci/.travis.yml
Outdated
@@ -12,29 +12,14 @@ before_install: | |||
bundler_args: "--binstubs --standalone --without documentation --path ../bundle" |
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.
To be honest you can delete this file, we won't be using it after the release of RSpec 4, and Jruby is being worked on elsewhere.
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 could, but
rspec-dev/ci/script/functions.sh
Line 82 in d27313d
bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"` |
bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
I tried to keep this PR focused to its title, "Drop CI support for Ruby < 2.3", not to upset code reviewers 😄
Ok to adjust ci/script/functions.sh
and inline those bundler flags? They don't differ across repos "--binstubs --standalone --without documentation --path ../bundle"
.
I'd rather keep .travis.yml
for now if you don't mind. Because some specs pass on all MRIs, but fail on JRuby on CI. And if my memory doesn't let me down, I couldn't reproduce them locally.
Again, .travis.yml
will be removed soon anyway?
I'll provide a short summary of what we've been discussing above in the comments.
@JonRowe Do you want me to squeeze in some of the above changes in this PR, or ok with addressing in follow-ups? |
1. Clone rspec-rails' main branch for sub-builds 2. Trick rspec-rails' sub-builds into using 4.0.0.pre ============= Starting rspec-rails specs =============== Running specs for rspec-rails ~/work/rspec-mocks/rspec-rails ~/work/rspec-mocks/rspec-mocks Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Bundler could not find compatible versions for gem "rspec-core": In Gemfile: rspec-core rspec-rails was resolved to 4.1.0.pre, which depends on rspec-core (= 3.11.0.pre) Could not find gem 'rspec-core (= 3.11.0.pre)', which is required by gem 'rspec-rails', in any of the relevant sources: source at `/home/runner/work/rspec-mocks/rspec-core`
Rebased 4-0-dev on I'll send generated pulls when rspec/rspec-core#2785 is green - |
Rails do use Gem in rails/railties/lib/rails/ruby_version_check.rb if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5.0") and obviously since RubyGems are loaded by default by recent rubies, it doesn't care to explicitly require it. That results in: /home/runner/work/rspec-expectations/rspec-rails/bin/rspec An error occurred while loading spec_helper. Failure/Error: require 'rails/all' NameError: uninitialized constant Gem # /home/runner/work/rspec-expectations/bundle/ruby/2.5.0/gems/railties-6.0.3.4/lib/rails/ruby_version_check.rb:3:in `<top (required)>' # /home/runner/work/rspec-expectations/bundle/ruby/2.5.0/gems/railties-6.0.3.4/lib/rails.rb:3:in `require'
Extracted from:
Repo PRs:
NOT DONE (mostly JRuby-related, saved for a subsequent iteration):
continue-on-error: ${{ matrix.ruby == 'jruby-9.2.13.0' || endsWith(matrix.ruby, 'head') }}
ci.yml
(bumps 9.1.7.0 to 9.1.17.0)bundler: ${{ (matrix.ruby == 'jruby-9.1.17.0' && 1) || 2 }}
# For some reason JRuby doesn't like our improved bundler setup
yes | gem update --system --no-document
- JRuby fails to install docs sometimesyes | gem install bundler --no-document
function documentation_enforced {
/if is_mri; then