Upgrade to ruby3(.1.2)
(dall-e: "high quality photograph of a rocket made out of rubies flying into space")
For $REASONS we want to get off the ruby 2.* 🚂 and get rolling on the ruby 3.* 🚄 .
We know that we are going to see headaches with the contracts gem, which bifurcates versions based on ruby version (to wit, contracts version 0.16.0 supports ruby2, while contracts version 0.17.0 supports ruby3).
We don't know what other headaches we might run into, so we'll explore that here. ~~We also don't know whether we will be able to, or want to, or whatever, support both ruby2 and ruby3 seamlessly, or via multiple Gemfile/gemspec situations, etc. We'll just have to see.~~.
Actually, this now works for both ruby v2 and ruby v3, and all CI suites have been updated to run a matrix of ruby versions.
the work
- [x] set
.ruby-versionto3.1.2 - [x] re-bundle all the things
- [x] upgrade
rubocop.ymltarget ruby version - [x] acceptance testing Dockerfile
- [x]
FROM ruby:3.1-slim - [x]
RUN apt-get update && apt-get install -y make gcc - [x]
ruggedis not building, make sure we have all the right deps - [x] acceptance tests require
ping - [x] acceptance tests require
git
- [x]
- [x] update github workflows for lint and test to use ruby 3.1.2
- [x] pull in contracts v0.17.0;
bundle install - [x] get ruby-setup happy in our GH workflow files:
Unknown version 3.1.2 for ruby on ubuntu-20.04 - [x] get tests happy
- [x] rubocop:
- [x] a zillion warnings about: "Style/HashSyntax: Omit the hash value."
- [x] rspec:
- [x] 14 failures that appear to be
contractsissues- [x] todo: update
contracts-rspecmonkey-patch to handle the ruby3 version of contracts in our mocks
- [x] todo: update
- [x] 1 other failure that might also be a contracts issue
- [x] 14 failures that appear to be
- [x] acceptance:
- [x] there are many warnings about Erb
- [x] there appear to be some
Psychrelated failures - [x] 1 failure at ./spec/acceptance/tests/25_lockout_spec.rb:11 where we get a false instead of true
- [x] 2
new_with_cachefailures triggering contracts (returning{}instead of the expectednil) - [x] 2 failures where we appear to be returning different ldap results than expected
- [x] rubocop:
- [x] bring in gem release automation from #9
- [x] resolve conflicts
- [x] update ruby version to
~> 3.0 - [x] make sure we're still green 🟢
- [x] update
VERSIONfor full gem release- [x] re-bundle
- [x] ruby2 + ruby3 compatibility
- [x] add predicates for ruby2 / ruby3 compatibility
- [x] use predicates to make our few library changes multi-version compatible
- [x] make sure we don't get hit by simplecov for having library code that conditionalizes on ruby version
- [x] vendor ruby-specific versions of contracts.ruby into
lib/and load the proper one on use
- [x] refactor ruby version checks into a common
liblibrary that everyone can use, instead of multiple declarations - [x] update CI to run tests against ruby 2.7.5 and ruby 3.1.2 automatically
- [x]
lintsuite (rubocop) (:question:)- [x] make matrix
- [x] update required status checks
- [x]
testsuite (rspec)- [x] make matrix
- [x] update required status checks
- [x] get all current CI steps green 🟢
- [x] contracts superclass problem in acceptance suite
- [x] acceptance suite
- [x] update the CI matrix
- [x] make sure we're using ruby-version-specific Dockerfiles for each version (:question:)
- [x] update required status checks
- [x]
- [ ] integrate with internal libraries to stress test
references:
- https://github.com/github/entitlements-app/pull/7
cc @github/entitlements-reviewers