Skip to content

Commit 6a7d864

Browse files
bf4NullVoxPopuli
authored andcommitted
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 jruby/activerecord-jdbc-adapter#708 ``` uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format ``` see https://travis-ci.org/rails-api/active_model_serializers/jobs/277112008
1 parent c2fa016 commit 6a7d864

File tree

5 files changed

+50
-40
lines changed

5 files changed

+50
-40
lines changed

.travis.yml

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,47 @@
11
language: ruby
2-
32
sudo: false
43

5-
rvm:
6-
- 2.1
7-
- 2.2.6
8-
- 2.3.3
9-
- ruby-head
10-
- jruby-9.1.5.0 # is precompiled per http://rubies.travis-ci.org/
11-
- jruby-head
12-
13-
jdk:
14-
- oraclejdk8
15-
16-
before_install:
17-
- gem update --system
18-
- rvm @global do gem uninstall bundler -a -x
19-
- rvm @global do gem install bundler -v 1.13.7
20-
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
214
cache:
225
directories:
236
- vendor/bundle
247

8+
before_install:
9+
- "travis_retry gem update --system"
10+
- "travis_retry gem update bundler"
11+
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
12+
2513
script:
2614
- bundle exec rake ci
2715
after_success:
2816
- codeclimate-test-reporter
17+
2918
env:
30-
global:
31-
- "JRUBY_OPTS='--dev -J-Xmx1024M --debug'"
3219
matrix:
3320
- "RAILS_VERSION=4.1"
3421
- "RAILS_VERSION=4.2"
3522
- "RAILS_VERSION=5.0"
3623
- "RAILS_VERSION=master"
3724

25+
rvm:
26+
- 2.1
27+
- 2.2.6
28+
- 2.3.3
29+
- ruby-head
30+
3831
matrix:
32+
include:
33+
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
34+
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.2 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
35+
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
36+
# See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
37+
# - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.0 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
38+
# - { rvm: jruby-head, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
3939
exclude:
40-
- rvm: 2.1
41-
env: RAILS_VERSION=master
42-
- rvm: jruby-9.1.5.0
43-
env: RAILS_VERSION=master
44-
- rvm: jruby-head
45-
env: RAILS_VERSION=master
46-
- rvm: 2.1
47-
env: RAILS_VERSION=5.0
48-
- rvm: jruby-9.1.5.0
49-
env: RAILS_VERSION=5.0
50-
- rvm: jruby-head
51-
env: RAILS_VERSION=5.0
40+
- { rvm: 2.1, env: RAILS_VERSION=master }
41+
- { rvm: 2.1, env: RAILS_VERSION=5.0 }
5242
allow_failures:
5343
- rvm: ruby-head
5444
- rvm: jruby-head
45+
# See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
46+
- { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
5547
fast_finish: true

Gemfile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ version = ENV['RAILS_VERSION'] || '4.2'
1212
if version == 'master'
1313
gem 'rack', github: 'rack/rack'
1414
gem 'arel', github: 'rails/arel'
15+
gem 'rails', github: 'rails/rails'
1516
git 'https://github.com/rails/rails.git' do
1617
gem 'railties'
1718
gem 'activesupport'
@@ -23,6 +24,7 @@ if version == 'master'
2324
end
2425
else
2526
gem_version = "~> #{version}.0"
27+
gem 'rails', gem_version
2628
gem 'railties', gem_version
2729
gem 'activesupport', gem_version
2830
gem 'activemodel', gem_version
@@ -36,18 +38,32 @@ end
3638
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
3739
gem 'tzinfo-data', platforms: (@windows_platforms + [:jruby])
3840

41+
if ENV['CI']
42+
if RUBY_VERSION < '2.4'
43+
# Windows: An error occurred while installing nokogiri (1.8.0)
44+
gem 'nokogiri', '< 1.7', platforms: @windows_platforms
45+
end
46+
end
47+
3948
group :bench do
4049
# https://github.com/rails-api/active_model_serializers/commit/cb4459580a6f4f37f629bf3185a5224c8624ca76
4150
gem 'benchmark-ips', '>= 2.7.2', require: false, group: :development
4251
end
4352

4453
group :test do
45-
gem 'sqlite3', platform: (@windows_platforms + [:ruby])
46-
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
54+
gem 'sqlite3', platform: (@windows_platforms + [:ruby])
55+
platforms :jruby do
56+
if version == 'master' || version >= '5'
57+
gem 'activerecord-jdbcsqlite3-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
58+
else
59+
gem 'activerecord-jdbcsqlite3-adapter'
60+
end
61+
end
4762
gem 'codeclimate-test-reporter', require: false
4863
gem 'm', '~> 1.5'
49-
gem 'pry', '~> 0.10'
50-
gem 'pry-byebug', '~> 3.4', platform: :ruby
64+
gem 'pry', '>= 0.10'
65+
gem 'byebug', '~> 8.2' if RUBY_VERSION < '2.2'
66+
gem 'pry-byebug', platform: :ruby
5167
end
5268

5369
group :development, :test do

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ skip_tags: true
55
environment:
66
JRUBY_OPTS: "--dev -J-Xmx1024M --debug"
77
matrix:
8-
- ruby_version: "Ruby21"
9-
- ruby_version: "Ruby21-x64"
8+
- ruby_version: "Ruby23"
9+
- ruby_version: "Ruby23-x64"
1010

1111
cache:
1212
- vendor/bundle

lib/active_model_serializers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ def self.silence_warnings
4949
require 'active_model/serializer/version'
5050
require 'active_model/serializer'
5151
require 'active_model/serializable_resource'
52-
require 'active_model_serializers/railtie' if defined?(::Rails)
52+
require 'active_model_serializers/railtie' if defined?(::Rails::Railtie)
5353
end

test/support/isolated_unit.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def make_basic_app
5454
require 'rails'
5555
require 'action_controller/railtie'
5656

57-
@app = Class.new(Rails::Application) do
57+
app = Class.new(Rails::Application) do
5858
config.eager_load = false
5959
config.session_store :cookie_store, key: '_myapp_session'
6060
config.active_support.deprecation = :log
@@ -67,8 +67,10 @@ def make_basic_app
6767
config.logger = fake_logger
6868
Rails.application.routes.default_url_options = { host: 'example.com' }
6969
end
70-
@app.respond_to?(:secrets) && @app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
70+
def app.name; 'IsolatedRailsApp'; end # rubocop:disable Style/SingleLineMethods
71+
app.respond_to?(:secrets) && app.secrets.secret_key_base = '3b7cd727ee24e8444053437c36cc66c4'
7172

73+
@app = app
7274
yield @app if block_given?
7375
@app.initialize!
7476
end

0 commit comments

Comments
 (0)