From 1a1ff3dbc0b447a7de66931b41da4a30afd74145 Mon Sep 17 00:00:00 2001 From: Arne De Herdt Date: Tue, 13 Sep 2022 13:40:57 +0200 Subject: [PATCH] [CIOPS-1051] Add support for all known Ruby and Rails versions This pull request updates the supported Ruby and Rails versions, allowing us to increase the coverage of supported frameworks and ensure changes do not break under specific releases. --- .circleci/config.yml | 245 +++++++++++++++++++++++++++++++++++++--- .github/CODEOWNERS | 1 + .github/dependabot.yml | 15 +++ Appraisals | 59 ++++++++-- CHANGELOG.md | 3 + README.md | 5 + is_it_up.gemspec | 2 +- lib/is_it_up/version.rb | 2 +- 8 files changed, 302 insertions(+), 30 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/dependabot.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d5e0d4..4307422 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,12 @@ --- +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Snippets +# +# Reusable snippets are defined below this section. These are yaml fragments that can injected into the standard +# CircleCI configuration, reducing the complexity of the entire block. +# --------------------------------------------------------------------------------------------------------------------- +version: 2.1 + # --------------------------------------------------------------------------------------------------------------------- # CircleCI Commands Configuration # @@ -6,10 +14,9 @@ # waiting on a database connection. By defining them inside the commands section, they can be invoked as any standard # command on the system, but will already be preconfigured. This allows us to keep the jobs definition small and clean # --------------------------------------------------------------------------------------------------------------------- -version: 2.1 commands: appraisal_install: - description: "Performs the installation with Appraisal" + description: "Performs the bundler installation, relying on the CircleCI cache for performance" parameters: ruby-version: type: string @@ -43,7 +50,7 @@ jobs: gemfile: type: string docker: - - image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/base-ruby:<< parameters.ruby-version >>-v5.5 + - image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-<< parameters.ruby-version >> user: root aws_auth: aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID} @@ -51,7 +58,6 @@ jobs: environment: RAILS_ENV: test RACK_ENV: test - working_directory: "/app" steps: - checkout - appraisal_install: @@ -65,6 +71,29 @@ jobs: path: ./test/reports - store_artifacts: path: ./test/reports + build_and_publish: + docker: + - image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-3.0 + aws_auth: + aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID} + aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY} + user: root + steps: + - checkout + - run: + name: "Configure Rubygems" + command: | + mkdir ~/.gem + touch ~/.gem/credentials + echo "---" >> ~/.gem/credentials + echo ":github: Bearer $CINK_CIRCLE_CI_GITHUB_PACKAGES_TOKEN" >> ~/.gem/credentials + chmod 600 ~/.gem/credentials + - run: + name: "Gem build" + command: gem build is_it_up.gemspec + - run: + name: "Gem Push" + command: gem push --key github --host https://rubygems.pkg.github.com/customink is_it_up-*.gem # --------------------------------------------------------------------------------------------------------------------- # CircleCI Workflow Execution Order @@ -76,28 +105,208 @@ workflows: version: 2.1 build-and-test: jobs: + # Ruby 2.2 + # + # This version allows us to use te following Rails versions: + # - 3.2.x + # - 4.0.x + # - 4.1.x + # - 5.0.x + # - 5.1.x + # - 5.2.x - tests: - name: "Ruby 2.6 Tests with Rails 5.0" - context: customink - gemfile: "rails5.0" - ruby-version: "2.6" + name: "Ruby 2.2 Tests with Rails 3.2" + context: "customink" + gemfile: "rails32" + ruby-version: "2.2" - tests: - name: "Ruby 2.6 Tests with Rails 5.1" - context: customink - gemfile: "rails5.1" - ruby-version: "2.6" + name: "Ruby 2.2 Tests with Rails 4.0" + context: "customink" + gemfile: "rails40" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 Tests with Rails 4.1" + context: "customink" + gemfile: "rails41" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 Tests with Rails 4.2" + context: "customink" + gemfile: "rails42" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 Tests with Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 Tests with Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 Tests with Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.2" + # Ruby 2.3 + # + # This version allows us to use the following Rails versions: + # - 5.0.x + # - 5.1.x + # - 5.2.x + - tests: + name: "Ruby 2.3 Tests with Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.3" + - tests: + name: "Ruby 2.3 Tests with Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.3" + - tests: + name: "Ruby 2.3 Tests with Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.3" + # Ruby 2.4 + # + # This version allows us to use the following Rails versions: + # - 5.0.x + # - 5.1.x + # - 5.2.x + - tests: + name: "Ruby 2.4 Tests with Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.4" + - tests: + name: "Ruby 2.4 Tests with Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.4" + - tests: + name: "Ruby 2.4 Tests with Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.4" + # Ruby 2.5 + # + # This version allows us to use the following Rails versions: + # - 5.1.x + # - 5.2.x + # - 6.0.x + # - 6.1.x + - tests: + name: "Ruby 2.5 Tests with Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 Tests with Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 Tests with Rails 6.0" + context: "customink" + gemfile: "rails60" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 Tests with Rails 6.1" + context: "customink" + gemfile: "rails61" + ruby-version: "2.5" + # Ruby 2.6 + # + # This version allows us to use the following Rails versions: + # - 5.2.x + # - 6.0.x + # - 6.1.x - tests: name: "Ruby 2.6 Tests with Rails 5.2" - context: customink - gemfile: "rails5.2" + context: "customink" + gemfile: "rails52" ruby-version: "2.6" - tests: name: "Ruby 2.6 Tests with Rails 6.0" - context: customink - gemfile: "rails6.0" + context: "customink" + gemfile: "rails60" ruby-version: "2.6" - tests: name: "Ruby 2.6 Tests with Rails 6.1" - context: customink - gemfile: "rails6.1" + context: "customink" + gemfile: "rails61" ruby-version: "2.6" + # Ruby 2.7 + # + # This version allows us to use the following Rails versions: + # - 6.0.x + # - 6.1.x + # - 7.0.0 + - tests: + name: "Ruby 2.7 Tests with Rails 6.0" + context: "customink" + gemfile: "rails60" + ruby-version: "2.7" + - tests: + name: "Ruby 2.7 Tests with Rails 6.1" + context: "customink" + gemfile: "rails61" + ruby-version: "2.7" + - tests: + name: "Ruby 2.7 Tests with Rails 7.0.0" + context: "customink" + gemfile: "rails7" + ruby-version: "2.7" + # Ruby 3.0 + # + # This version allows us to use the following Rails versions: + # - 7.0.0 + - tests: + name: "Ruby 3.0 Tests with Rails 7.0.0" + context: "customink" + gemfile: "rails7" + ruby-version: "3.0" + # Ruby 3.1 + # + # This version allows us to use the following Rails versions: + # - 7.0.x + - tests: + name: "Ruby 3.1 Tests with Rails 7.0.x" + context: "customink" + gemfile: "rails70" + ruby-version: "3.1" + - build_and_publish: + context: "customink" + requires: + - "Ruby 2.2 Tests with Rails 3.2" + - "Ruby 2.2 Tests with Rails 4.0" + - "Ruby 2.2 Tests with Rails 4.1" + - "Ruby 2.2 Tests with Rails 4.2" + - "Ruby 2.2 Tests with Rails 5.0" + - "Ruby 2.2 Tests with Rails 5.1" + - "Ruby 2.2 Tests with Rails 5.2" + - "Ruby 2.3 Tests with Rails 5.0" + - "Ruby 2.3 Tests with Rails 5.1" + - "Ruby 2.3 Tests with Rails 5.2" + - "Ruby 2.4 Tests with Rails 5.0" + - "Ruby 2.4 Tests with Rails 5.1" + - "Ruby 2.4 Tests with Rails 5.2" + - "Ruby 2.5 Tests with Rails 5.1" + - "Ruby 2.5 Tests with Rails 5.2" + - "Ruby 2.5 Tests with Rails 6.0" + - "Ruby 2.5 Tests with Rails 6.1" + - "Ruby 2.6 Tests with Rails 5.2" + - "Ruby 2.6 Tests with Rails 6.0" + - "Ruby 2.6 Tests with Rails 6.1" + - "Ruby 2.7 Tests with Rails 6.0" + - "Ruby 2.7 Tests with Rails 6.1" + - "Ruby 2.7 Tests with Rails 7.0.0" + - "Ruby 3.0 Tests with Rails 7.0.0" + - "Ruby 3.1 Tests with Rails 7.0.x" + filters: + branches: + only: + - master diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..5853d91 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @customink/developer-experience diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f0ceea1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +--- +version: 2 +updates: + - package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "03:00" + open-pull-requests-limit: 5 + labels: + - dependencies + - ruby + versioning-strategy: increase-if-necessary + commit-message: + prefix: "[Dependabot]" diff --git a/Appraisals b/Appraisals index dce333e..ec5ec8b 100644 --- a/Appraisals +++ b/Appraisals @@ -9,22 +9,61 @@ # a build. That feature does not exist in CircleCI, so to ensure that the # "bundle exec appraisal install" command works, # we exclude certain appraisals when the Ruby version doesn't match. -appraise 'rails5.0' do - gem 'rails', '~> 5.0.0' +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("2.3.0") + appraise 'rails32' do + gem 'rails', '~> 3.2.0' + gem 'rack-cache', '~> 1.2.0' + end + + appraise 'rails40' do + gem 'rails', '~> 4.0.0' + end + + appraise 'rails41' do + gem 'rails', '~> 4.1.0' + end + + appraise 'rails42' do + gem 'rails', '~> 4.2.0' + end +end + +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("2.5.0") + appraise 'rails50' do + gem 'rails', '~> 5.0.0' + end +end + +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("2.6.0") + appraise 'rails51' do + gem 'rails', '~> 5.1.0' + end end -appraise 'rails5.1' do - gem 'rails', '~> 5.1.0' +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("2.7.0") + appraise 'rails52' do + gem 'rails', '~> 5.2.0' + end end -appraise 'rails5.2' do - gem 'rails', '~> 5.2.0' +if ::Gem::Version.new(RUBY_VERSION) > ::Gem::Version.new("2.5.0") && ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("3.0.0") + appraise 'rails60' do + gem 'rails', '~> 6.0.0' + end + + appraise 'rails61' do + gem 'rails', '~> 6.1.0' + end end -appraise 'rails6.0' do - gem 'rails', '~> 6.0.0' +if ::Gem::Version.new(RUBY_VERSION) > ::Gem::Version.new("2.7.0") && ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new("3.1.0") + appraise 'rails7' do + gem 'rails', '7.0.0' + end end -appraise 'rails6.1' do - gem 'rails', '~> 6.1.0' +if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new("3.1.0") + appraise 'rails70' do + gem 'rails', '~> 7.0.0' + end end diff --git a/CHANGELOG.md b/CHANGELOG.md index b5aead1..49aaa1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # IsItUp Changelog +## 1.1.0 +- Added support for testing against all known Ruby and Rails versions + ## 1.0.0 - Added Appraisal for proper testing against various Rails versions - Updated documentation diff --git a/README.md b/README.md index a8c6c2c..945082b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ A Ruby gem that adds a simple endpoint to see if your application "is up". The endpoint is handled via Rack middleware. A Railtie is provided for integration with Ruby on Rails apps. +## Requirements + +* Ruby 2.2 or higher +* Ruby on Rails 3.2 or higher + ## Installation Add this line to your application's Gemfile: diff --git a/is_it_up.gemspec b/is_it_up.gemspec index bc105d7..834bfbc 100644 --- a/is_it_up.gemspec +++ b/is_it_up.gemspec @@ -22,6 +22,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rake" spec.add_development_dependency "json" spec.add_development_dependency "bundler" - spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency "minitest" spec.add_development_dependency "rails" end diff --git a/lib/is_it_up/version.rb b/lib/is_it_up/version.rb index dd5246d..bd65e9c 100644 --- a/lib/is_it_up/version.rb +++ b/lib/is_it_up/version.rb @@ -1,5 +1,5 @@ module IsItUp - VERSION = '1.0.0'.freeze + VERSION = '1.1.0'.freeze public_constant :VERSION end