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 rails 6.0 config to travis #1366

Merged
merged 8 commits into from
Jan 30, 2020
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
91 changes: 51 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ rvm:
- 2.4.7
- 2.5.6
- 2.6.4
- 2.7.0

gemfile:
- gemfiles/rails_4_2.gemfile
- gemfiles/rails_5_0.gemfile
- gemfiles/rails_5_1.gemfile
- gemfiles/rails_5_2.gemfile
- gemfiles/rails_6_0.gemfile

env:
global:
Expand All @@ -28,51 +30,60 @@ env:

matrix:
include:
- rvm: 2.3.8
gemfile: gemfiles/rails_4_2_mongoid_5.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.3.8
gemfile: gemfiles/rails_5_1_mongoid_6.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.4.7
gemfile: gemfiles/rails_5_1_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.5.6
gemfile: gemfiles/rails_5_2_mongoid_6.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.5.6
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.6.4
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- name: Code Climate Test Coverage
rmv: 2.5.6
env:
- CC_TEST_REPORTER_ID=44d7688de8e1b567b4af25ec5083c2cc0a355ab911192a7cbefd1ea25b2ffd3d
- GEMFILE_AR=gemfiles/rails_5_1.gemfile
- GEMFILE_MONGOID=gemfiles/rails_5_1_mongoid_7.gemfile
script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# with ActiveRecord
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_AR
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake --trace db:migrate
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.active_record.json coverage/.resultset.json
# with Mongoid
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_MONGOID
- BUNDLE_GEMFILE=$GEMFILE_MONGOID DEVISE_TOKEN_AUTH_ORM=mongoid bundle exec rake
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.mongoid.json coverage/.resultset.json
# merge test results
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then
- rvm: 2.3.8
gemfile: gemfiles/rails_4_2_mongoid_5.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.3.8
gemfile: gemfiles/rails_5_1_mongoid_6.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.4.7
gemfile: gemfiles/rails_5_1_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.5.6
gemfile: gemfiles/rails_5_2_mongoid_6.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.5.6
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.6.4
gemfile: gemfiles/rails_5_2_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- rvm: 2.7.0
gemfile: gemfiles/rails_6_0_mongoid_7.gemfile
env: DEVISE_TOKEN_AUTH_ORM=mongoid
- name: Code Climate Test Coverage
rvm: 2.5.6
env:
- CC_TEST_REPORTER_ID=44d7688de8e1b567b4af25ec5083c2cc0a355ab911192a7cbefd1ea25b2ffd3d
- GEMFILE_AR=gemfiles/rails_5_1.gemfile
- GEMFILE_MONGOID=gemfiles/rails_5_1_mongoid_7.gemfile
script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# with ActiveRecord
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_AR
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake --trace db:migrate
- BUNDLE_GEMFILE=$GEMFILE_AR bundle exec rake
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.active_record.json coverage/.resultset.json
# with Mongoid
- bundle install --jobs=3 --retry=3 --gemfile $GEMFILE_MONGOID
- BUNDLE_GEMFILE=$GEMFILE_MONGOID DEVISE_TOKEN_AUTH_ORM=mongoid bundle exec rake
- ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.mongoid.json coverage/.resultset.json
# merge test results
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then
./cc-test-reporter sum-coverage coverage/codeclimate.active_record.json coverage/codeclimate.mongoid.json;
./cc-test-reporter upload-coverage;
fi
fi
exclude:
- rvm: 2.6.4
gemfile: gemfiles/rails_4_2.gemfile
- rvm: 2.7.0
gemfile: gemfiles/rails_4_2.gemfile
- rvm: 2.3.8
gemfile: gemfiles/rails_6_0.gemfile
- rvm: 2.4.7
gemfile: gemfiles/rails_6_0.gemfile
fast_finish: true

before_install:
Expand Down
3 changes: 2 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ end
{ name: '5-1', ruby: '2.4.5', rails: '5.1', mongoid: '7.0' },
{ name: '5-2', ruby: '2.5.5', rails: '5.2', mongoid: '6.4' },
{ name: '5-2', ruby: '2.5.5', rails: '5.2', mongoid: '7.0' },
{ name: '5-2', ruby: '2.6.2', rails: '5.2', mongoid: '7.0' }
{ name: '5-2', ruby: '2.6.2', rails: '5.2', mongoid: '7.0' },
{ name: '6-0', ruby: '2.7.0', rails: '6.0', mongoid: '7.0' }
].each do |set|
appraise "rails-#{set[:name]}-mongoid-#{set[:mongoid][0]}" do
gem 'rails', "~> #{set[:rails]}"
Expand Down
45 changes: 45 additions & 0 deletions gemfiles/rails_6_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 6.0"
gem "sqlite3", "~> 1.4.1"
gem "mysql2"
gem "pg"

group :development, :test do
gem "attr_encrypted"
gem "figaro", git: "https://github.com/laserlemon/figaro"
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
gem 'omniauth-apple'
gem "rack-cors", require: "rack/cors"
gem "thor"
gem "database_cleaner"
gem "factory_bot_rails"
gem "faker"
gem "fuzz_ball"
gem "guard"
gem "guard-minitest"
gem "minitest"
gem "minitest-focus"
gem "minitest-rails"
gem "minitest-reporters"
gem "mocha", ">= 1.5"
gem "pry"
gem "pry-byebug"
gem "pry-remote"
gem "rubocop", require: false
end

group :test do
gem "rails-controller-testing"
gem "simplecov", require: false
end

group :development do
gem "github_changelog_generator"
end

gemspec path: "../"
44 changes: 44 additions & 0 deletions gemfiles/rails_6_0_mongoid_7.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 6.0"
gem "mongoid", "~> 7.0"
gem "mongoid-locker", "~> 1.0"

group :development, :test do
gem "attr_encrypted"
gem "figaro", git: "https://github.com/laserlemon/figaro"
gem "omniauth-facebook", git: "https://github.com/mkdynamic/omniauth-facebook"
gem "omniauth-github", git: "https://github.com/intridea/omniauth-github"
gem "omniauth-google-oauth2", git: "https://github.com/zquestz/omniauth-google-oauth2"
gem "omniauth-apple"
gem "rack-cors", require: "rack/cors"
gem "thor"
gem "database_cleaner"
gem "factory_bot_rails"
gem "faker"
gem "fuzz_ball"
gem "guard"
gem "guard-minitest"
gem "minitest"
gem "minitest-focus"
gem "minitest-rails"
gem "minitest-reporters"
gem "mocha", ">= 1.5"
gem "pry"
gem "pry-byebug"
gem "pry-remote"
gem "rubocop", require: false
end

group :test do
gem "rails-controller-testing"
gem "simplecov", require: false
end

group :development do
gem "github_changelog_generator"
end

gemspec path: "../"
6 changes: 3 additions & 3 deletions lib/generators/devise_token_auth/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def database_version
ActiveRecord::Base.connection.select_value('SELECT VERSION()')
end

def rails5?
Rails.version.start_with? '5'
def rails_5_or_newer?
Rails::VERSION::MAJOR >= 5
end

def primary_key_type
primary_key_string if rails5?
primary_key_string if rails_5_or_newer?
end

def primary_key_string
Expand Down