Skip to content

Commit

Permalink
Merge pull request #8 from customink/coding-bunny/CIOPS-1051
Browse files Browse the repository at this point in the history
[CIOPS-1051] Add support for all known Ruby and Rails versions
  • Loading branch information
Arne De Herdt authored Sep 13, 2022
2 parents 2b66085 + 1a1ff3d commit ab8a4d4
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 30 deletions.
245 changes: 227 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
---
# ---------------------------------------------------------------------------------------------------------------------
# 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
#
# Commands are re-usable steps that can be shared across jobs. For example the installation of gems using bundler or
# 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
Expand Down Expand Up @@ -43,15 +50,14 @@ 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}
aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY}
environment:
RAILS_ENV: test
RACK_ENV: test
working_directory: "/app"
steps:
- checkout
- appraisal_install:
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @customink/developer-experience
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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]"
59 changes: 49 additions & 10 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit ab8a4d4

Please sign in to comment.