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

Add Ruby 3.4 preview 2 to the CI #1340

Merged
merged 5 commits into from
Dec 5, 2024
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
654 changes: 653 additions & 1 deletion .github/workflows/ci.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ ext/*.bundle
ext/*.o
ext/*.so
ext/*.report
ext/*.bundle.dSYM
pkg/
11 changes: 11 additions & 0 deletions build_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ matrix:
- "rails-8.0"

ruby:
- ruby: "3.4.0-preview2"
- ruby: "3.3.4"
- ruby: "3.2.5"
- ruby: "3.1.6"
Expand All @@ -102,6 +103,7 @@ matrix:
- gem: "dry-monitor"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -110,20 +112,23 @@ matrix:
- gem: "hanami-2.0"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
- "3.0.7"
- gem: "hanami-2.1"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
- "3.0.7"
- gem: "hanami-2.2"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -132,6 +137,7 @@ matrix:
- gem: "psych-3"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -140,6 +146,7 @@ matrix:
- gem: "psych-4"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -165,6 +172,7 @@ matrix:
- gem: "rails-7.0"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -174,6 +182,7 @@ matrix:
- gem: "rails-7.1"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
Expand All @@ -182,13 +191,15 @@ matrix:
- gem: "rails-7.2"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- "3.1.6"
- "jruby-9.4.7.0"
- gem: "rails-8.0"
only:
ruby:
- "3.4.0-preview2"
- "3.3.4"
- "3.2.5"
- gem: "sequel"
Expand Down
11 changes: 6 additions & 5 deletions gemfiles/padrino.gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gem 'padrino', "~> 0.15"
gem 'rack', "~> 2"
gem 'sinatra', "~> 2"
gem "base64" # Ruby 3.4 requirement
gem "padrino", "~> 0.15"
gem "rack", "~> 2"
gem "sinatra", "~> 2"

gemspec :path => '../'
gemspec :path => "../"
3 changes: 3 additions & 0 deletions gemfiles/rails-7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
source "https://rubygems.org"

gem "base64" # Ruby 3.4 requirement
gem "drb" # Ruby 3.4 requirement
gem "mutex_m" # Ruby 3.4 requirement
gem "rails", "~> 7.0.1"
gem "rake", "> 12.2"
gem "sidekiq"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/webmachine2.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "https://rubygems.org"

gem "mutex_m" # Ruby 3.4 requirement
gem "webmachine", "~> 2.0"
gem "webrick"

Expand Down
6 changes: 5 additions & 1 deletion lib/appsignal/probes/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def initialize(config = {})
is_sidekiq7 = self.class.sidekiq7_and_greater?
@adapter = is_sidekiq7 ? Sidekiq7Adapter : Sidekiq6Adapter

config_string = " with config: #{config}" unless config.empty?
unless config.empty?
formatted_config =
config.map { |key, value| "#{key}: #{value.inspect}" }.join(", ")
config_string = " with config: #{formatted_config}"
end
Appsignal.internal_logger.debug("Initializing Sidekiq probe#{config_string}")
require "sidekiq/api"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
end

it "should return a payload with name and sanitized body" do
query =
if DependencyHelper.ruby_3_4_or_newer?
"{index: \"users\", type: \"user\", q: \"?\"}"
else
"{:index=>\"users\", :type=>\"user\", :q=>\"?\"}"
end
expect(formatter.format(payload)).to eql([
"Search: User",
"{:index=>\"users\", :type=>\"user\", :q=>\"?\"}"
query
])
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/appsignal/probes/sidekiq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def with_sidekiq6!
log = capture_logs { probe }
expect(log).to contains_log(
:debug,
%(Initializing Sidekiq probe with config: {:hostname=>"#{redis_hostname}"})
%(Initializing Sidekiq probe with config: hostname: "#{redis_hostname}")
)
log = capture_logs { probe.call }
expect(log).to contains_log(
Expand Down
6 changes: 5 additions & 1 deletion spec/lib/appsignal/utils/data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def generate(object)

it "casts unsupported key types to string" do
expect(generate([1, 2] => "abc").to_s).to eq(%({"[1, 2]":"abc"}))
expect(generate({ :a => "b" } => "abc").to_s).to eq(%({"{:a=>\\"b\\"}":"abc"}))
if DependencyHelper.ruby_3_4_or_newer?
expect(generate({ :a => "b" } => "abc").to_s).to eq(%({"{a: \\"b\\"}":"abc"}))
else
expect(generate({ :a => "b" } => "abc").to_s).to eq(%({"{:a=>\\"b\\"}":"abc"}))
end
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/support/helpers/dependency_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def ruby_3_2_or_newer?
ruby_version >= Gem::Version.new("3.2.0")
end

def ruby_3_4_or_newer?
ruby_version >= Gem::Version.new("3.4.0")
end

def running_jruby?
Appsignal::System.jruby?
end
Expand Down
Loading