Skip to content

Commit

Permalink
Test against various versions of Ruby on Rails: 6.1, 7.0, edge
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed May 31, 2022
1 parent 0966e80 commit 465401e
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 31 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on:
pull_request:
push:
branches:
- '**'
tags-ignore:
- 'v*'

jobs:
rubocop:
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
name: Standard.rb
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
- name: Lint Ruby code with Standard.rb
run: |
bundle exec rake standard
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on:
pull_request:
push:
branches:
- '**'
tags-ignore:
- 'v*'

jobs:
test:
name: 'Rails ${{ matrix.rails }} × Ruby ${{ matrix.ruby }}'
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ruby: "3.1"
rails: "HEAD"
- ruby: "3.0"
rails: "7.0"
- ruby: "2.5"
rails: "6.1"
env:
RAILS_VERSION: ${{ matrix.rails }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run specs
run: bundle exec rake spec
14 changes: 14 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ source "https://rubygems.org"

gemspec

# standard: disable Bundler/DuplicatedGem
if (rails_version = ENV["RAILS_VERSION"])
case rails_version
when "HEAD"
git "https://github.com/rails/rails.git" do
gem "rails"
end
else
rails_version = "~> #{rails_version}.0" if rails_version.match?(/^\d+\.\d+$/) # "7.0" => "~> 7.0.0"
gem "rails", rails_version
end
end
# standard: enable Bundler/DuplicatedGem

gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rspec-rails", "~> 5.0"
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Application < Rails::Application
config.root = File.join(__dir__, "..")
config.logger = Logger.new("/dev/null")
config.api_only = true
config.active_record.legacy_connection_handling = false
config.active_record.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling=)

if Rails::VERSION::MAJOR >= 7
config.active_record.async_query_executor = :global_thread_pool
Expand Down

0 comments on commit 465401e

Please sign in to comment.