Skip to content

Drop CI support for Ruby < 2.3 #259

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member Author

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.

end

desc "Updates the CI files and creates a PR"
Expand Down
6 changes: 2 additions & 4 deletions ci/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
pull_request:
branches:
- '*'
env:
RSPEC_CI: true
Copy link
Member Author

Choose a reason for hiding this comment

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

jobs:
test:
name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
Expand All @@ -21,8 +23,6 @@ jobs:
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1.9
- ruby-head
env:
-
Expand Down Expand Up @@ -69,8 +69,6 @@ jobs:
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1.9
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand Down
32 changes: 0 additions & 32 deletions ci/.travis.yml

This file was deleted.

7 changes: 2 additions & 5 deletions ci/script/clone_all_rspec_repos
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

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.

clone_repo "rspec-support"
fi
clone_repo "rspec-rails" "main"
Copy link
Member Author

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.

clone_repo "rspec-support"

popd
else
Expand Down
29 changes: 15 additions & 14 deletions ci/script/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

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.

Copy link
Member Author

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.

# without the extra load time of rubygems. Only works on MRI Ruby 1.9+
if is_mri_192_plus; then
# without the extra load time of rubygems. Only works on MRI.
if is_mri; then
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"
Copy link
Member Author

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.

else
BRANCH_TO_CLONE="$2"
fi

travis_retry eval "git clone https://github.com/rspec/$1 --depth 1 --branch $BRANCH_TO_CLONE"
fi;
}

Expand Down Expand Up @@ -44,12 +50,7 @@ function run_cukes {

echo "${PWD}/bin/cucumber"

if is_mri_192; then
# For some reason we get SystemStackError on 1.9.2 when using
# the bin/cucumber approach below. That approach is faster
# (as it avoids the bundler tax), so we use it on rubies where we can.
bundle exec cucumber --strict
elif is_jruby; then
if is_jruby; then
# For some reason JRuby doesn't like our improved bundler setup
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
PATH="${PWD}/bin:$PATH" \
Expand Down Expand Up @@ -79,8 +80,11 @@ function run_spec_suite_for {
echo "Running specs for $1"
pushd ../$1
unset BUNDLE_GEMFILE
bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
bundle_install_flags="--binstubs --standalone --without documentation --path ../bundle"
travis_retry eval "(unset RUBYOPT; exec bundle install $bundle_install_flags)"
if [ $1 == rspec-rails ]; then
unset RUBYOPT
fi;
run_specs_and_record_done
popd
else
Expand Down Expand Up @@ -184,11 +188,8 @@ function run_all_spec_suites {
fold "rspec-core specs" run_spec_suite_for "rspec-core"
fold "rspec-expectations specs" run_spec_suite_for "rspec-expectations"
fold "rspec-mocks specs" run_spec_suite_for "rspec-mocks"
fold "rspec-support specs" run_spec_suite_for "rspec-support"
if rspec_rails_compatible; then
fold "rspec-rails specs" run_spec_suite_for "rspec-rails"
fi

if rspec_support_compatible; then
fold "rspec-support specs" run_spec_suite_for "rspec-support"
fi
}
64 changes: 5 additions & 59 deletions ci/script/predicate_functions.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,21 @@
function is_mri {
if ruby -e "exit(!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby')"; then
Copy link
Member

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.

# RUBY_ENGINE only returns 'ruby' on MRI.
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
# RUBY_ENGINE only returns 'ruby' on MRI.
if ruby -e "exit(RUBY_ENGINE == 'ruby')"; then
return 0
else
return 1
fi;
}

function is_jruby {
if ruby -e "exit(defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java')"; then
# RUBY_ENGINE only returns 'ruby' on MRI.
# MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode)
# RUBY_PLATFORM only returns 'java' on JRuby.
if ruby -e "exit(RUBY_PLATFORM == 'java')"; then
return 0
else
return 1
fi;
}

function is_mri_192 {
if is_mri; then
if ruby -e "exit(RUBY_VERSION == '1.9.2')"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_mri_192_plus {
if is_mri; then
if ruby -e "exit(RUBY_VERSION.to_f > 1.8)"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_mri_2plus {
if is_mri; then
if ruby -e "exit(RUBY_VERSION.to_f > 2.0)"; then
return 0
else
return 1
fi
else
return 1
fi
}

function is_ruby_23_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
return 0
else
return 1
fi
}

function is_ruby_25_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 2.5)"; then
return 0
Expand All @@ -78,22 +32,14 @@ function rspec_rails_compatible {
fi
}

function rspec_support_compatible {
if [ "$MAINTENANCE_BRANCH" != "2-99-maintenance" ] && [ "$MAINTENANCE_BRANCH" != "2-14-maintenance" ]; then
return 0
else
return 1
fi
}

function additional_specs_available {
type run_additional_specs > /dev/null 2>&1
return $?
}

function documentation_enforced {
if [ -x ./bin/yard ]; then
if is_mri_2plus; then
if is_mri; then
return 0
else
return 1
Expand Down
10 changes: 2 additions & 8 deletions ci/script/update_rubygems_and_install_bundler
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
set -e
source script/functions.sh

if is_ruby_23_plus; then
yes | gem update --system
yes | gem install bundler
else
echo "Warning installing older versions of Rubygems / Bundler"
gem update --system '2.7.8'
gem install bundler -v '1.17.3'
fi
yes | gem update --system
yes | gem install bundler
Copy link
Member

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.