Skip to content

Commit

Permalink
Fixed ci for trilogy & rails 7.0-
Browse files Browse the repository at this point in the history
Exclude ci for jruby & trilogy
  • Loading branch information
taketo1113 committed Aug 14, 2024
1 parent decb369 commit a05dd19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ jobs:
# gemfile: gemfiles/postgresql/6-0.gemfile
# - rvm: rbx-2
# gemfile: gemfiles/sqlite3/6-0.gemfile
exclude:
# not exist activerecord-jdbc-adapter for trilogy
- ruby: 'jruby-9.3'
gemfile: gemfiles/trilogy/6-0.gemfile
- ruby: 'jruby-9.3'
gemfile: gemfiles/trilogy/6-1.gemfile
- ruby: 'jruby-9.3'
gemfile: gemfiles/trilogy/7-0.gemfile
- ruby: 'jruby-9.3'
gemfile: gemfiles/trilogy/7-1.gemfile
continue-on-error: ${{ endsWith(matrix.gemfile, 'master.gemfile') || endsWith(matrix.ruby, 'head') }}
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bundler::GemHelper.install_tasks

require "rspec/core/rake_task"

ADAPTERS = %w[mysql2 postgresql sqlite3].freeze
ADAPTERS = %w[mysql2 trilogy postgresql sqlite3].freeze

ADAPTERS.each do |adapter|
desc "Run RSpec code examples for #{adapter} adapter"
Expand Down
6 changes: 6 additions & 0 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
db_adapter ||= gemfile && gemfile[%r{gemfiles/(.*?)/}] && $1 # rubocop:disable Style/PerlBackrefs
db_adapter ||= "sqlite3"

if db_adapter == "trilogy" && ActiveRecord.version < Gem::Version.new("7.1")
trilogy_adapter_gem = Gem::Specification.find_by_name("activerecord-trilogy-adapter").gem_dir
require "#{trilogy_adapter_gem}/lib/trilogy_adapter/connection"
ActiveSupport.on_load(:active_record) { extend TrilogyAdapter::Connection }
end

config = YAML.load_file("spec/database.yml")
ActiveRecord::Base.establish_connection config[db_adapter]
ActiveRecord::Base.logger = Delayed::Worker.logger
Expand Down

0 comments on commit a05dd19

Please sign in to comment.