Skip to content
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

Test against Rails 8.0 #540

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

tagliala
Copy link
Contributor

@tagliala tagliala commented Jan 7, 2025

Summary

Pull Request checklist

  • Add/update test to cover these changes
  • Update documentation
  • Update CHANGELOG file

Other Information

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Rails 8.0.x in testing workflows
    • Updated RSpec Rails gem to version 7.0 across multiple Gemfile configurations
  • Chores

    • Enhanced continuous integration matrix to include latest Rails version
    • Updated testing compatibility for different Ruby versions
  • Testing

    • Expanded test coverage for Rails and Ruby version combinations
    • Refined test matrix exclusions to prevent incompatible version testing

Copy link

coderabbitai bot commented Jan 7, 2025

Walkthrough

This pull request introduces updates to GitHub Actions workflows and Gemfiles to support testing with Rails 8.0.x. The changes include adding a new Gemfile for Rails 8.0.x, updating the testing matrix in GitHub Actions workflows, and modifying rspec-rails gem versions across existing Gemfiles. The workflow configurations are expanded to include the new Rails version while maintaining specific exclusions for certain Ruby versions to ensure compatibility.

Changes

File Change Summary
.github/workflows/generator.yml Added Rails 8.0.x to testing matrix and excluded Ruby 2.7, 3.0, and 3.1 for this version
.github/workflows/ruby.yml Added Rails 8.0.x to testing matrix with similar exclusions
gemfiles/Gemfile-rails.7.0.x Updated rspec-rails from ~> 6.0.0 to ~> 7.0
gemfiles/Gemfile-rails.7.1.x Updated rspec-rails from ~> 6.0.0 to ~> 7.0
gemfiles/Gemfile-rails.7.2.x Updated rspec-rails from ~> 6.0.0 to ~> 7.0
gemfiles/Gemfile-rails.8.0.x New Gemfile created with Rails 8.0.x dependencies

Possibly related PRs

Suggested reviewers

  • justin808
  • tomdracz

Poem

🐰 A Rails upgrade, version eight point oh!
Workflows dancing, test matrix aglow
Gems updated with careful delight
Compatibility checked, everything's right
Ruby's journey continues to grow 🚀


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tagliala tagliala force-pushed the chore/test-against-rails-80 branch from 0f11e01 to 78954f5 Compare January 7, 2025 20:58
@tagliala tagliala changed the title Chore/test against rails 80 Test against Rails 8.0 Jan 7, 2025
Copy link
Collaborator

@tomdracz tomdracz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase with main branch now the other bits are merged and I'll merge this one? @tagliala

Additionally, update rspec-rails in Rails >= 7.0 gemspecs
@tagliala tagliala force-pushed the chore/test-against-rails-80 branch from 78954f5 to e5fafae Compare January 8, 2025 10:13
@tagliala tagliala marked this pull request as ready for review January 8, 2025 10:13
@tagliala
Copy link
Contributor Author

tagliala commented Jan 8, 2025

@tomdracz something is happening and specs on master are failing. It looks like a side effect of #537. There should be something related to the cache 😞

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
gemfiles/Gemfile-rails.8.0.x (1)

8-11: Consider adding version constraints for development dependencies

While the gem versions are consistent with other Gemfiles, consider adding upper version bounds for development dependencies to prevent unexpected issues.

-gem "rake", ">= 11.1"
+gem "rake", "~> 13.0", ">= 11.1"
-gem "byebug"
+gem "byebug", "~> 11.0"
.github/workflows/ruby.yml (1)

Line range hint 1-1: Fix pipeline warning about default branch.

The pipeline shows a warning about using the deprecated 'master' branch name. Consider updating the repository settings to use 'main' as the default branch name.

🧰 Tools
🪛 GitHub Actions: Generator specs

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65b88c9 and e5fafae.

📒 Files selected for processing (6)
  • .github/workflows/generator.yml (1 hunks)
  • .github/workflows/ruby.yml (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)
🧰 Additional context used
🪛 GitHub Actions: Generator specs
.github/workflows/ruby.yml

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.

.github/workflows/generator.yml

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.

🔇 Additional comments (9)
gemfiles/Gemfile-rails.7.0.x (1)

10-10: Verify compatibility with rspec-rails 7.0

The upgrade to rspec-rails 7.0 is significant. Let's verify the compatibility requirements.

✅ Verification successful

The upgrade to rspec-rails 7.0 is compatible with Rails 7.0

The gemspec confirms that rspec-rails 7.x is explicitly designed to work with Rails 7.0 and above. No significant compatibility issues were found between rspec-rails 7.0 and Rails 7.0.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check rspec-rails compatibility requirements
curl -s https://rubygems.org/api/v1/versions/rspec-rails.json | jq -r '.[] | select(.number | startswith("7.")) | .number' | head -n 1

# Check for any reported issues with Rails 7.0
gh api graphql -f query='
{
  search(query: "repo:rspec/rspec-rails is:issue Rails 7.0", type: ISSUE, first: 5) {
    nodes {
      ... on Issue {
        title
        state
        url
      }
    }
  }
}'

Length of output: 1080


Script:

#!/bin/bash
# Check rspec-rails dependencies and release notes
curl -s "https://raw.githubusercontent.com/rspec/rspec-rails/main/rspec-rails.gemspec" | grep -A 5 "spec.add_runtime_dependency"

# Get changelog entries for 7.x
curl -s "https://raw.githubusercontent.com/rspec/rspec-rails/main/Changelog.md" | awk '/^## 7\./{p=1}/^## 6\./{p=0}p'

Length of output: 244


Script:

#!/bin/bash
# Fetch gemspec content using GitHub API
gh api \
  -H "Accept: application/vnd.github.raw" \
  /repos/rspec/rspec-rails/contents/rspec-rails.gemspec

# Search for Rails version requirements in the repository
rg -i "rails.*dependency|rails.*requirement" --type ruby

Length of output: 2630

gemfiles/Gemfile-rails.7.1.x (1)

10-10: LGTM! Consistent with Rails 7.0.x changes

The update to rspec-rails "~> 7.0" maintains consistency across Rails 7.x versions.

gemfiles/Gemfile-rails.7.2.x (1)

10-10: LGTM! Maintains consistency across Rails 7.x series

The update to rspec-rails "~> 7.0" is consistent with other Rails 7.x Gemfiles.

gemfiles/Gemfile-rails.8.0.x (2)

1-11: LGTM! Successfully implements Rails 8.0 testing support

The new Gemfile successfully implements the PR objective of adding Rails 8.0 testing support while maintaining consistency with existing Gemfiles.


7-7: Verify Rails 8.0 compatibility with dependent gems

Since Rails 8.0 is a major version upgrade, we should verify compatibility with other gems in the Gemfile.

✅ Verification successful

Dependencies are compatible with Rails 8.0

The Gemfile configuration is consistent with other version-specific Gemfiles and all key dependencies are compatible:

  • rspec-rails 7.1.0 supports Rails 8.0
  • rack-proxy 0.7.7 and other dependencies have no version conflicts
  • Gemfile structure follows the established pattern from other Rails version Gemfiles
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check Rails 8.0 requirements and compatibility
curl -s https://rubygems.org/api/v1/versions/rails.json | jq -r '.[] | select(.number | startswith("8.")) | .number' | head -n 1

# Check for any compatibility issues with rack-proxy
curl -s https://rubygems.org/api/v1/versions/rack-proxy.json | jq -r 'map(select(.prerelease == false)) | .[0].number'

Length of output: 263


Script:

#!/bin/bash
# Check rspec-rails versions and dependencies
curl -s https://rubygems.org/api/v1/versions/rspec-rails.json | jq -r 'map(select(.prerelease == false)) | .[0] | {number, built_at}'

# List all gems in the Rails 8.0 Gemfile
cat gemfiles/Gemfile-rails.8.0.x

# Check for any Rails version specific requirements in other Gemfiles
fd Gemfile --exec grep -H "rails" {}

Length of output: 2612

.github/workflows/generator.yml (2)

28-28: LGTM! Rails 8.0.x test matrix addition.

The addition of Rails 8.0.x testing is properly configured in the matrix.

🧰 Tools
🪛 GitHub Actions: Generator specs

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.


35-36: Verify Ruby version compatibility with Rails 8.0

The exclusions for Ruby 2.7, 3.0, and 3.1 with Rails 8.0.x follow the same pattern as Rails 7.2.x exclusions, which is good. However, let's verify these exclusions against Rails 8.0's official Ruby version requirements.

Also applies to: 39-40, 43-44

🧰 Tools
🪛 GitHub Actions: Generator specs

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.

.github/workflows/ruby.yml (2)

46-46: LGTM! Consistent Rails 8.0.x configuration.

The Rails 8.0.x test matrix addition matches the configuration in generator.yml, maintaining consistency across workflows.

🧰 Tools
🪛 GitHub Actions: Generator specs

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.


53-54: LGTM! Matching exclusion rules.

The Ruby version exclusions for Rails 8.0.x are identical to generator.yml, ensuring consistent testing behavior across workflows.

Also applies to: 57-58, 61-62

🧰 Tools
🪛 GitHub Actions: Generator specs

[warning] Using deprecated 'master' as default branch name. Consider configuring init.defaultBranch to use 'main', 'trunk', or 'development' instead.

@tagliala
Copy link
Contributor Author

tagliala commented Jan 8, 2025

Findings

Ref: tagliala#5

Failing specs:

  • Generator specs / Generator specs (ubuntu-latest, 2.7, gemfiles/Gemfile-rails.6.0.x) (pull_request) Failing after 4m
  • Generator specs / Generator specs (ubuntu-latest, 2.7, gemfiles/Gemfile-rails.7.1.x) (pull_request) Failing after 4m
  • Generator specs / Generator specs (ubuntu-latest, 3.0, gemfiles/Gemfile-rails.6.1.x) (pull_request) Failing after 3m
  • Generator specs / Generator specs (ubuntu-latest, 3.3, gemfiles/Gemfile-rails.7.2.x) (pull_request) Failing after 3m

Failures are random.

Second run:

  • Generator specs / Generator specs (ubuntu-latest, 3.2, gemfiles/Gemfile-rails.7.1.x) (pull_request) Failing after 2m
  • Generator specs / Generator specs (ubuntu-latest, 3.2, gemfiles/Gemfile-rails.7.2.x) (pull_request) Failing after 2m

@tomdracz tomdracz merged commit e52b335 into shakacode:main Jan 8, 2025
31 of 55 checks passed
@tomdracz
Copy link
Collaborator

tomdracz commented Jan 8, 2025

Generator specs are temperamental but this LGTM so I'll merge and investigate the job failures separately

@tagliala tagliala deleted the chore/test-against-rails-80 branch January 8, 2025 12:18
@tagliala
Copy link
Contributor Author

tagliala commented Jan 8, 2025

The problem should be related to the huge number of requests to npm

Ref: https://github.com/tagliala/shakapacker/actions/runs/12670742912/job/35311027351

npm error network Invalid response body while trying to fetch https://registry.npmjs.org/npm: aborted
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly.  See: 'npm help config'
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-01-08T12_42_31_526Z-debug-0.log
Command output:
      create  config/shakapacker.yml
      remove  /home/runner/work/shakapacker/shakapacker/lib/install/package.json
Copying webpack core config
      create  config/webpack
      create  config/webpack/webpack.config.js
Creating packs app source directory
      create  app/javascript/packs
      create  app/javascript/packs/application.js
       apply  /home/runner/work/shakapacker/shakapacker/lib/install/binstubs.rb
  Copying binstubs
       exist    bin
      create    bin/shakapacker
      create    bin/shakapacker-dev-server
      append  .gitignore
Add JavaScript include tag in application layout
      insert  app/views/layouts/application.html.erb
Run npm install during bin/setup
      insert  bin/setup
Installing [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants