entitlements-app icon indicating copy to clipboard operation
entitlements-app copied to clipboard

Upgrade to ruby3(.1.2)

Open rick opened this issue 3 years ago • 0 comments

DALL·E 2022-08-02 16 07 07 - high quality photograph of a rocket made out of rubies flying into space (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-version to 3.1.2
  • [x] re-bundle all the things
  • [x] upgrade rubocop.yml target ruby version
  • [x] acceptance testing Dockerfile
    • [x] FROM ruby:3.1-slim
    • [x] RUN apt-get update && apt-get install -y make gcc
    • [x] rugged is not building, make sure we have all the right deps
    • [x] acceptance tests require ping
    • [x] acceptance tests require git
  • [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 contracts issues
        • [x] todo: update contracts-rspec monkey-patch to handle the ruby3 version of contracts in our mocks
      • [x] 1 other failure that might also be a contracts issue
    • [x] acceptance:
      • [x] there are many warnings about Erb
      • [x] there appear to be some Psych related 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_cache failures triggering contracts (returning {} instead of the expected nil)
      • [x] 2 failures where we appear to be returning different ldap results than expected
  • [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 VERSION for 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 lib library 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] lint suite (rubocop) (:question:)
      • [x] make matrix
      • [x] update required status checks
    • [x] test suite (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
  • [ ] integrate with internal libraries to stress test

references:

  • https://github.com/github/entitlements-app/pull/7

cc @github/entitlements-reviewers

rick avatar Aug 02 '22 21:08 rick