Add Rails version matrix to CI#351
Open
OdenTakashi wants to merge 1 commit into
Open
Conversation
fbd18c6 to
1dfcd83
Compare
aeb8eb4 to
30bb4dd
Compare
for Rails 8 Run integration tests across Rails 7.1, 7.2, 8.0, and 8.1. Allow sqlite3 2.x in dummyapp for Rails 8, and keep Rails 8-specific datetime overrides in separate spec templates
30bb4dd to
3214f02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend integration CI to run against Rails 7.2, 8.0, and 8.1 across all database adapters.
Add Rails 8–specific expected-output templates only where schema annotation formatting differs (mainly datetime defaults), while keeping existing templates as the default fallback.
Problem
Integration tests were pinned to a single Rails version (~> 7.1.0), so regressions on newer Rails releases could go unnoticed. When running against Rails 8, some integration specs failed because Rails 8 changed how datetime default values appear in schema annotations (e.g. nanosecond precision and UTC suffix). Updating every template globally would add noise and break expectations for older Rails
versions.
Solution
• Add a rails dimension to the integration CI matrix and pass RAILS_VERSION through dummyapp setup and test execution.
• Make the dummyapp Gemfile respect RAILS_VERSION, and allow sqlite3 2.x when testing Rails 8.
• Teach SpecHelper::Aruba#model_template to prefer spec/templates/rails8// when running on Rails 8 and an override exists; otherwise fall back to the existing spec/templates//templates.
• Add Rails 8 overrides only for the specs that compare datetime output (12 files total), avoiding unnecessary duplication of the full template set.
Note
The spec/templates/rails8/ overrides exist solely because Rails 8 changed how datetime default values are rendered in schema comments. This comes from rails/rails#52371(rails/rails#52371), which updated TimeWithZone#inspect to use ISO 8601-style formatting (e.g. 2023-07-04 12:34:56...) instead of the RFC 822-style format used on Rails 7.2 and earlier (e.g. Tue, 04 Jul 2023 12:34:56...).
As long as we keep Rails 7.2 in the CI matrix, we need separate golden files for the specs that assert datetime defaults. If we drop Rails 7.2 support later, every tested Rails version would share the same output format, and we could remove the rails8/ directory and the version-specific template lookup in model_template — the matrix CI would still work with a single set of templates.