diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 101416c0..ec9703dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ name: CI on: - - push - pull_request permissions: @@ -10,19 +9,29 @@ permissions: jobs: rspec: - runs-on: ubuntu-20.04 + name: ${{ format('rspec ({0})', matrix.ruby) }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: ruby: - - '3.3' - - '3.2' - - '3.1' - - '3.0' - - '2.7' - - '2.6' - - '2.5' - - '2.4' + - 3.3 + - 3.2 + - 3.1 + rails: + - 7.0 # TODO: move to 7.2 + include: + # Edge + - { ruby: 'head', rails: 'edge', allow-fail: true } + # Outdated + - { ruby: '3.0', rails: '7.1', allow-fail: true } + - { ruby: '2.7', rails: '6', allow-fail: true } # RSpec AR Expectations support Rails 7.1 since Ruby 3.0 + - { ruby: '2.6', rails: '6', allow-fail: true } + - { ruby: '2.5', rails: '6', allow-fail: true } + - { ruby: '2.4', rails: '5', allow-fail: true } + + env: + RAILS_VERSION: "${{ matrix.rails }}" services: mongodb: @@ -31,13 +40,13 @@ jobs: - 27017:27017 steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + rubygems: latest bundler-cache: true - name: RSpec & publish code coverage @@ -46,3 +55,4 @@ jobs: CC_TEST_REPORTER_ID: b7ba588af2a540fa96c267b3655a2afe31ea29976dc25905a668dd28d5e88915 with: coverageCommand: bin/rake + continue-on-error: ${{ matrix.allow-fail }} diff --git a/Gemfile b/Gemfile index f9458e44..3ac032be 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,11 @@ source "https://rubygems.org" gemspec +gem 'puma' + platforms :ruby do if RUBY_VERSION >= "2.5.0" - gem 'sqlite3', '~> 1.4' + gem 'sqlite3' else gem 'sqlite3', '~> 1.3.6' end @@ -15,32 +17,27 @@ platforms :jruby do gem "activerecord-jdbcsqlite3-adapter" end -if RUBY_VERSION >= "2.6.0" - gem "turbo-rails" - gem "redis", "~> 4.0" -end +gem 'mongoid' -if RUBY_VERSION >= "2.5.0" - gem "rails", "~> 6.0" - gem 'webrick' +case rails_version = ENV['RAILS_VERSION'] +when nil + gem 'rails' +when 'edge' + gem 'rails', github: 'rails/rails' else - gem "rails", "~> 5.0" + gem 'rails', "~> #{rails_version}.0" end -if RUBY_VERSION >= "2.7.0" - gem "mongoid", github: "mongodb/mongoid" -elsif RUBY_VERSION >= "2.6.0" - gem "mongoid", "~> 8.1" -else - gem "mongoid", "~> 7.2" -end - -if RUBY_VERSION >= "3.1.0" - gem "net-imap" - gem "net-pop" - gem "net-smtp" +case RUBY_VERSION +when '2.6'...'3.0' + gem "turbo-rails", "<= 2.0.7" + gem "redis", "~> 4.0" +when '3.0'...'4' + gem 'turbo-rails' + gem 'redis' end if RUBY_VERSION < "2.5.0" + gem 'rspec-activerecord-expectations', '~> 1.2.0' gem "loofah", "< 2.21.0" # Workaround for `uninitialized constant Nokogiri::HTML4` end diff --git a/draper.gemspec b/draper.gemspec index ddf19c23..bf1d6d52 100644 --- a/draper.gemspec +++ b/draper.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'ammeter' s.add_development_dependency 'rake' s.add_development_dependency 'rspec-rails' - s.add_development_dependency 'rspec-activerecord-expectations', '~> 1.2.0' + s.add_development_dependency 'rspec-activerecord-expectations' s.add_development_dependency 'minitest-rails' s.add_development_dependency 'capybara' s.add_development_dependency 'active_model_serializers', '>= 0.10'