Skip to content

Commit

Permalink
Update CI matrix to make sure recent Ruby and ActiveRecord versions a…
Browse files Browse the repository at this point in the history
…re supported (#65)

* Update Ruby and Rails versions in CI matrix

* Rails 8 needs Ruby 3.2 or higher

* Rails 7.1 seems to wrap the error

* Add Ruby 3.4 to the matrix

* Comment on the proper line

* Add comment why we want to continue on error

* Include gems with older Rails versions

This is actually only required for Ruby 3.4 compatibility.

* Remove references about Rails 5, that's not supported anymore

* Update local Ruby version to most recent one
  • Loading branch information
markoudev authored Jan 7, 2025
1 parent 024da00 commit a3ada13
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 27 deletions.
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

0 comments on commit a3ada13

Please sign in to comment.