Skip to content

Commit

Permalink
Merge pull request zdennis#764 from mishina2228/ci-ruby3
Browse files Browse the repository at this point in the history
CI against Ruby 3.0 and 3.1
  • Loading branch information
jkowens authored Jan 17, 2022
2 parents f895037 + af9fdc6 commit 59dcc29
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,28 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.7
- 3.1
env:
- AR_VERSION: 7.0
- AR_VERSION: '7.0'
RUBYOPT: --enable-frozen-string-literal
- AR_VERSION: 6.1
RUBYOPT: --enable-frozen-string-literal
- AR_VERSION: 6.0
RUBYOPT: --enable-frozen-string-literal
include:
- ruby: '3.0'
env:
AR_VERSION: '7.0'
- ruby: '3.0'
env:
AR_VERSION: 6.1
- ruby: 2.7
env:
AR_VERSION: '7.0'
- ruby: 2.7
env:
AR_VERSION: 6.1
- ruby: 2.7
env:
AR_VERSION: '6.0'
- ruby: 2.6
env:
AR_VERSION: 5.2
Expand All @@ -37,7 +50,7 @@ jobs:
AR_VERSION: 5.1
- ruby: 2.4
env:
AR_VERSION: 5.0
AR_VERSION: '5.0'
- ruby: 2.4
env:
AR_VERSION: 4.2
Expand All @@ -62,15 +75,22 @@ jobs:
cp test/github/database.yml test/database.yml
env:
PGPASSWORD: postgres
- name: Run tests
- name: Run tests with mysql2
run: |
bundle exec rake test:mysql2
bundle exec rake test:mysql2_makara
bundle exec rake test:mysql2spatial
- name: Run tests with postgresql
run: |
bundle exec rake test:postgis
bundle exec rake test:postgresql
bundle exec rake test:postgresql_makara
- name: Run tests with seamless_database_pool
run: |
bundle exec rake test:seamless_database_pool
if: ${{ matrix.ruby < '3.0' }}
- name: Run tests with sqlite
run: |
bundle exec rake test:spatialite
bundle exec rake test:sqlite3
lint:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ platforms :ruby do
gem "mysql2", "~> #{mysql2_version}"
gem "pg", "~> #{pg_version}"
gem "sqlite3", "~> #{sqlite3_version}"
gem "seamless_database_pool", "~> 1.0.20"
# seamless_database_pool requires Ruby ~> 2.0
gem "seamless_database_pool", "~> 1.0.20" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
end

platforms :jruby do
Expand All @@ -47,7 +48,6 @@ end
platforms :ruby do
gem "pry-byebug"
gem "pry", "~> 0.12.0"
gem "rb-readline"
end

if version >= 4.0
Expand Down
6 changes: 5 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class ActiveRecord::ConnectionAdapters::Mysql2Adapter
ActiveRecord::Base.logger.level = Logger::DEBUG

if ENV['AR_VERSION'].to_f >= 6.0
yaml_config = YAML.load_file(test_dir.join("database.yml"))[adapter]
yaml_config = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.2.1')
YAML.safe_load_file(test_dir.join("database.yml"), aliases: true)[adapter]
else
YAML.load_file(test_dir.join("database.yml"))[adapter]
end
config = ActiveRecord::DatabaseConfigurations::HashConfig.new("test", adapter, yaml_config)
ActiveRecord::Base.configurations.configurations << config
else
Expand Down

0 comments on commit 59dcc29

Please sign in to comment.