Skip to content

test: test inside a dummy app. #451

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
44 changes: 31 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,22 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.4'
- 'jruby'
- 'truffleruby'
rails:
- activerecord_8.0
- activerecord_7.2
- activerecord_7.1
- activerecord_edge
adapter:
- 'sqlite3:///:memory:'
- mysql2://root:root@0/closure_tree_test
- postgres://closure_tree:closure_tree@0/closure_tree_test
- '8.0'
- '7.2'
- '7.1'
exclude:
# JRuby doesn't support Rails 8.0 yet
- ruby: 'jruby'
rails: '7.2'
- ruby: 'jruby'
rails: '8.0'
# TruffleRuby also has compatibility issues with Rails 8.0
- ruby: 'truffleruby'
rails: '8.0'

steps:
- name: Checkout
Expand All @@ -60,14 +66,26 @@ jobs:
bundler-cache: true
rubygems: latest
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RAILS_VERSION: ${{ matrix.rails }}
RAILS_ENV: test

- name: Setup databases
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DATABASE_URL_PG: postgres://postgres:postgres@127.0.0.1:5432/closure_tree_test
DATABASE_URL_MYSQL: mysql2://root:root@127.0.0.1:3306/closure_tree_test
DATABASE_URL_SQLITE3: 'sqlite3::memory:'
run: |
cd test/dummy
bundle exec rails db:schema:load

- name: Test
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DB_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
DATABASE_URL_PG: postgres://postgres:postgres@127.0.0.1:5432/closure_tree_test
DATABASE_URL_MYSQL: mysql2://root:root@127.0.0.1:3306/closure_tree_test
DATABASE_URL_SQLITE3: 'sqlite3::memory:'
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
run: bin/rake
run: bin/rails test
69 changes: 0 additions & 69 deletions .github/workflows/ci_jruby.yml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/ci_truffleruby.yml

This file was deleted.

51 changes: 0 additions & 51 deletions Appraisals

This file was deleted.

19 changes: 18 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,21 @@ source 'https://rubygems.org'

gemspec

gem 'with_advisory_lock', github: 'closuretree/with_advisory_lock'
gem 'railties'
gem 'with_advisory_lock', github: 'closuretree/with_advisory_lock'

gem 'activerecord', "~> #{ENV['RAILS_VERSION'] || '8.0'}.0"

platforms :ruby, :truffleruby do
# Database adapters
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
end

platform :jruby do
# JRuby-specific gems
gem 'activerecord-jdbcmysql-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
end
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ namespace :test do
end
end
end


require_relative 'test/dummy/config/application'

Rails.application.load_tasks
15 changes: 15 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
1 change: 0 additions & 1 deletion closure_tree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'activerecord', '>= 7.1.0'
gem.add_runtime_dependency 'with_advisory_lock', '>= 6.0.0'

gem.add_development_dependency 'appraisal'
gem.add_development_dependency 'database_cleaner'
gem.add_development_dependency 'parallel'
gem.add_development_dependency 'minitest'
Expand Down
21 changes: 0 additions & 21 deletions gemfiles/activerecord_7.1.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/activerecord_7.2.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/activerecord_8.0.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/activerecord_edge.gemfile

This file was deleted.

Loading
Loading