Skip to content

Commit

Permalink
Merge pull request #458 from Shopify/refactor-ci-gemfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sambostock authored Feb 2, 2024
2 parents 4b310bd + 7222306 commit 7f84db3
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 62 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} | Gemfile ${{ matrix.gemfile }}
continue-on-error: ${{ matrix.gemfile == 'rails_edge' }}
name: Ruby ${{ matrix.ruby }} | Rails ${{ matrix.rails }} | Gemfile ${{ matrix.gemfile }}
continue-on-error: ${{ matrix.rails == 'edge' }}
services:
redis:
image: redis
Expand All @@ -15,46 +15,49 @@ jobs:
strategy:
matrix:
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
gemfile: [rails_5_2, rails_6_0, rails_6_1, rails_7_0, rails_7_1, rails_edge]
rails: ["5.2", "6.0", "6.1", "7.0", "7.1", "edge"]
gemfile: [rails_gems]
exclude:
- ruby: "2.6"
gemfile: rails_7_0
rails: "7.0"
- ruby: "2.6"
gemfile: rails_7_1
rails: "7.1"
- ruby: "2.6"
gemfile: rails_edge
rails: "edge"
- ruby: "2.7"
gemfile: rails_7_1
rails: "7.1"
- ruby: "2.7"
gemfile: rails_edge
rails: "edge"
- ruby: "3.0"
gemfile: rails_5_2
rails: "5.2"
- ruby: "3.0"
gemfile: rails_7_1
rails: "7.1"
- ruby: "3.0"
gemfile: rails_edge
rails: "edge"
- ruby: "3.1"
gemfile: rails_5_2
rails: "5.2"
- ruby: "3.1"
gemfile: rails_6_0
rails: "6.0"
- ruby: "3.2"
gemfile: rails_5_2
rails: "5.2"
- ruby: "3.2"
gemfile: rails_6_0
rails: "6.0"
- ruby: "3.2"
gemfile: rails_6_1
rails: "6.1"
- ruby: "3.3"
gemfile: rails_5_2
rails: "5.2"
- ruby: "3.3"
gemfile: rails_6_0
rails: "6.0"
- ruby: "3.3"
gemfile: rails_6_1
rails: "6.1"

include:
- ruby: head
gemfile: rails_edge
rails: "edge"
gemfile: rails_gems
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
RAILS_VERSION: ${{ matrix.rails }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
inherit_gem:
rubocop-shopify: rubocop.yml

inherit_mode:
merge:
- Include

AllCops:
TargetRubyVersion: 2.6
Exclude:
- "vendor/bundle/**/*"
Include:
- '**/*.gemfile'
Lint/SuppressedException:
Exclude:
- lib/job-iteration.rb
Expand All @@ -14,7 +18,3 @@ Style/GlobalVars:
Naming/FileName:
Exclude:
- lib/job-iteration.rb
Style/MethodCallWithArgsParentheses:
Exclude:
- "gemfiles/*"
- Gemfile
5 changes: 0 additions & 5 deletions gemfiles/rails_5_2.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_6_0.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions gemfiles/rails_6_1.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_7_0.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_7_1.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_edge.gemfile

This file was deleted.

18 changes: 18 additions & 0 deletions gemfiles/rails_gems.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

rails_version = ENV.fetch("RAILS_VERSION")
@rails_gems_requirements = case rails_version
when "edge" then { github: "rails/rails", branch: "main" }
when /\A\d+\.\d+\z/ then "~> #{rails_version}.0"
else raise "Unsupported RAILS_VERSION: #{rails_version}"
end

eval_gemfile "../Gemfile"

# https://github.com/rails/rails/pull/44083
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1") &&
rails_version != "edge" && Gem::Version.new(rails_version) < Gem::Version.new("7")
gem "net-imap", require: false
gem "net-pop", require: false
gem "net-smtp", require: false
end

0 comments on commit 7f84db3

Please sign in to comment.