diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec46b389..476f87eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/.rubocop.yml b/.rubocop.yml index 0a890404..557b9b51 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 @@ -14,7 +18,3 @@ Style/GlobalVars: Naming/FileName: Exclude: - lib/job-iteration.rb -Style/MethodCallWithArgsParentheses: - Exclude: - - "gemfiles/*" - - Gemfile diff --git a/gemfiles/rails_5_2.gemfile b/gemfiles/rails_5_2.gemfile deleted file mode 100644 index 20aa12b5..00000000 --- a/gemfiles/rails_5_2.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = "~> 5.2.0" - -eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile deleted file mode 100644 index f6f0ee3a..00000000 --- a/gemfiles/rails_6_0.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = "~> 6.0.0" - -eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile deleted file mode 100644 index 1e299552..00000000 --- a/gemfiles/rails_6_1.gemfile +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = "~> 6.1.0" - -eval_gemfile "../Gemfile" - -if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("3.1") - gem "net-imap", require: false - gem "net-pop", require: false - gem "net-smtp", require: false -end diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile deleted file mode 100644 index 89808c81..00000000 --- a/gemfiles/rails_7_0.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = "~> 7.0.0" - -eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile deleted file mode 100644 index 7eded52f..00000000 --- a/gemfiles/rails_7_1.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = "~> 7.1.0" - -eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_edge.gemfile b/gemfiles/rails_edge.gemfile deleted file mode 100644 index eabf1c86..00000000 --- a/gemfiles/rails_edge.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -@rails_gems_requirements = { github: "rails/rails", branch: "main" } - -eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_gems.gemfile b/gemfiles/rails_gems.gemfile new file mode 100644 index 00000000..b1de2792 --- /dev/null +++ b/gemfiles/rails_gems.gemfile @@ -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