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 all 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
12 changes: 5 additions & 7 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ on: [pull_request]
jobs:
danger:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7
bundler-cache: true
- run: |
# the personal token is public, this is ok, base64 encode to avoid tripping Github
TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
# Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
109 changes: 49 additions & 60 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,65 @@ 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.6", gemfile: 'mongoid_3', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_4', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_4', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_5', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_5', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "3.6" }
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "3.6" }
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "3.6" }
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "3.6" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.0" }
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.0" }
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.0" }
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.0" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.2" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.2" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.2" }
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.2" }
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.2" }
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.2" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "4.4" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.4" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "4.4" }
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "4.4" }
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "4.4" }
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "4.4" }
- { ruby: "2.6", gemfile: 'mongoid_6', mongodb: "5.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "5.0" }
- { ruby: "2.6", gemfile: 'mongoid_7', mongodb: "5.0" }
- { ruby: "2.7", gemfile: 'mongoid_7', mongodb: "5.0" }
- { ruby: "3.0", gemfile: 'mongoid_8', mongodb: "5.0" }
- { ruby: "3.1", gemfile: 'mongoid_8', mongodb: "5.0" }
- { ruby: "3.1", gemfile: 'mongoid_9', 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: '2'
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
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Mongoid::Compatibility
[![Build Status](https://github.com/mongoid/mongoid-compatibility/actions/workflows/test.yml/badge.svg)](https://github.com/mongoid/mongoid-compatibility/actions)
[![Code Climate](https://codeclimate.com/github/mongoid/mongoid-compatibility.svg)](https://codeclimate.com/github/mongoid/mongoid-compatibility)

Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, and 8.
[Tested](https://github.com/mongoid/mongoid-compatibility/actions) against:
- MRI: `2.6.x`, `2.7.x`, `3.0.x`, `3.1.x`
- Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6, 7, 8, and 9.

### Install

Expand Down
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]
10 changes: 10 additions & 0 deletions gemfiles/mongoid_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'http://rubygems.org'

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

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 3.0.0'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 4.0.0'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 5.0.0'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 6.0.2'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 7.0.0'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 8.0.0'

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

# This file was generated by Appraisal

source 'http://rubygems.org'

gem 'mongoid', '~> 9.0.0'

gemspec path: '../'
Loading
Loading