Skip to content

Commit

Permalink
Support Rails 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuravel committed Nov 9, 2024
1 parent be751b3 commit 94b9537
Show file tree
Hide file tree
Showing 14 changed files with 265 additions and 99 deletions.
38 changes: 26 additions & 12 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
name: Run StandardRB linter
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_7.1.gemfile
BUNDLE_GEMFILE: gemfiles/activerecord_8.0.gemfile
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
ruby-version: '3.3'
bundler-cache: true
- name: Run StandardRB
id: offenses
Expand All @@ -40,7 +40,7 @@ jobs:
echo '${{ steps.offenses.outputs.LINTER_OFFENSES }}'
- name: Fail if StandardRB offenses found
if: steps.offenses.outputs.LINTER_OFFENSES
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: "core.setFailed('StandardRB linter offenses found. Please inspect the details \
of the previous step in the job for more info.')"
Expand All @@ -51,6 +51,16 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: '3.3'
rails: '8.0'
- ruby: '3.3'
rails: '7.2'
- ruby: '3.3'
rails: '7.1'
- ruby: '3.3'
rails: '7.0'
- ruby: '3.2'
rails: '8.0'
- ruby: '3.2'
rails: '7.2'
- ruby: '3.2'
Expand Down Expand Up @@ -91,6 +101,8 @@ jobs:
rails: '7.0'
- ruby: 'jruby'
rails: '6.1'
- ruby: 'truffleruby'
rails: '8.0'
- ruby: 'truffleruby'
rails: '7.2'
- ruby: 'truffleruby'
Expand All @@ -106,7 +118,7 @@ jobs:
SKIPPED_ADAPTERS: ${{ matrix.skipped_adapters }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup MySQL and PostgreSQL via Docker Compose
run: docker compose up -d --wait
- name: Install Ruby
Expand All @@ -117,36 +129,38 @@ jobs:
- name: Run tests
run: bundle exec rake spec
- name: Upload code coverage results as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}
include-hidden-files: true
path: coverage/.resultset.json
coverage:
name: Calculate test coverage
needs: tests
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_7.1.gemfile
BUNDLE_GEMFILE: gemfiles/activerecord_8.0.gemfile
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: coverage-resultsets
- name: Display structure of downloaded files
run: ls -Rla
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
ruby-version: '3.3'
bundler-cache: true
- name: Collate coverage reports
run: ${{ matrix.env }} bundle exec rake ci:coverage:collate
- name: Upload total code coverage result as an artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-total
include-hidden-files: true
path: coverage/.last_run.json
- name: Fetch total coverage values from simplecov files
id: coverage
Expand All @@ -159,7 +173,7 @@ jobs:
echo "Total branch test coverage: ${{ steps.coverage.outputs.COVERAGE_BRANCH }}%"
- name: Fail if coverage is less than 100%
if: steps.coverage.outputs.COVERAGE_LINE != 100 || steps.coverage.outputs.COVERAGE_BRANCH != 100
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: "core.setFailed('Please make sure test coverage is 100%. \
Currently: ${{ steps.coverage.outputs.COVERAGE_LINE }}% (line), \
Expand Down
62 changes: 52 additions & 10 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,27 +1,69 @@
appraise "activerecord-6.0" do
gem "activerecord", "~> 6.0.6"
gem "activesupport", "~> 6.0.6"
gem "activerecord", "~> 6.0.0"
gem "activesupport", "~> 6.0.0"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 1.4.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end

appraise "activerecord-6.1" do
gem "activerecord", "~> 6.1.7"
gem "activesupport", "~> 6.1.7"
gem "activerecord", "~> 6.1.0"
gem "activesupport", "~> 6.1.0"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 1.4.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end

appraise "activerecord-7.0" do
gem "activerecord", "~> 7.0.8"
gem "activesupport", "~> 7.0.8"
gem "activerecord", "~> 7.0.0"
gem "activesupport", "~> 7.0.0"
gem "standard", "~> 1.31"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 1.6.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end

appraise "activerecord-7.1" do
gem "activerecord", "~> 7.1.3"
gem "activesupport", "~> 7.1.3"
gem "activerecord", "~> 7.1.0"
gem "activesupport", "~> 7.1.0"
gem "standard", "~> 1.31"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 1.6.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end

appraise "activerecord-7.2" do
gem "activerecord", "~> 7.2"
gem "activesupport", "~> 7.2"
gem "activerecord", "~> 7.2.0"
gem "activesupport", "~> 7.2.0"
gem "standard", "~> 1.31"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 2.0.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end

appraise "activerecord-8.0" do
gem "activerecord", "~> 8.0.0"
gem "activesupport", "~> 8.0.0"
gem "standard", "~> 1.31"

platforms :ruby, :truffleruby do
gem "sqlite3", "~> 2.2.0"
gem "pg", "~> 1.5.8"
gem "mysql2", "~> 0.5.6"
end
end
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ActiveRecord version. This is done with the help of
For example:

```shell
$ BUNDLE_GEMFILE=gemfiles/activerecord_6.1.gemfile rake
$ BUNDLE_GEMFILE=gemfiles/activerecord_8.0.gemfile rake
```

The configuration used to access the databases is stored in
Expand Down
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
source "https://rubygems.org"

gemspec

gem "rspec", "~> 3.13"
gem "rake", "~> 13.0"
gem "simplecov", "~> 0.21"
gem "standard", ">= 0.0.1", "< 2.0"

platforms :jruby do
gem "activerecord-jdbcsqlite3-adapter", ">= 60.0"
gem "activerecord-jdbcpostgresql-adapter", ">= 60.0"
gem "activerecord-jdbcmysql-adapter", ">= 60.0"
end
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Code Climate](https://codeclimate.com/github/jpignata/temping.png)](https://codeclimate.com/github/jpignata/temping)
[![Build Status](https://github.com/jpignata/temping/workflows/checks/badge.svg?branch=master)](https://github.com/jpignata/temping/actions)
[![Gem Version](https://badge.fury.io/rb/temping.png)](http://badge.fury.io/rb/temping)
[![Gem Version](https://badge.fury.io/rb/temping.png)](https://badge.fury.io/rb/temping)

Temping allows you to create arbitrary ActiveRecord models backed by a temporary
SQL table for use in tests. You may need to do something like this if you're
Expand Down Expand Up @@ -222,7 +222,7 @@ Temping.create("continents/countries/cities/streets/buildings")

## Foreign Keys

Temporary tables in [MySQL](https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html)
Temporary tables in [MySQL](https://dev.mysql.com/doc/refman/9.1/en/create-table-foreign-keys.html)
cannot have foreign keys. PostgreSQL doesn't have this limitation.

If you want to use foreign keys with Temping in MySQL you might want to consider
Expand All @@ -244,20 +244,21 @@ is about using **temporary** tables.

The latest version of this gem is tested with the following setups:

* MRI 3.2 with ActiveRecord 7.2, 7.1, 7.0
* MRI 3.3 with ActiveRecord 8.0, 7.2, 7.1, 7.0
* MRI 3.2 with ActiveRecord 8.0, 7.2, 7.1, 7.0
* MRI 3.1 with ActiveRecord 7.2, 7.1, 7.0, 6.1
* MRI 3.0 with ActiveRecord 7.1, 7.0, 6.1
* MRI 2.7 with ActiveRecord 7.1, 7.0, 6.1, 6.0
* MRI 2.6 with ActiveRecord 6.1, 6.0
* MRI 2.5 with ActiveRecord 6.1, 6.0
* JRuby with ActiveRecord 7.0, 6.1 (with activerecord-jdbc-adapter)
* TruffleRuby with ActiveRecord 7.2, 7.1, 7.0, 6.1, 6.0
* TruffleRuby with ActiveRecord 8.0, 7.2, 7.1, 7.0, 6.1, 6.0

with the following database systems:

* SQLite3
* MySQL (versions 5.5-9.0)
* PostgreSQL (versions 10-16)
* MySQL (versions 5.6-9.1)
* PostgreSQL (versions 10-17)

If you need to support older versions of Ruby or ActiveRecord you might have to use
the older versions of this gem (4.0.0 or below).
Expand Down
Loading

0 comments on commit 94b9537

Please sign in to comment.