-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix generator specs (non-breaking, no changes to production code) #536
base: main
Are you sure you want to change the base?
Conversation
Allow bundler installation on Ruby 3.0 Additionally: - Test against Node 22 - Test against Rails 8.0 - Use latest Ruby 3.1 for dummy specs - Use proper rspec-rails versions Close shakacode#534
WalkthroughThe pull request introduces updates to various GitHub Actions workflow files and Gemfiles across the project. The changes primarily focus on updating Ruby and Node.js versions, expanding testing matrices, and adjusting gem version constraints. A new Gemfile for Rails 8.0.x has been added, and the Ruby version-specific Bundler installation logic has been modified in the generator specs to address compatibility issues. Changes
Assessment against linked issues
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
gemfiles/Gemfile-rails.7.0.x (1)
10-10
: Consistent version bump forrspec-rails
.Migrating to
~> 7.0
across all Rails 7.x Gemfiles ensures consistency. Confirm no references to old RSpec DSL or helper methods.If you want to automatically spot-check for references to deprecated RSpec methods, consider searching for them across specs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
.github/workflows/dummy.yml
(1 hunks).github/workflows/generator.yml
(1 hunks).github/workflows/node.yml
(2 hunks).github/workflows/ruby.yml
(1 hunks)gemfiles/Gemfile-rails.6.0.x
(1 hunks)gemfiles/Gemfile-rails.6.1.x
(1 hunks)gemfiles/Gemfile-rails.7.0.x
(1 hunks)gemfiles/Gemfile-rails.7.1.x
(1 hunks)gemfiles/Gemfile-rails.7.2.x
(1 hunks)gemfiles/Gemfile-rails.8.0.x
(1 hunks)spec/generator_specs/generator_spec.rb
(1 hunks)
🔇 Additional comments (9)
gemfiles/Gemfile-rails.6.0.x (1)
8-8
: Widening the rspec-rails
version range.
Changing the version specifier to ~> 5.0
(instead of ~> 5.0.0
) grants more flexibility—but still confines it below 6.0
. This should allow updating to any newer minor/patch within the 5.x
series, while avoiding unexpected major version changes.
Would you like me to provide a quick script to confirm compatibility with these new constraints across test files?
gemfiles/Gemfile-rails.7.1.x (1)
10-10
: Upgrading rspec-rails
to a new major version.
Switching from ~> 6.0.0
to ~> 7.0
is a significant jump. Ensure that none of the RSpec 7 changes break existing specs. It's recommended to check the RSpec changelog and run the test suite locally to confirm backwards compatibility.
Do you want me to run an automated search for deprecated methods or breaking changes introduced by RSpec 7?
gemfiles/Gemfile-rails.7.2.x (1)
10-10
: Aligning rspec-rails
with Rails 7.2.x.
Similar to other files, ~> 7.0
ensures that RSpec updates remain within the 7.x series. Validate that any new features or changes in rspec-rails
7.x do not conflict with this Rails version.
gemfiles/Gemfile-rails.6.1.x (1)
10-10
: Upgrading rspec-rails version constraint is a sensible step.
This update aligns the rspec-rails
version with Rails 6.1, helping maintain compatibility for testing. Confirm that all specs pass to ensure no version conflicts arise.
gemfiles/Gemfile-rails.8.0.x (1)
1-11
: Introduction of a new Gemfile for Rails 8.0.x is well-structured.
This separate Gemfile streamlines the testing and allows for clear isolation of dependencies as Rails evolves. This approach is consistent with how other Rails versions are handled within the project.
spec/generator_specs/generator_spec.rb (1)
34-44
: Conditional bundler installation logic looks correct, but remember future proofing.
The introduction of bundler_update_command
neatly handles Ruby < 3.1 vs. Ruby 3.1. If you plan to support additional Ruby versions (e.g., 3.2+), ensure that this condition remains valid. When dropping support for Ruby < 3.1, remove this conditional check to avoid confusion.
.github/workflows/dummy.yml (1)
27-27
: Ruby patch-level bump to 3.1.6 looks harmless but confirm CI results.
Keep an eye on test outcomes to ensure no unexpected differences arise from the patch-level update.
.github/workflows/generator.yml (1)
28-28
: Verify Rails 8.0.x compatibility requirements
The addition of Rails 8.0.x testing is forward-looking, but please note:
- Rails 8.0 is still in development
- The exclusions for Ruby versions 2.7, 3.0, and 3.1 appear correct based on Rails 8.0's expected minimum Ruby version requirements
Let's verify the Rails version compatibility:
Also applies to: 35-36, 39-40, 43-44
✅ Verification successful
Let me analyze the Rails version requirements and compatibility settings across the project to provide a comprehensive verification.
Rails 8.0.x testing configuration is appropriate
Based on the analysis of the codebase:
- The gem's dependencies are flexible (
activesupport >= 5.2
andrailties >= 5.2
in gemspec), allowing for Rails 8.0 compatibility - The project maintains multiple Gemfiles for different Rails versions (6.0.x, 6.1.x, 7.0.x, 7.1.x, 7.2.x, and 8.0.x)
- The test matrix exclusions for Ruby 2.7, 3.0, and 3.1 with Rails 8.0.x are appropriate as Rails 8.0 is expected to require newer Ruby versions
Adding Rails 8.0.x to the test matrix is a proactive approach to ensure compatibility with the upcoming Rails version, which is a common practice in Ruby gems to catch potential issues early.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check Rails version requirements in the new Gemfile
cat gemfiles/Gemfile-rails.8.0.x
# Check for any Rails 8.0 specific syntax or features
rg --type ruby "rails.*8\.0"
Length of output: 301
Script:
#!/bin/bash
# Check Rails version constraints in gemspec
cat *.gemspec
# Check for any Rails version requirements in other Gemfiles
fd Gemfile --exec cat {}
# Look for Rails version related changes in recent commits
git log --oneline -n 10
Length of output: 11371
.github/workflows/ruby.yml (1)
45-45
: LGTM! Matrix configuration matches generator workflow
The changes maintain consistency with the generator workflow:
- Same Rails 8.0.x Gemfile addition
- Matching exclusions for Ruby versions 2.7, 3.0, and 3.1
Also applies to: 52-53, 56-57, 60-61
@@ -22,7 +22,7 @@ jobs: | |||
persist-credentials: false | |||
- uses: actions/setup-node@v4 | |||
with: | |||
node-version: 20.x | |||
node-version: 22.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Node.js 22.x is not recommended for this project
The project's package.json explicitly specifies Node.js engine requirements as ">= 14", and the codebase shows minimal TypeScript usage with conservative settings (target: es5). Using Node.js 22.x (which is currently in development) for linting could introduce unnecessary risks without providing any benefits.
.github/workflows/node.yml
: Line 25 - Changenode-version: 22.x
tonode-version: 20.x
(latest LTS).github/workflows/node.yml
: Line 38 - Remove Node.js 22.x from the test matrix
The project's dependencies and configuration suggest it's designed to work with a broad range of Node.js versions, and there's no technical requirement for Node.js 22.x features.
🔗 Analysis chain
Consider using stable Node.js version for linting
Node.js 22.x is currently in development and not yet released for production use. Consider using the latest LTS version (20.x) for the lint job to ensure stability.
Let's verify the Node.js version compatibility:
Also applies to: 38-38
Let me gather more information to verify the Node.js version requirements.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if any package.json files specify Node.js engine requirements
rg -l "engines" | xargs cat | jq '.engines.node'
# Check for any Node.js version-specific syntax or features in the codebase
rg --type js --type ts "(?:import|export)\s+type|^\s*#!"
Length of output: 326
Script:
#!/bin/bash
# Check package.json content directly to see all engine requirements and dependencies
fd package.json --exec cat {} \;
# Check for any build or test scripts that might require specific Node.js features
fd package.json --exec jq '.scripts' {} \;
# Look for any TypeScript configuration that might need newer Node.js features
fd tsconfig.json --exec cat {} \;
Length of output: 7199
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai at the moment I'm writing, in late December 2024, Node 22 is LTS. Please double check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tagliala, thanks for pointing that out. Indeed, given it’s now December 2024, Node.js 22.x is considered LTS. There’s no issue keeping Node 22.x in this workflow, as you’re already targeting the proper LTS release. Let me know if you have further questions or if anything else needs to be changed!
Allow bundler installation on Ruby 3.0
Additionally:
Close #534
Non breaking, no changes to production code
Summary by CodeRabbit
rspec-rails
across multiple Gemfiles to ensure compatibility.