Skip to content

Commit

Permalink
Add Github actions & fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jarthod committed Sep 12, 2024
1 parent ae7103c commit bd4a426
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 21 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test
on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 2
strategy:
fail-fast: false
matrix:
ruby_version: ['2.7', '3.0', '3.1', '3.2', '3.3', 'jruby']
gemfile:
- rails6-mongoid7
- rails7-mongoid8
# - rails7-mongoid9
include:
- ruby_version: '2.4'
gemfile: rails5-mongoid6
- ruby_version: '2.5'
gemfile: rails5-mongoid7
- ruby_version: '3.3'
gemfile: rails-edge
exclude:
- ruby_version: 'jruby'
gemfile: rails7-mongoid8 # JRuby 9.4.8 with Mongoid 8 has trouble finding the Logger::INFO constant

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true

- name: Start MongoDB
uses: supercharge/[email protected]

- run: bundle exec rake
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Global migrations can still be created with the `--no-shards` option.

* Remove unnecessary purge, setup, reset, etc. rake tasks because they are already defined by Mongoid (#60)
* Minor tests improvements
* Rejects Mongoid 9.0 for the moment because it broke client override isolation: https://jira.mongodb.org/browse/MONGOID-5815

## 1.5.0
_26/03/2021_
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/rails-4.2-mongoid-5.x → gemfiles/rails5-mongoid6
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"
gemspec path: ".."
gem 'rails', '~> 4.2.0'
gem 'rails', '~> 5.0'
gem 'mongoid', '~> 6.0'
3 changes: 2 additions & 1 deletion gemfiles/rails-5.0-mongoid-6.x → gemfiles/rails5-mongoid7
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"
gemspec path: ".."
gem 'rails', '~> 5.0.0'
gem 'rails', '~> 5.2'
gem 'mongoid', '~> 7.0'
3 changes: 2 additions & 1 deletion gemfiles/rails-5.2-mongoid-7.x → gemfiles/rails6-mongoid7
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"
gemspec path: ".."
gem 'rails', '~> 5.2.0'
gem 'rails', '~> 6.1'
gem 'mongoid', '~> 7.0'
3 changes: 2 additions & 1 deletion gemfiles/rails-6.0-mongoid-7.x → gemfiles/rails7-mongoid8
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"
gemspec path: ".."
gem 'rails', '~> 6.0.0'
gem 'rails', '~> 7.1'
gem 'mongoid', '~> 8.0'
4 changes: 4 additions & 0 deletions gemfiles/rails7-mongoid9
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"
gemspec path: ".."
gem 'rails', '~> 7.1'
gem 'mongoid', '~> 9.0'
7 changes: 4 additions & 3 deletions mongoid_rails_migrations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ require 'mongoid_rails_migrations/version'
Gem::Specification.new do |spec|
spec.name = 'mongoid_rails_migrations'
spec.version = MongoidRailsMigrations::VERSION
spec.authors = ['Alan Da Costa']
spec.email = ['[email protected]']
spec.authors = ['Alan Da Costa', 'Adrien Rey-Jarthon']
spec.email = ['[email protected]', '[email protected]']

spec.summary = 'Data migrations for Mongoid.'
spec.description = 'Data migrations for Mongoid in Active Record style, minus column input.'
Expand All @@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
rails_version = '>= 4.2.0'

spec.add_runtime_dependency('bundler', '>= 1.0.0')
spec.add_runtime_dependency('mongoid', '>= 5.0.0')
# 9.0.0 broke client override isolation: https://jira.mongodb.org/browse/MONGOID-5815
spec.add_runtime_dependency('mongoid', '>= 5.0.0', '< 9.0.0')
spec.add_runtime_dependency('rails', rails_version)
spec.add_runtime_dependency('railties', rails_version)
spec.add_runtime_dependency('activesupport', rails_version)
Expand Down
9 changes: 5 additions & 4 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
# Test setup
MIGRATIONS_ROOT = 'test/migrations'

Mongoid.configure.load!("#{__dir__}/mongoid.yml", 'test')
Mongoid.load_configuration(clients: {
default: { hosts: ['localhost:27017'], database: 'mongoid_test' },
shard1: { hosts: ['localhost:27017'], database: 'mongoid_test_s1' }
})

require_relative 'models/survey_schema'

module TestMongoidRailsMigrations
Expand All @@ -19,9 +23,6 @@ class Application < Rails::Application; end

TestMongoidRailsMigrations::Application.load_tasks

# Mongo debug log
# Mongo::Logger.logger = Logger.new(STDOUT)

# Hide task output
class Mongoid::Migration
def self.puts _
Expand Down
10 changes: 0 additions & 10 deletions test/mongoid.yml

This file was deleted.

0 comments on commit bd4a426

Please sign in to comment.