From 09b7bc0887294be199e3bb61d46b75f277c67b98 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Wed, 6 Nov 2024 16:04:33 +0100 Subject: [PATCH 1/6] Appraisal group generation replacement --- .gitignore | 1 + .vscode/settings.json | 1 + appraisal/generate.rb | 88 +++++++++++++++++++++++++++++++++++++++++++ gemfile_migration.rb | 36 ++++++++++++++++++ tasks/dependency.rake | 6 +++ 5 files changed, 132 insertions(+) create mode 100644 appraisal/generate.rb create mode 100644 gemfile_migration.rb diff --git a/.gitignore b/.gitignore index eeb2f45c7a5..57ae7bd8424 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ ext/**/skipped_reason.txt # lock files Gemfile.lock Gemfile-*.lock +*.gemfile.lock # bundle config gemfiles/.bundle diff --git a/.vscode/settings.json b/.vscode/settings.json index 5e0380954a2..605e69ae1d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "files.associations": { + "*.gemfile": "ruby", "Dockerfile*": "dockerfile" } } diff --git a/appraisal/generate.rb b/appraisal/generate.rb new file mode 100644 index 00000000000..c8210ded8f7 --- /dev/null +++ b/appraisal/generate.rb @@ -0,0 +1,88 @@ +# Ruby script to replace `bundle exec appraisal generate` +# +# Why??? +# +# 1. `Appraisals` file is extremely hard to extend, because the definition is evaluated by `instance_eval` +# 2. Not all `Bundler::DSL` methods are supported. +# +# This implementation provides a much easier interface to customize our needs, +# while still using the same Appraisal formatting. +# +# For example, it solves the incompatbility of `eval_gemfile` from `Bundler::DSL` +# +# Usage: `bundle exec ruby appraisal/generate.rb` + +require "appraisal/appraisal" + +require_relative "../tasks/appraisal_conversion" + +gemfile = Appraisal::Gemfile.new.tap do |g| + # Support `eval_gemfile` for `Bundler::DSL` + g.define_singleton_method(:eval_gemfile) {|file| load(file) } + g.load(ENV["BUNDLE_GEMFILE"] || "Gemfile") +end + +appraisals = [] + +REMOVED_GEMS = { + :check => [ + 'rbs', + 'steep', + 'standard', + ], + :dev => [ + 'ruby-lsp', + ], +} + +define_singleton_method(:appraise) do |name, &block| + # Customize name + name = "#{AppraisalConversion.runtime_identifier}_#{name}" + appraisal = Appraisal::Appraisal.new(name, gemfile) + appraisal.instance_eval(&block) + # Customize callback for removal + REMOVED_GEMS.each do |group_name, gems| + appraisal.group(group_name) do + gems.each { |gem_name| remove_gem gem_name } + end + end + appraisals << appraisal +end + +# Builds a matrix of versions to test for a given integration + +# `range`: the range of versions to test +# `gem` : optional, gem name to test (gem name can be different from the integration name) +# `min` : optional, minimum version to test +# `meta` : optional, additional metadata (development dependencies, etc.) for the group +def build_coverage_matrix(integration, range, gem: nil, min: nil, meta: {}) + gem ||= integration + + if min + appraise "#{integration}-min" do + gem gem, "= #{min}" + meta.each { |k, v| v ? gem(k, v) : gem(k) } + end + end + + range.each do |n| + appraise "#{integration}-#{n}" do + gem gem, "~> #{n}" + meta.each { |k, v| v ? gem(k, v) : gem(k) } + end + end + + appraise "#{integration}-latest" do + # The latest group declares dependencies without version constraints, + # still requires being updated to pick up the next major version and + # committing the changes to lockfiles. + gem gem + meta.each { |k, v| v ? gem(k, v) : gem(k) } + end +end + +load(AppraisalConversion.definition) + +puts appraisals.map(&:name) + +appraisals.each(&:write_gemfile) diff --git a/gemfile_migration.rb b/gemfile_migration.rb new file mode 100644 index 00000000000..3922e9ac624 --- /dev/null +++ b/gemfile_migration.rb @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby + +require 'fileutils' + +[ + "2.5", + "2.6", + "2.7", + "3.0", + "3.1", + "3.2", + "3.3", + "3.4", + "jruby-9.2", + "jruby-9.3", + "jruby-9.4", +].each do |v| + # For example: + # - Gemfile-3.3 -> ruby-3.3.gemfile + # - Gemfile-jruby-9.3 -> jruby-9.3.gemfile + original_file_name = "Gemfile-#{v}" + target = v.start_with?("jruby") ? v : "ruby-#{v}" + new_file_name = "#{target}.gemfile" + + # Migrate symlinked versioned Gemfile to a new file without symlinked + FileUtils.rm(original_file_name) + FileUtils.cp("Gemfile", new_file_name) + + # Update docker-compose.yml + text = File.read("docker-compose.yml") + new_contents = text.gsub(original_file_name, new_file_name) + File.open("docker-compose.yml", "w") {|file| file.puts new_contents } +end + +eval_gemfile = 'eval_gemfile("#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION.split(".").take(2).join(".")}.gemfile")' +File.open("Gemfile", "w") {|file| file.puts(eval_gemfile)} diff --git a/tasks/dependency.rake b/tasks/dependency.rake index 362baa67f28..92468ba093a 100644 --- a/tasks/dependency.rake +++ b/tasks/dependency.rake @@ -18,6 +18,12 @@ namespace :dependency do puts "`BUNDLE_GEMFILE=#{gemfiles.sample} bundle install`\n\n" end + # Replacement for `bundle exec appraisal generate` + desc "Generate dependencies for #{AppraisalConversion.runtime_identifier}" + task :generate do |t, args| + sh 'bundle exec ruby appraisal/generate.rb' + end + # Replacement for `bundle exec appraisal bundle lock` desc "Lock dependencies for #{AppraisalConversion.runtime_identifier}" task :lock do |t, args| From c1adac25fcd20564cf91e35993fa1ba947da1581 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Fri, 8 Nov 2024 09:30:20 +0100 Subject: [PATCH 2/6] Update usage --- .circleci/config.yml | 4 ++-- .github/workflows/lock-dependency.yml | 4 +--- Appraisals | 4 ++++ tasks/appraisal.rake | 8 ++++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e08bd15f98..44e9c5577b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,10 +82,10 @@ step_appraisal_install: &step_appraisal_install name: Install Appraisal gems command: | if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then - bundle exec appraisal generate + bundle exec rake dependency:generate bundle exec rake dependency:install else - bundle exec appraisal generate + bundle exec rake dependency:generate # Generate the appraisal files to match the lockfiles in the tree echo "All required gems were found in cache." fi step_compute_bundle_checksum: &step_compute_bundle_checksum diff --git a/.github/workflows/lock-dependency.yml b/.github/workflows/lock-dependency.yml index 65e0346c1ea..b2d0722ae64 100644 --- a/.github/workflows/lock-dependency.yml +++ b/.github/workflows/lock-dependency.yml @@ -98,9 +98,7 @@ jobs: gem -v bundler -v - run: bundle install - - # TODO: Migrate away from `appraisal` - - run: bundle exec appraisal generate + - run: bundle exec rake dependency:generate - run: bundle exec rake dependency:lock - uses: actions/upload-artifact@v4 with: diff --git a/Appraisals b/Appraisals index ab1c9c4949e..458ab98709c 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,7 @@ +# Do not edit this file directly. +# +# The dependency management has been migrated to `tasks/dependency.rake` + lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'datadog/version' diff --git a/tasks/appraisal.rake b/tasks/appraisal.rake index e037c987062..809f33ca409 100644 --- a/tasks/appraisal.rake +++ b/tasks/appraisal.rake @@ -58,7 +58,7 @@ namespace :appraisal do # rubocop:disable Metrics/BlockLength cmd << ['gem', 'install', 'bundler', '-v', bundler_version(ruby_version)] if bundler_version(ruby_version) cmd << [*bundle(ruby_version), 'config', 'without', 'check'] cmd << [*bundle(ruby_version), 'install'] - cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'generate'] + cmd << [*bundle(ruby_version), 'exec', 'ruby', 'appraisal/generate.rb'] cmd = cmd.map { |c| c << '&&' }.flatten.tap(&:pop) @@ -75,7 +75,7 @@ namespace :appraisal do # rubocop:disable Metrics/BlockLength cmd << ['gem', 'install', 'bundler', '-v', bundler_version(ruby_version)] if bundler_version(ruby_version) cmd << [*bundle(ruby_version), 'config', 'without', 'check'] cmd << [*bundle(ruby_version), 'install'] - cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'generate'] + cmd << [*bundle(ruby_version), 'exec', 'ruby', 'appraisal/generate.rb'] cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'bundle lock'] cmd = cmd.map { |c| c << '&&' }.flatten.tap(&:pop) @@ -95,7 +95,7 @@ namespace :appraisal do # rubocop:disable Metrics/BlockLength cmd << ['gem', 'install', 'bundler', '-v', bundler_version(ruby_version)] if bundler_version(ruby_version) cmd << [*bundle(ruby_version), 'config', 'without', 'check'] cmd << [*bundle(ruby_version), 'install'] - cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'generate'] + cmd << [*bundle(ruby_version), 'exec', 'ruby', 'appraisal/generate.rb'] cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'install'] cmd = cmd.map { |c| c << '&&' }.flatten.tap(&:pop) @@ -115,7 +115,7 @@ namespace :appraisal do # rubocop:disable Metrics/BlockLength cmd << ['gem', 'install', 'bundler', '-v', bundler_version(ruby_version)] if bundler_version(ruby_version) cmd << [*bundle(ruby_version), 'config', 'without', 'check'] cmd << [*bundle(ruby_version), 'install'] - cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'generate'] + cmd << [*bundle(ruby_version), 'exec', 'ruby', 'appraisal/generate.rb'] cmd << [*bundle(ruby_version), 'exec', 'appraisal', 'update'] cmd = cmd.map { |c| c << '&&' }.flatten.tap(&:pop) From 48aa93afcd3857dec6cb10c2dbd4cbfbe74a3634 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Wed, 13 Nov 2024 23:56:06 +0100 Subject: [PATCH 3/6] Gemfile migration --- Gemfile | 95 +------------------------------------------- Gemfile-2.5 | 1 - Gemfile-2.6 | 1 - Gemfile-2.7 | 1 - Gemfile-3.0 | 1 - Gemfile-3.1 | 1 - Gemfile-3.2 | 1 - Gemfile-3.3 | 1 - Gemfile-3.4 | 1 - Gemfile-jruby-9.2 | 1 - Gemfile-jruby-9.3 | 1 - Gemfile-jruby-9.4 | 1 - docker-compose.yml | 22 +++++----- gemfile_migration.rb | 36 ----------------- jruby-9.2.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ jruby-9.3.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ jruby-9.4.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-2.5.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-2.6.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-2.7.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-3.0.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-3.1.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-3.2.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-3.3.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ ruby-3.4.gemfile | 94 +++++++++++++++++++++++++++++++++++++++++++ 25 files changed, 1046 insertions(+), 152 deletions(-) delete mode 120000 Gemfile-2.5 delete mode 120000 Gemfile-2.6 delete mode 120000 Gemfile-2.7 delete mode 120000 Gemfile-3.0 delete mode 120000 Gemfile-3.1 delete mode 120000 Gemfile-3.2 delete mode 120000 Gemfile-3.3 delete mode 120000 Gemfile-3.4 delete mode 120000 Gemfile-jruby-9.2 delete mode 120000 Gemfile-jruby-9.3 delete mode 120000 Gemfile-jruby-9.4 delete mode 100644 gemfile_migration.rb create mode 100644 jruby-9.2.gemfile create mode 100644 jruby-9.3.gemfile create mode 100644 jruby-9.4.gemfile create mode 100644 ruby-2.5.gemfile create mode 100644 ruby-2.6.gemfile create mode 100644 ruby-2.7.gemfile create mode 100644 ruby-3.0.gemfile create mode 100644 ruby-3.1.gemfile create mode 100644 ruby-3.2.gemfile create mode 100644 ruby-3.3.gemfile create mode 100644 ruby-3.4.gemfile diff --git a/Gemfile b/Gemfile index 4dbf105905b..058d2a64771 100644 --- a/Gemfile +++ b/Gemfile @@ -1,94 +1 @@ -source 'https://rubygems.org' - -gemspec - -gem 'appraisal', '~> 2.4.0' -gem 'benchmark-ips', '~> 2.8' -gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ - -gem 'climate_control', '~> 0.2.0' - -gem 'concurrent-ruby' -gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog -gem 'json-schema', '< 3' # V3 only works with 2.5+ -gem 'memory_profiler', '~> 0.9' - -gem 'os', '~> 1.1' -gem 'pimpmychangelog', '>= 0.1.2' -gem 'pry' -if RUBY_PLATFORM != 'java' - # There's a few incompatibilities between pry/pry-byebug on older Rubies - # There's also a few temproary incompatibilities with newer rubies - gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' - gem 'pry-nav' if RUBY_VERSION < '2.6.0' - gem 'pry-stack_explorer' -else - gem 'pry-debugger-jruby' -end -gem 'rake', '>= 10.5' -gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions -gem 'rspec', '~> 3.13' -gem 'rspec-collection_matchers', '~> 1.1' -gem 'rspec-wait', '~> 0' - -gem 'rspec_junit_formatter', '>= 0.5.1' - -# Merging branch coverage results does not work for old, unsupported rubies and JRuby -# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, -# but given it only affects unsupported version of Ruby, it might not get merged. -gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' -gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov - -gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb -gem 'webmock', '>= 3.10.0' - -gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ - -if RUBY_VERSION.start_with?('3.4.') - # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out - gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' -elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 - gem 'webrick', '>= 1.7.0' -end - -if RUBY_VERSION >= '2.6.0' - # 1.50 is the last version to support Ruby 2.6 - gem 'rubocop', '~> 1.50.0', require: false - gem 'rubocop-packaging', '~> 0.5.2', require: false - gem 'rubocop-performance', '~> 1.9', require: false - # 2.20 is the last version to support Ruby 2.6 - gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false -end - -# Optional extensions -# TODO: Move this to Appraisals? -# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. -# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 -gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' - -# Profiler testing dependencies -# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. -# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add -# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. -if RUBY_PLATFORM != 'java' - if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems - gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] - else - gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] - end -end - -group :check do - if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' - gem 'rbs', '~> 3.6', require: false - gem 'steep', '~> 1.7.0', require: false - end - gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' - gem 'standard', require: false -end - -group :dev do - gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' -end - -gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' +eval_gemfile("#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION.split(".").take(2).join(".")}.gemfile") diff --git a/Gemfile-2.5 b/Gemfile-2.5 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-2.5 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-2.6 b/Gemfile-2.6 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-2.6 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-2.7 b/Gemfile-2.7 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-2.7 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-3.0 b/Gemfile-3.0 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-3.0 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-3.1 b/Gemfile-3.1 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-3.1 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-3.2 b/Gemfile-3.2 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-3.2 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-3.3 b/Gemfile-3.3 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-3.3 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-3.4 b/Gemfile-3.4 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-3.4 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-jruby-9.2 b/Gemfile-jruby-9.2 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-jruby-9.2 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-jruby-9.3 b/Gemfile-jruby-9.3 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-jruby-9.3 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/Gemfile-jruby-9.4 b/Gemfile-jruby-9.4 deleted file mode 120000 index 6ab79009c0a..00000000000 --- a/Gemfile-jruby-9.4 +++ /dev/null @@ -1 +0,0 @@ -Gemfile \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fc39811f1ff..88d53d5a130 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: - testagent env_file: ./.env environment: &common-environment - BUNDLE_GEMFILE: /app/Gemfile-2.5 + BUNDLE_GEMFILE: /app/ruby-2.5.gemfile DD_AGENT_HOST: testagent DD_TRACE_AGENT_PORT: 9126 TEST_DATADOG_INTEGRATION: 1 @@ -45,7 +45,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-2.6 + BUNDLE_GEMFILE: /app/ruby-2.6.gemfile stdin_open: true tty: true volumes: @@ -61,7 +61,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-2.7 + BUNDLE_GEMFILE: /app/ruby-2.7.gemfile stdin_open: true tty: true volumes: @@ -77,7 +77,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-3.0 + BUNDLE_GEMFILE: /app/ruby-3.0.gemfile stdin_open: true tty: true volumes: @@ -93,7 +93,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-3.1 + BUNDLE_GEMFILE: /app/ruby-3.1.gemfile stdin_open: true tty: true volumes: @@ -109,7 +109,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-3.2 + BUNDLE_GEMFILE: /app/ruby-3.2.gemfile stdin_open: true tty: true volumes: @@ -125,7 +125,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-3.3 + BUNDLE_GEMFILE: /app/ruby-3.3.gemfile stdin_open: true tty: true volumes: @@ -141,7 +141,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-3.4 + BUNDLE_GEMFILE: /app/ruby-3.4.gemfile stdin_open: true tty: true volumes: @@ -158,7 +158,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-jruby-9.2 + BUNDLE_GEMFILE: /app/jruby-9.2.gemfile stdin_open: true tty: true volumes: @@ -173,7 +173,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-jruby-9.3 + BUNDLE_GEMFILE: /app/jruby-9.3.gemfile stdin_open: true tty: true volumes: @@ -188,7 +188,7 @@ services: env_file: ./.env environment: <<: *common-environment - BUNDLE_GEMFILE: /app/Gemfile-jruby-9.4 + BUNDLE_GEMFILE: /app/jruby-9.4.gemfile stdin_open: true tty: true volumes: diff --git a/gemfile_migration.rb b/gemfile_migration.rb deleted file mode 100644 index 3922e9ac624..00000000000 --- a/gemfile_migration.rb +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -[ - "2.5", - "2.6", - "2.7", - "3.0", - "3.1", - "3.2", - "3.3", - "3.4", - "jruby-9.2", - "jruby-9.3", - "jruby-9.4", -].each do |v| - # For example: - # - Gemfile-3.3 -> ruby-3.3.gemfile - # - Gemfile-jruby-9.3 -> jruby-9.3.gemfile - original_file_name = "Gemfile-#{v}" - target = v.start_with?("jruby") ? v : "ruby-#{v}" - new_file_name = "#{target}.gemfile" - - # Migrate symlinked versioned Gemfile to a new file without symlinked - FileUtils.rm(original_file_name) - FileUtils.cp("Gemfile", new_file_name) - - # Update docker-compose.yml - text = File.read("docker-compose.yml") - new_contents = text.gsub(original_file_name, new_file_name) - File.open("docker-compose.yml", "w") {|file| file.puts new_contents } -end - -eval_gemfile = 'eval_gemfile("#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION.split(".").take(2).join(".")}.gemfile")' -File.open("Gemfile", "w") {|file| file.puts(eval_gemfile)} diff --git a/jruby-9.2.gemfile b/jruby-9.2.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/jruby-9.2.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/jruby-9.3.gemfile b/jruby-9.3.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/jruby-9.3.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/jruby-9.4.gemfile b/jruby-9.4.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/jruby-9.4.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-2.5.gemfile b/ruby-2.5.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-2.5.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-2.6.gemfile b/ruby-2.6.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-2.6.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-2.7.gemfile b/ruby-2.7.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-2.7.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-3.0.gemfile b/ruby-3.0.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-3.0.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-3.1.gemfile b/ruby-3.1.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-3.1.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-3.2.gemfile b/ruby-3.2.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-3.2.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-3.3.gemfile b/ruby-3.3.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-3.3.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' diff --git a/ruby-3.4.gemfile b/ruby-3.4.gemfile new file mode 100644 index 00000000000..4dbf105905b --- /dev/null +++ b/ruby-3.4.gemfile @@ -0,0 +1,94 @@ +source 'https://rubygems.org' + +gemspec + +gem 'appraisal', '~> 2.4.0' +gem 'benchmark-ips', '~> 2.8' +gem 'benchmark-memory', '< 0.2' # V0.2 only works with 2.5+ + +gem 'climate_control', '~> 0.2.0' + +gem 'concurrent-ruby' +gem 'extlz4', '~> 0.3', '>= 0.3.3' if RUBY_PLATFORM != 'java' # Used to test lz4 compression done by libdatadog +gem 'json-schema', '< 3' # V3 only works with 2.5+ +gem 'memory_profiler', '~> 0.9' + +gem 'os', '~> 1.1' +gem 'pimpmychangelog', '>= 0.1.2' +gem 'pry' +if RUBY_PLATFORM != 'java' + # There's a few incompatibilities between pry/pry-byebug on older Rubies + # There's also a few temproary incompatibilities with newer rubies + gem 'pry-byebug' if RUBY_VERSION >= '2.6.0' && RUBY_ENGINE != 'truffleruby' && RUBY_VERSION < '3.2.0' + gem 'pry-nav' if RUBY_VERSION < '2.6.0' + gem 'pry-stack_explorer' +else + gem 'pry-debugger-jruby' +end +gem 'rake', '>= 10.5' +gem 'rake-compiler', '~> 1.1', '>= 1.1.1' # To compile native extensions +gem 'rspec', '~> 3.13' +gem 'rspec-collection_matchers', '~> 1.1' +gem 'rspec-wait', '~> 0' + +gem 'rspec_junit_formatter', '>= 0.5.1' + +# Merging branch coverage results does not work for old, unsupported rubies and JRuby +# We have a fix up for review, https://github.com/simplecov-ruby/simplecov/pull/972, +# but given it only affects unsupported version of Ruby, it might not get merged. +gem 'simplecov', git: 'https://github.com/DataDog/simplecov', ref: '3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db' +gem 'simplecov-cobertura', '~> 2.1.0' # Used by codecov + +gem 'warning', '~> 1' # NOTE: Used in spec_helper.rb +gem 'webmock', '>= 3.10.0' + +gem 'rexml', '>= 3.2.7' # https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/ + +if RUBY_VERSION.start_with?('3.4.') + # ruby 3.4 breaks stable webrick; we need this fix until a version later than 1.8.1 comes out + gem 'webrick', git: 'https://github.com/ruby/webrick.git', ref: '0c600e169bd4ae267cb5eeb6197277c848323bbe' +elsif RUBY_VERSION >= '3.0.0' # No longer bundled by default since Ruby 3.0 + gem 'webrick', '>= 1.7.0' +end + +if RUBY_VERSION >= '2.6.0' + # 1.50 is the last version to support Ruby 2.6 + gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop-packaging', '~> 0.5.2', require: false + gem 'rubocop-performance', '~> 1.9', require: false + # 2.20 is the last version to support Ruby 2.6 + gem 'rubocop-rspec', ['~> 2.20', '< 2.21'], require: false +end + +# Optional extensions +# TODO: Move this to Appraisals? +# dogstatsd v5, but lower than 5.2, has possible memory leak with datadog. +# @see https://github.com/DataDog/dogstatsd-ruby/issues/182 +gem 'dogstatsd-ruby', '>= 3.3.0', '!= 5.0.0', '!= 5.0.1', '!= 5.1.0' + +# Profiler testing dependencies +# NOTE: We're excluding versions 3.7.0 and 3.7.1 for the reasons documented in #1424. +# Since most of our customers won't have BUNDLE_FORCE_RUBY_PLATFORM=true, it's not something we want to add +# to our CI, so we just shortcut and exclude specific versions that were affecting our CI. +if RUBY_PLATFORM != 'java' + if RUBY_VERSION >= '2.7.0' # Bundler 1.x fails to find that versions >= 3.8.0 are not compatible because of binary gems + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1'] + else + gem 'google-protobuf', ['~> 3.0', '!= 3.7.0', '!= 3.7.1', '< 3.19.2'] + end +end + +group :check do + if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' + gem 'rbs', '~> 3.6', require: false + gem 'steep', '~> 1.7.0', require: false + end + gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' + gem 'standard', require: false +end + +group :dev do + gem 'ruby-lsp', require: false if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' +end + +gem 'uri', '~> 0.13.1' if RUBY_VERSION.start_with? '3' From 6c8eca66b5ba77ff849321afe92c2485b889adf7 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 14 Nov 2024 00:34:14 +0100 Subject: [PATCH 4/6] Fix release_gem_spec.rb --- spec/datadog/release_gem_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/datadog/release_gem_spec.rb b/spec/datadog/release_gem_spec.rb index 81fa0e2b8ae..acfd8826df5 100644 --- a/spec/datadog/release_gem_spec.rb +++ b/spec/datadog/release_gem_spec.rb @@ -28,7 +28,7 @@ |Appraisals |CONTRIBUTING.md |Gemfile - |Gemfile-.* + |(ruby|jruby)-\d+.\d+.gemfile |Rakefile |Matrixfile |Steepfile From 8cb66d0c458c161cc18a1a5282fcc310f7ae63c5 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 14 Nov 2024 00:45:11 +0100 Subject: [PATCH 5/6] Lint --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 058d2a64771..e3daed17e0d 100644 --- a/Gemfile +++ b/Gemfile @@ -1 +1 @@ -eval_gemfile("#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION.split(".").take(2).join(".")}.gemfile") +eval_gemfile("#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION.split('.').take(2).join('.')}.gemfile") From 4d537f39d829dfa55833a845cbb497500340d505 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 14 Nov 2024 02:09:39 +0100 Subject: [PATCH 6/6] Update developement guide --- docs/DevelopmentGuide.md | 69 ++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/docs/DevelopmentGuide.md b/docs/DevelopmentGuide.md index 6b21fa33902..adf99bc3e7d 100644 --- a/docs/DevelopmentGuide.md +++ b/docs/DevelopmentGuide.md @@ -24,8 +24,8 @@ To start a development environment, choose a target Ruby version then run the fo # In the root directory of the project... cd ~/dd-trace-rb -# Create and start a Ruby 3.0 test environment with its dependencies -docker-compose run --rm tracer-3.0 /bin/bash +# Create and start a Ruby 3.3 test environment with its dependencies +docker compose run --rm tracer-3.3 /bin/bash # Then inside the container (e.g. `root@2a73c6d8673e:/app`)... # Install the library dependencies @@ -64,10 +64,9 @@ All tests should run in CI. When adding new `_spec.rb` files, you may need to ad ```ruby { 'foo' => { - # Without any appraisal group dependencies + # With default dependencies for each Ruby runtime '' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby', - - # or with appraisal group definition `foo-on-rails`, that includes additional gems + # or with dependency group definition `foo-on-rails`, that includes additional gems 'foo-on-rails' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' }, } @@ -75,7 +74,7 @@ All tests should run in CI. When adding new `_spec.rb` files, you may need to ad ### Running tests -Simplest way to run tests is to run `bundle exec rake ci`, which will run the entire test suite, just as CI does. +`bundle exec rake ci` will run the entire test suite with any given Ruby runtime, just as CI does. However, this is not recommended because it is going take a long time. **For the core library** @@ -89,14 +88,15 @@ $ bundle exec rake test:main Integrations which interact with dependencies not listed in the `datadog` gemspec will need to load these dependencies to run their tests. Each test task could consist of multiple spec tasks which are executed with different groups of dependencies (likely against different versions or variations). -To get a list of the test tasks, run `bundle exec rake -T test` +To get a list of the test tasks, run `bundle exec rake -T test:` To run test, run `bundle exec rake test:` -Take `bundle exec rake test:redis` as example, multiple versions of `redis` from different groups are tested. +Take `bundle exec rake test:redis` as example, multiple versions of `redis` from different dependency definitions are being tested (from `Matrixfile`). + ```ruby -TEST_METADATA = { +{ 'redis' => { 'redis-3' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby', 'redis-4' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby', @@ -105,41 +105,48 @@ TEST_METADATA = { } ``` -**Using appraisal** +If the dependency groups are prepared (with up-to-date gemfile and lockfile), the test task would install them before running the test. -`appraisal` command should only be used to update gemfiles in `gemfiles/` -and install dependencies. It should not be used to run tests, since it does not -work in all configurations. To run the tests, use: +**Working with different dependencies** -```sh -env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime}_#{appraisal_group}.gemfile rake #{spec_task} -``` +We are actively developing tools to make it easier to manage dependencies. Currently, we are using rake tasks defined in `tasks/dependency.rake`. -Note that the file names use underscores while appraisal group and -configuration definitions use dashes. The conversion could be performed as -follows: +You can find them by running the following command: -```sh -env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime.tr('-', '_')}_#{appraisal_group.tr('-', '_')}.gemfile rake #{spec_task} +```bash +bundle exec rake -T dependency: ``` -**Working with appraisal groups** +Dependency group definitions are located under `appraisal/` directory using the same DSL provided by [Appraisal](https://github.com/thoughtbot/appraisal). These definitions are used to generate `gemfiles/*.gemfile` and then `gemfiles/*.lock`. All the files are underscored and prefixed with Ruby runtime. -Checkout [Apppraisal](https://github.com/thoughtbot/appraisal) to learn the basics. +> [!IMPORTANT] +> Do NOT manually edit `gemfiles/*.gemfile` or `gemfiles/*.lock`. Instead, make changes to `appraisal/*.rb` and propagates your changes programmatically -Groups are defined under `appraisal/` directory and their names are prefixed with Ruby runtime based on the environment. `*.gemfile` and `*.gemfile.lock` from `gemfiles/` directory are generated from those definitions. +To find out existing gemfiles in your environment, run -To find out existing groups in your environment, run `bundle exec appraisal list` +```bash +bundle exec rake dependency:list +``` -After introducing a new group definition or changing existing one, run `bundle exec appraisal generate` to propagate the changes. +`dependency:list` is convenient to look for a specific gemfile path before assigning it to the environment variable `BUNDLE_GEMFILE` for doing all kinds of stuff. -To install dependencies, run `bundle exec appraisal install`. +```bash +env BUNDLE_GEMFILE=/app/gemfiles/ruby_3.3_stripe_latest.gemfile bundle update stripe +``` -In addition, if you already know which appraisal group definition to work with, you can target a specific group operation with environment variable `APPRAISAL_GROUP`, instead of all the groups from your environment. For example: +After introducing a new dependency group or changing existing one, run `bundle exec rake dependency:generate` to propagate the changes to the gemfile. `dependency:generate` is idempotent and only changes `gemfiles/*.gemfile` but not `gemfiles/*.lock`. -``` -# This would only install dependencies for `aws` group definition -APPRAISAL_GROUP=aws bundle exec appraisal install +To keep lockfile up-to-date with the gemfile, run `bundle exec rake dependency:lock`. + +To install, run `bundle exec rake dependency:install`. + +Both `dependency:lock` and `dependency:install` can be provided with a specific gemfile path (from `dependency:list`) or pattern to target specific groups. For example: + +```bash +# Generates lockfiles for all the stripe groups with `stripe_*` pattern +bundle exec rake dependency:lock['/app/gemfiles/ruby_3.3_stripe_*.gemfile'] +# or only generate lockfile for `stripe_latest` group +bundle exec rake dependency:lock['/app/gemfiles/ruby_3.3_stripe_latest.gemfile'] ``` **Passing arguments to tests**