Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mongoid 9 #16

Merged
merged 21 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 50 additions & 60 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,66 @@ on: [push, pull_request]
jobs:
build:
name: >-
Mongoid ${{ matrix.entry.mongoid }} - Ruby ${{ matrix.entry.ruby }} - MongoDB ${{ matrix.entry.mongodb }}
Mongoid Test with: - Ruby ${{ matrix.entry.ruby }} - MongoDB ${{ matrix.entry.mongodb }} - Gemfile ${{ matrix.entry.gemfile }})
env:
CI: true
TESTOPTS: -v
TESTOPTS: "-v"
BUNDLE_GEMFILE: gemfiles/${{ matrix.entry.gemfile }}.gemfile
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
entry:
- { ruby: "2.1", mongoid: "3", bundler: "1", mongodb: "3.6" }
- { ruby: "2.1", mongoid: "4", bundler: "1", mongodb: "3.6" }
- { ruby: "2.2", mongoid: "4", bundler: "2", mongodb: "3.6" }
- { ruby: "2.2", mongoid: "5", bundler: "2", mongodb: "3.6" }
- { ruby: "2.3", mongoid: "5", bundler: "2", mongodb: "3.6" }
- { ruby: "2.4", mongoid: "6.1", bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", mongoid: "6.2", bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "3.6" }
- { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "3.6" }
- { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "3.6" }
- { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "3.6" }
- { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "3.6" }
- { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.0" }
- { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.0" }
- { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.0" }
- { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.0" }
- { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.0" }
- { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.0" }
- { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.2" }
- { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.2" }
- { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.2" }
- { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.2" }
- { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.2" }
- { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.2" }
- { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "4.4" }
- { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "4.4" }
- { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "4.4" }
- { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "4.4" }
- { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "4.4" }
- { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "4.4" }
- { ruby: "2.5", mongoid: "6.4", bundler: "2", mongodb: "5.0" }
- { ruby: "2.6", mongoid: "7.4", bundler: "2", mongodb: "5.0" }
- { ruby: "2.6", mongoid: "7.5", bundler: "2", mongodb: "5.0" }
- { ruby: "2.7", mongoid: "7.5", bundler: "2", mongodb: "5.0" }
- { ruby: "3.0", mongoid: "8.0", bundler: "2", mongodb: "5.0" }
- { ruby: "3.1", mongoid: "8.0", bundler: "2", mongodb: "5.0" }
- { ruby: "2.1", gemfile: 'mongoid_3', bundler: "1", mongodb: "3.6" }
- { ruby: "2.1", gemfile: 'mongoid_3', bundler: "1", mongodb: "3.6" }
- { ruby: "2.1", gemfile: 'mongoid_4', bundler: "1", mongodb: "3.6" }
- { ruby: "2.2", gemfile: 'mongoid_4', bundler: "2", mongodb: "3.6" }
- { ruby: "2.2", gemfile: 'mongoid_5', bundler: "2", mongodb: "3.6" }
- { ruby: "2.3", gemfile: 'mongoid_5', bundler: "2", mongodb: "3.6" }
- { ruby: "2.4", gemfile: 'mongoid_6', bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "3.6" }
- { ruby: "2.7", gemfile: 'mongoid_7', bundler: "2", mongodb: "3.6" }
- { ruby: "3.0", gemfile: 'mongoid_8', bundler: "2", mongodb: "3.6" }
- { ruby: "3.1", gemfile: 'mongoid_8', bundler: "2", mongodb: "3.6" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "4.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.0" }
- { ruby: "2.7", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.0" }
- { ruby: "3.0", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.0" }
- { ruby: "3.1", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.0" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "4.2" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.2" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.2" }
- { ruby: "2.7", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.2" }
- { ruby: "3.0", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.2" }
- { ruby: "3.1", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.2" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "4.4" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.4" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.4" }
- { ruby: "2.7", gemfile: 'mongoid_7', bundler: "2", mongodb: "4.4" }
- { ruby: "3.0", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.4" }
- { ruby: "3.1", gemfile: 'mongoid_8', bundler: "2", mongodb: "4.4" }
- { ruby: "2.5", gemfile: 'mongoid_6', bundler: "2", mongodb: "5.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "5.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', bundler: "2", mongodb: "5.0" }
- { ruby: "2.7", gemfile: 'mongoid_7', bundler: "2", mongodb: "5.0" }
- { ruby: "3.0", gemfile: 'mongoid_8', bundler: "2", mongodb: "5.0" }
- { ruby: "3.1", gemfile: 'mongoid_8', bundler: "2", mongodb: "5.0" }
- { ruby: "3.1", gemfile: 'mongoid_9', bundler: "2", mongodb: "5.0" }
steps:
- name: repo checkout
uses: actions/checkout@v2

- name: start mongodb
uses: supercharge/[email protected]
- name: Set up MongoDB ${{ matrix.entry.mongodb }}
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.entry.mongodb }}
mongodb-replica-set: rs0

- name: load ruby
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler: ${{ matrix.entry.bundler }}

- name: bundle install
run: bundle install --jobs 4 --retry 3
env:
MONGOID_VERSION: ${{ matrix.entry.mongoid }}

- name: test
timeout-minutes: 10
run: bundle exec rspec spec
continue-on-error: false
env:
MONGOID_VERSION: ${{ matrix.entry.mongoid }}
bundler: '${{ matrix.entry.bundler || 1 }}'
bundler-cache: true
- name: Run tests
run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Gemfile.lock
pkg
gemfiles/*.gemfile.lock
9 changes: 9 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
Metrics/LineLength:
Max: 118

Gemspec/RequiredRubyVersion:
Exclude:
- 'mongoid-compatibility.gemspec'

Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- 'test/**/*'

# Offense count: 4
Style/Documentation:
Exclude:
Expand Down
29 changes: 12 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,22 @@ matrix:
script:
- bundle exec danger
- rvm: 2.4.0
env:
- MONGOID_VERSION=7
gemfile: gemfiles/mongoid_9.gemfile
- rvm: 2.4.0
env:
- MONGOID_VERSION=6
gemfile: gemfiles/mongoid_8.gemfile
- rvm: 2.4.0
gemfile: gemfiles/mongoid_7.gemfile
- rvm: 2.4.0
gemfile: gemfiles/mongoid_6.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=6
gemfile: gemfiles/mongoid_6.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=5
gemfile: gemfiles/mongoid_5.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=4
gemfile: gemfiles/mongoid_4.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=3
gemfile: gemfiles/mongoid_3.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=2
gemfile: gemfiles/mongoid_2.gemfile
- rvm: 2.3.1
env:
- MONGOID_VERSION=HEAD
- rvm: 2.3.0
gemfile: gemfiles/mongoid_head.gemfile
34 changes: 34 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

appraise 'mongoid-9' do
gem 'mongoid', '~> 9.0.0'
end

appraise 'mongoid-8' do
gem 'mongoid', '~> 8.0.0'
end

appraise 'mongoid-7' do
gem 'mongoid', '~> 7.0.0'
end

appraise 'mongoid-6' do
gem 'mongoid', '~> 6.0.2'
end

appraise 'mongoid-5' do
gem 'mongoid', '~> 5.0.0'
end

appraise 'mongoid-4' do
gem 'mongoid', '~> 4.0.0'
end

appraise 'mongoid-3' do
gem 'mongoid', '~> 3.0.0'
end

appraise 'mongoid-2' do
gem 'mongoid', '~> 2.0.0'
gem 'bson_ext', platforms: :ruby
end
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.6.1 (Next)
### 1.0.0 (Next)

* [#16](https://github.com/mongoid/mongoid-compatibility/pull/16): Add support for Mongoid 9 - [@saisrinivasan](https://github.com/SairamSrinivasan).
* Your contribution here.
sairamsrinivasan marked this conversation as resolved.
Show resolved Hide resolved

### 0.6.0 (2022/08/18)
Expand Down
2 changes: 2 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

danger.import_dangerfile(gem: 'mongoid-danger')
33 changes: 2 additions & 31 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
# frozen_string_literal: true

source 'http://rubygems.org'

gemspec

case version = ENV['MONGOID_VERSION'] || '8.0.2'
when 'HEAD'
gem 'mongoid', github: 'mongodb/mongoid'
when /^8/
gem 'mongoid', '~> 8.0'
when /^7/
gem 'mongoid', '~> 7.0'
when /^6/
gem 'mongoid', '~> 6.0'
when /^5/
gem 'mongoid', '~> 5.0'
when /^4/
gem 'mongoid', '~> 4.0'
when /^3/
gem 'mongoid', '~> 3.1'
when /^2/
gem 'mongoid', '~> 2.0'
gem 'bson_ext', platforms: :ruby
else
gem 'mongoid', version
end

group :test do
gem 'rspec'
end

group :development do
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rubygems'
require 'bundler/gem_tasks'

Expand All @@ -13,4 +15,4 @@ end
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

task default: [:rubocop, :spec]
task default: %i[rubocop spec]
20 changes: 20 additions & 0 deletions gemfiles/mongoid_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'bson_ext', platforms: :ruby
gem 'mongoid', '~> 2.0.0'

group :development do
gem 'appraisal', '~> 2.0'
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end

group :test do
gem 'rspec'
end

gemspec path: '../'
19 changes: 19 additions & 0 deletions gemfiles/mongoid_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 3.0.0'

group :development do
gem 'appraisal', '~> 2.0'
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end

group :test do
gem 'rspec'
end

gemspec path: '../'
19 changes: 19 additions & 0 deletions gemfiles/mongoid_4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 4.0.0'

group :development do
gem 'appraisal', '~> 2.0'
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end

group :test do
gem 'rspec'
end

gemspec path: '../'
19 changes: 19 additions & 0 deletions gemfiles/mongoid_5.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 5.0.0'

group :development do
gem 'appraisal', '~> 2.0'
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end

group :test do
gem 'rspec'
end

gemspec path: '../'
19 changes: 19 additions & 0 deletions gemfiles/mongoid_6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 6.0.2'

group :development do
gem 'appraisal', '~> 2.0'
gem 'rake', '< 12'
gem 'rubocop', '0.33.0'
end

group :test do
gem 'rspec'
end

gemspec path: '../'
Loading
Loading