Skip to content

Update CI matrix to make sure recent Ruby and ActiveRecord versions are supported #65

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

Merged
merged 9 commits into from
Jan 7, 2025
Merged
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
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ concurrency:

jobs:
tests:
# Continue on error so that we see the results of all tests in the matrix.
continue-on-error: true
strategy:
matrix:
ruby: [ "3.3", "3.2", "3.1", "3.0" ]
rails: [ "7.0", "6.1"]
include:
- { ruby: "2.7", rails: "6.0" }
- { ruby: "2.7", rails: "5.2" }
- { ruby: "2.7", rails: "5.1" }
- { ruby: "2.7", rails: "5.0" }
ruby: [ "3.4", "3.3", "3.2", "3.1" ]
rails: [ "8.0", "7.1", "7.0", "6.1" ]
exclude:
# Rails 8 needs Ruby 3.2 or higher
- { ruby: "3.1", rails: "8.0" }
name: "tests (Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }})"
runs-on: ubuntu-latest
env:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.4.1
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ by default. But it's good to be aware of this in case you're running into
weirdness.


# Known issues
* With Rails 5.0 in combination with uniqueness validations, ActiveRecord
generates a wrong query. The `x` in front of the queried value, which casts
the value to the proper data type, is missing.


# Contributing
To start coding on `mysql-binuuid-rails`, fork the project, clone it locally
and then run `bin/setup` to get up and running. If you want to fool around in
Expand Down
3 changes: 0 additions & 3 deletions test/gemfiles/rails-5.2.gemfile

This file was deleted.

3 changes: 0 additions & 3 deletions test/gemfiles/rails-6.0.gemfile

This file was deleted.

4 changes: 4 additions & 0 deletions test/gemfiles/rails-6.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source "https://rubygems.org"
gemspec path: "../.."
gem "activerecord", "~> 6.1.0"

gem "bigdecimal"
gem "drb"
gem "mutex_m"
4 changes: 4 additions & 0 deletions test/gemfiles/rails-7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source "https://rubygems.org"
gemspec path: "../.."
gem "activerecord", "~> 7.0.0"

gem "bigdecimal"
gem "drb"
gem "mutex_m"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"
gemspec path: "../.."
gem "activerecord", "~> 5.0.0"
gem "activerecord", "~> 7.1.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"
gemspec path: "../.."
gem "activerecord", "~> 5.1.0"
gem "activerecord", "~> 8.0.0"
8 changes: 3 additions & 5 deletions test/integration/mysql_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class BeforePersistedTest < MySQLIntegrationTest
end

test "validates uniqueness" do
if ActiveRecord.version < Gem::Version.new("5.1.0")
skip("Skipping uniqueness validation test, known issue on Rails/ActiveRecord 5.0")
end

uuid = SecureRandom.uuid
MyUuidModelWithValidations.create!(the_uuid: uuid)
duplicate = MyUuidModelWithValidations.new(the_uuid: uuid)
Expand Down Expand Up @@ -106,7 +102,9 @@ class AfterPersistedTest < MySQLIntegrationTest
end

test "can't be used to inject SQL using .where" do
assert_raises MySQLBinUUID::InvalidUUID do
# In Rails 7.1, the error gets wrapped in an ActiveRecord::StatementInvalid.
expected_error = ActiveRecord.version.to_s.start_with?("7.1") ? ActiveRecord::StatementInvalid : MySQLBinUUID::InvalidUUID
assert_raises(expected_error) do
MyUuidModel.where(the_uuid: "' OR ''='").first
end
end
Expand Down
Loading