Fix CI on 0-10-stable (#2181)

* Loosen pry, pry-byebug depencency

```
Resolving dependencies...
byebug-9.1.0 requires ruby version >= 2.2.0, which is
incompatible with the current version, ruby 2.1.10p492
```

* Adjust nokogiri version constraint for CI

Update appveyor Ruby to 2.3 to work around:

```
Gem::InstallError: nokogiri requires Ruby version < 2.5, >= 2.2.

An error occurred while installing nokogiri (1.8.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.0'` succeeds before bundling.
```

and not 2.4 since:

https://ci.appveyor.com/project/bf4/active-model-serializers/build/1.0.1052-fix_ci/job/0q3itabsnvnxr83u

```
nokogiri-1.6.8.1-x86-mingw32 requires ruby version < 2.4, which is incompatible with the current version, ruby 2.4.1p111
```

* Include rails gem in Gemfile

(For Rails5)

In Rails5, checking for Rails::Railtie is better

* Rails5 test env requires Rails.application.class.name

rails-42d09f6b49da/railties/lib/rails/application.rb

```ruby
def secret_key_base
  if Rails.env.test? || Rails.env.development?
  Digest::MD5.hexdigest self.class.name
```

* Reformat exclude matrix to be easier to read

* Simplify jruby-travis config per rails/rails

* Organize .travis.yml per rails/rails

* Allow JRuby failure on Rails 5+; try rails-5 db adapter branch

https://github.com/jruby/activerecord-jdbc-adapter/issues/708

```
uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format
```

see https://travis-ci.org/rails-api/active_model_serializers/jobs/277112008
This commit is contained in:
Benjamin Fleischer 2017-09-19 04:27:02 -05:00 committed by L. Preston Sego III
parent c2fa01624d
commit 6a7d864605
5 changed files with 50 additions and 40 deletions

View File

@ -1,55 +1,47 @@
language: ruby
sudo: false
rvm:
- 2.1
- 2.2.6
- 2.3.3
- ruby-head
- jruby-9.1.5.0 # is precompiled per http://rubies.travis-ci.org/
- jruby-head
jdk:
- oraclejdk8
before_install:
- gem update --system
- rvm @global do gem uninstall bundler -a -x
- rvm @global do gem install bundler -v 1.13.7
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
cache:
directories:
- vendor/bundle
before_install:
- "travis_retry gem update --system"
- "travis_retry gem update bundler"
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
script:
- bundle exec rake ci
after_success:
- codeclimate-test-reporter
env:
global:
- "JRUBY_OPTS='--dev -J-Xmx1024M --debug'"
matrix:
- "RAILS_VERSION=4.1"
- "RAILS_VERSION=4.2"
- "RAILS_VERSION=5.0"
- "RAILS_VERSION=master"
rvm:
- 2.1
- 2.2.6
- 2.3.3
- ruby-head
matrix:
include:
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.2 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
# See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
# - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.0 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
# - { rvm: jruby-head, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
exclude:
- rvm: 2.1
env: RAILS_VERSION=master
- rvm: jruby-9.1.5.0
env: RAILS_VERSION=master
- rvm: jruby-head
env: RAILS_VERSION=master
- rvm: 2.1
env: RAILS_VERSION=5.0
- rvm: jruby-9.1.5.0
env: RAILS_VERSION=5.0
- rvm: jruby-head
env: RAILS_VERSION=5.0
- { rvm: 2.1, env: RAILS_VERSION=master }
- { rvm: 2.1, env: RAILS_VERSION=5.0 }
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
# See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
fast_finish: true

24
Gemfile
View File

@ -12,6 +12,7 @@ version = ENV['RAILS_VERSION'] || '4.2'
if version == 'master'
gem 'rack', github: 'rack/rack'
gem 'arel', github: 'rails/arel'
gem 'rails', github: 'rails/rails'
git 'https://github.com/rails/rails.git' do
gem 'railties'
gem 'activesupport'
@ -23,6 +24,7 @@ if version == 'master'
end
else
gem_version = "~> #{version}.0"
gem 'rails', gem_version
gem 'railties', gem_version
gem 'activesupport', gem_version
gem 'activemodel', gem_version
@ -36,18 +38,32 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: (@windows_platforms + [:jruby])
if ENV['CI']
if RUBY_VERSION < '2.4'
# Windows: An error occurred while installing nokogiri (1.8.0)
gem 'nokogiri', '< 1.7', platforms: @windows_platforms
end
end
group :bench do
# https://github.com/rails-api/active_model_serializers/commit/cb4459580a6f4f37f629bf3185a5224c8624ca76
gem 'benchmark-ips', '>= 2.7.2', require: false, group: :development
end
group :test do
gem 'sqlite3', platform: (@windows_platforms + [:ruby])
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
gem 'sqlite3', platform: (@windows_platforms + [:ruby])
platforms :jruby do
if version == 'master' || version >= '5'
gem 'activerecord-jdbcsqlite3-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
else
gem 'activerecord-jdbcsqlite3-adapter'
end
end
gem 'codeclimate-test-reporter', require: false
gem 'm', '~> 1.5'
gem 'pry', '~> 0.10'
gem 'pry-byebug', '~> 3.4', platform: :ruby
gem 'pry', '>= 0.10'
gem 'byebug', '~> 8.2' if RUBY_VERSION < '2.2'
gem 'pry-byebug', platform: :ruby
end
group :development, :test do

View File

@ -5,8 +5,8 @@ skip_tags: true
environment:
JRUBY_OPTS: "--dev -J-Xmx1024M --debug"
matrix:
- ruby_version: "Ruby21"
- ruby_version: "Ruby21-x64"
- ruby_version: "Ruby23"
- ruby_version: "Ruby23-x64"
cache:
- vendor/bundle

View File

@ -49,5 +49,5 @@ module ActiveModelSerializers
require 'active_model/serializer/version'
require 'active_model/serializer'
require 'active_model/serializable_resource'
require 'active_model_serializers/railtie' if defined?(::Rails)
require 'active_model_serializers/railtie' if defined?(::Rails::Railtie)
end

View File

@ -54,7 +54,7 @@ module TestHelpers
require 'rails'
require 'action_controller/railtie'
@app = Class.new(Rails::Application) do
app = Class.new(Rails::Application) do
config.eager_load = false
config.session_store :cookie_store, key: '_myapp_session'
config.active_support.deprecation = :log
@ -67,8 +67,10 @@ module TestHelpers
config.logger = fake_logger
Rails.application.routes.default_url_options = { host: 'example.com' }
end
@app.respond_to?(:secrets) && @app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
def app.name; 'IsolatedRailsApp'; end # rubocop:disable Style/SingleLineMethods
app.respond_to?(:secrets) && app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
@app = app
yield @app if block_given?
@app.initialize!
end