Skip to content

Commit

Permalink
Merge pull request #23 from pocke/Test_on_each_Active_Record_gem
Browse files Browse the repository at this point in the history
Test on each Active Record version
  • Loading branch information
pocke authored Aug 14, 2024
2 parents 2f10f4c + c15201a commit f86c93b
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 16 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,30 @@ on:
pull_request:

jobs:
build:
run_spec:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile}}
strategy:
matrix:
ruby:
- '3.1'
- '3.2'
- '3.3'
- 'head'
gemfile:
- activerecord_6_1
- activerecord_7_0
- activerecord_7_1
- activerecord_7_2
exclude:
# Old ARs does not work on Ruby head due to lack of stdlib dependencies
- ruby: 'head'
gemfile: activerecord_6_1
- ruby: 'head'
gemfile: activerecord_7_0

env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile

steps:
- uses: actions/checkout@v4
Expand All @@ -29,4 +43,20 @@ jobs:
- name: Run bin/setup
run: bin/setup
- name: Run the default task
run: bundle exec rake
run: bundle exec rake spec

static_check:
runs-on: ubuntu-latest
name: Static Checking

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run bin/setup
run: bin/setup
- name: Run the default task
run: bundle exec rake rubocop steep
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
.rspec_status

/Gemfile.lock
/gemfiles/*.lock
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Layout/FirstHashElementIndentation:

Lint/AssignmentInCondition:
Enabled: false

Gemspec/DevelopmentDependencies:
Enabled: false
12 changes: 0 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,3 @@ source "https://rubygems.org"

# Specify your gem's dependencies in activerecord-originator.gemspec
gemspec

gem "rake", "~> 13.0", require: false

gem "rspec", "~> 3.0", require: false

gem "rubocop", "~> 1.21", require: false

gem 'steep', require: false

gem 'sqlite3'

gem 'benchmark-ips'
7 changes: 7 additions & 0 deletions activerecord-originator.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ Gem::Specification.new do |spec|

spec.add_dependency "activerecord", ">= 6.0"
spec.add_dependency "activesupport", ">= 6.0"

spec.add_development_dependency "benchmark-ips"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rubocop"
spec.add_development_dependency "sqlite3"
spec.add_development_dependency "steep"
end
8 changes: 7 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ IFS=$'\n\t'
set -vx

bundle install
bundle exec rbs collection install

set +u
if [ -z "$BUNDLE_GEMFILE" ]; then
bundle exec rbs collection install --frozen
else
echo "Skipping rbs collection install because BUNDLE_GEMFILE is set"
fi
6 changes: 6 additions & 0 deletions gemfiles/activerecord_6_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 6.1.0'
gem "sqlite3", "~> 1.4"

gemspec path: '../'
6 changes: 6 additions & 0 deletions gemfiles/activerecord_7_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 7.0.0'
gem "sqlite3", "~> 1.4"

gemspec path: '../'
6 changes: 6 additions & 0 deletions gemfiles/activerecord_7_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 7.1.0'
gem "sqlite3", "~> 1.4"

gemspec path: '../'
5 changes: 5 additions & 0 deletions gemfiles/activerecord_7_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 7.2.0'

gemspec path: '../'

0 comments on commit f86c93b

Please sign in to comment.