Skip to content

Commit

Permalink
Update activerecord and ruby versions to test
Browse files Browse the repository at this point in the history
Tests for the unreleased version of Active Record are now in a separate file
so that a failure does not cancell other tests. Really, Github Actions should
have an 'allow failure' option.
  • Loading branch information
jrmhaig committed Mar 29, 2024
1 parent cf44e2b commit 62136a9
Show file tree
Hide file tree
Showing 23 changed files with 74 additions and 37 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/activerecord_head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Ruby head

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [ 3.0, 3.1, 3.2, 3.3, head ]
env:
BUNDLE_GEMFILE: gemfiles/activerecord_head.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .github/workflows/jruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ jruby_activerecord_7.0 ]
env:
BUNDLE_GEMFILE: gemfiles/jruby_activerecord_7.0.gemfile
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
JRUBY_OPTS: --debug
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ on:

jobs:
test:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
ruby-version: 3.0
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop
2 changes: 1 addition & 1 deletion .github/workflows/ruby_30.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
gemfile: [ activerecord_6.1, activerecord_7.0, activerecord_7.1 ]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby_31.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
gemfile: [ activerecord_6.1, activerecord_7.0, activerecord_7.1 ]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby_32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
gemfile: [ activerecord_6.1, activerecord_7.0, activerecord_7.1 ]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby 2.7
name: Ruby 3.3

on:
push:
Expand All @@ -12,15 +12,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
gemfile: [ activerecord_6.1, activerecord_7.0, activerecord_7.1 ]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.3
bundler-cache: true
- name: Run tests
run: bundle exec rspec
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby_head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: [ activerecord_6.0, activerecord_6.1, activerecord_7.0, activerecord_head ]
gemfile: [ activerecord_6.1, activerecord_7.0, activerecord_7.1 ]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ coverage
.idea
gemfiles/*.lock
.ruby-version
tmp/**/*
18 changes: 0 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,6 @@ RSpec/PredicateMatcher:
Exclude:
- 'spec/lib/amoeba_spec.rb'

# Offense count: 11
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'gemfiles/activerecord_6.0.gemfile'
- 'gemfiles/activerecord_6.1.gemfile'
- 'gemfiles/activerecord_7.0.gemfile'
- 'gemfiles/activerecord_head.gemfile'
- 'gemfiles/jruby_activerecord_7.0.gemfile'
- 'gemfiles/jruby_activerecord_head.gemfile'
- 'spec/lib/amoeba_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/data.rb'
- 'spec/support/models.rb'
- 'spec/support/schema.rb'

# Offense count: 25
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConstantBase:
Expand Down
8 changes: 4 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

appraise 'activerecord-6.0' do
gem 'activerecord', '~> 6.0.0'
end

appraise 'activerecord-6.1' do
gem 'activerecord', '~> 6.1.0'
end
Expand All @@ -12,6 +8,10 @@ appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
end

appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
end

appraise 'jruby-activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
end
Expand Down
6 changes: 3 additions & 3 deletions amoeba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rubocop-rspec', '~> 2.27.1'

if RUBY_PLATFORM == 'java'
s.add_development_dependency 'activerecord-jdbc-adapter', '~> 70.0'
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
s.add_development_dependency 'activerecord-jdbc-adapter', '= 70.1'
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '= 70.1'
else
s.add_development_dependency 'sqlite3', '~> 1.6.0'
end

s.add_dependency 'activerecord', '>= 6.0.0'
s.add_dependency 'activerecord', '>= 6.1.0'
end
2 changes: 2 additions & 0 deletions gemfiles/activerecord_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/activerecord_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'activerecord', '~> 6.0.0'
gem 'activerecord', '~> 7.1.0'

group :development, :test do
gem 'rake'
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/activerecord_head.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/jruby_activerecord_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/jruby_activerecord_head.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/amoeba_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'amoeba' do
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'simplecov'

SimpleCov.start do
Expand Down
2 changes: 2 additions & 0 deletions spec/support/data.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

u1 = User.create(name: 'Robert Johnson', email: '[email protected]')
u2 = User.create(name: 'Miles Davis', email: '[email protected]')

Expand Down
4 changes: 3 additions & 1 deletion spec/support/models.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Topic < ActiveRecord::Base
has_many :posts
end
Expand Down Expand Up @@ -202,7 +204,7 @@ class Product < ActiveRecord::Base
has_many :images
has_and_belongs_to_many :sections

SECTION_COUNT_QUERY = 'SELECT COUNT(*) AS section_count FROM products_sections WHERE product_id = ?'.freeze
SECTION_COUNT_QUERY = 'SELECT COUNT(*) AS section_count FROM products_sections WHERE product_id = ?'

amoeba do
enable
Expand Down
2 changes: 2 additions & 0 deletions spec/support/schema.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ActiveRecord::Schema.define do
self.verbose = false

Expand Down

0 comments on commit 62136a9

Please sign in to comment.