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 supported versions workflow #4210

Merged
merged 46 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3f4560a
add supported version script and table
quinna-h Dec 9, 2024
1980b6f
update script
quinna-h Dec 9, 2024
1b2986e
rubocop lint
quinna-h Dec 9, 2024
5bee321
modify script locations, add description to md table
quinna-h Dec 11, 2024
b2818a9
improve table output
quinna-h Dec 11, 2024
53b807f
wip
quinna-h Dec 11, 2024
df5640a
refactor code
quinna-h Dec 18, 2024
2b15400
wip
quinna-h Dec 18, 2024
112db1f
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h Dec 18, 2024
3b5aae2
add supported versions
quinna-h Dec 18, 2024
4ada6cf
add branch for testing
quinna-h Dec 18, 2024
b4526e2
remove json to avoid merge conflict issues
quinna-h Dec 18, 2024
d44249b
update PR body
quinna-h Dec 19, 2024
514be2c
Update .github/scripts/generate_table_versions.rb
quinna-h Dec 20, 2024
65aee38
switch to use gem declarations instead of hardcoded mappings
quinna-h Dec 23, 2024
6fb1de7
linting checks
quinna-h Dec 23, 2024
3b8cff4
cleanup comments
quinna-h Dec 24, 2024
c45330a
refactor code
quinna-h Dec 26, 2024
589bccc
cleanup code
quinna-h Dec 26, 2024
49ce6a8
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h Dec 30, 2024
d015ca2
Combine duplicate option table rows
soulcutter Dec 30, 2024
c24490f
Enable type checking for AgentSettingsResolver/AgentSettings
ivoanjo Jan 2, 2025
7796a9e
Move url building behavior from `AgentBaseUrl` to `AgentSettings`
ivoanjo Jan 2, 2025
2f824ff
Refactor crashtracking to use `AgentSettings#url`
ivoanjo Jan 2, 2025
2716176
[PROF-11078] Fix profiling exception when agent url is an ipv6 address
ivoanjo Jan 2, 2025
e8d7381
Implement `==` for new `AgentSettings` class
ivoanjo Jan 2, 2025
3750e4e
use Ruby 3.4.1 for test-memcheck GHA
anmarchenko Jan 2, 2025
9112473
Update exceptions file with another variant of thread creation memory…
ivoanjo Jan 2, 2025
9daf9a0
Introduce Ruby 3.5 gemfile variant for testing with dev builds
ivoanjo Jan 2, 2025
828f75e
Update list of files used to compute cache checksum
ivoanjo Jan 2, 2025
ae5d2a3
Bump Ruby 3.4 integration image to stable version
ivoanjo Jan 2, 2025
2e10ee4
Remove workaround for strscan issue
ivoanjo Jan 2, 2025
1f4afdc
Add unsafe api calls checker to track down issues such as #4195
ivoanjo Dec 19, 2024
33fc72f
Fix going into Ruby code when looking up otel context
ivoanjo Dec 19, 2024
f200a83
Avoid trying to sample allocations when VM is raising exception
ivoanjo Dec 19, 2024
3dfd113
Update tests with new signatures for test methods
ivoanjo Dec 19, 2024
092fa93
Check if symbol is static before calling SYM2ID on it
ivoanjo Dec 19, 2024
45c7dbe
Document that unsafe api calls checker is only for test code
ivoanjo Dec 19, 2024
4f6eb84
Add 3.4 support
sarahchen6 Jan 2, 2025
831f89f
Update DevelopmentGuide
sarahchen6 Jan 2, 2025
a62ee88
Remove `racc` gem from 3.3 and 3.4 appraisal files
sarahchen6 Jan 2, 2025
f544d4a
[🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/r…
ivoanjo Jan 3, 2025
da2860a
Remove strscan specification in 3.4 gemfile
sarahchen6 Jan 2, 2025
d1f47ad
[🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/r…
ivoanjo Jan 3, 2025
cb788d7
add hardcoded
quinna-h Jan 7, 2025
3f1112e
Merge branch 'master' into quinna.halim/add-supported-versions-table
quinna-h Jan 8, 2025
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
140 changes: 140 additions & 0 deletions .github/scripts/find_gem_version_bounds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
require 'pathname'
require 'rubygems'
require 'json'

def parse_gemfiles(directory = 'gemfiles/')
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
minimum_gems_ruby = {}
minimum_gems_jruby = {}
maximum_gems_ruby = {}
maximum_gems_jruby = {}


gemfiles = Dir.glob(File.join(directory, '*'))
gemfiles.each do |gemfile_name|
runtime = File.basename(gemfile_name).split('_').first # ruby or jruby
File.foreach(gemfile_name) do |line|
if (gem_details = parse_gemfile_entry(line))
gem_name, version = gem_details
elsif (gem_details = parse_gemfile_lock_entry(line))
gem_name, version = gem_details
else
next
end

# Validate and store the minimum version
if version_valid?(version)
if runtime == 'ruby'
if minimum_gems_ruby[gem_name].nil? || Gem::Version.new(version) < Gem::Version.new(minimum_gems_ruby[gem_name])
minimum_gems_ruby[gem_name] = version
end
if maximum_gems_ruby[gem_name].nil? || Gem::Version.new(version) > Gem::Version.new(maximum_gems_ruby[gem_name])
maximum_gems_ruby[gem_name] = version
end
end
if runtime == 'jruby'
if minimum_gems_jruby[gem_name].nil? || Gem::Version.new(version) < Gem::Version.new(minimum_gems_jruby[gem_name])
minimum_gems_jruby[gem_name] = version
end
if maximum_gems_jruby[gem_name].nil? || Gem::Version.new(version) > Gem::Version.new(maximum_gems_jruby[gem_name])
maximum_gems_jruby[gem_name] = version
end
end
else
next
end
end
end

[minimum_gems_ruby, minimum_gems_jruby, maximum_gems_ruby, maximum_gems_jruby]
end

# Helper: Parse a Gemfile-style gem declaration
# ex. gem 'ruby-kafka', '~> 5.0'
def parse_gemfile_entry(line)
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
if (match = line.match(/^\s*gem\s+["']([^"']+)["']\s*,?\s*["']?([^"']*)["']?/))
gem_name, version_constraint = match[1], match[2]
version = extract_version(version_constraint)
[gem_name, version]
end
end

# Helper: Parse a Gemfile.lock-style entry
# matches on ex. actionmailer (= 6.0.6)
def parse_gemfile_lock_entry(line)
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
if (match = line.match(/^\s*([a-z0-9_-]+)\s+\(([^)]+)\)/))
[match[1], match[2]]
end
end

# Helper: Validate the version format
def version_valid?(version)
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
version =~ /^\d+(\.\d+)*$/
end

# Helper: Extract the actual version number from a constraint
# Matches on the following version patterns:
# 1. "pessimistic" versions, ex. '~> 1.2.3'
# 2. '>= 1.2.3'
# 3. 1.2.3
def extract_version(constraint)
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
if constraint =~ /~>\s*([\d.]+(?:[-.\w]*))| # Handles ~> constraints
>=\s*([\d.]+(?:[-.\w]*))| # Handles >= constraints
([\d.]+(?:[-.\w]*)) # Handles plain versions
/x
Regexp.last_match(1) || Regexp.last_match(2) || Regexp.last_match(3)
end
end

def get_integration_names(directory = 'lib/datadog/tracing/contrib/')
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
unless Dir.exist?(directory)
puts "Directory '#{directory}' not found!"
return []
end

# Get all subdirectories inside the specified directory
Dir.children(directory).select do |entry|
File.directory?(File.join(directory, entry))
end
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
end

mapping = {
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
marcotc marked this conversation as resolved.
Show resolved Hide resolved
"action_mailer" => "actionmailer",
"opensearch" => "opensearch-ruby",
"concurrent_ruby" => "concurrent-ruby",
"action_view" => "actionview",
"action_cable" => "actioncable",
"active_record" => "activerecord",
"mongodb" => "mongo",
"rest_client" => "rest-client",
"active_support" => "activesupport",
"action_pack" => "actionpack",
"active_job" => "activejob",
"httprb" => "http",
"kafka" => "ruby-kafka",
"presto" => "presto-client",
"aws" => "aws-sdk-core"
}

excluded = ["configuration", "propagation", "utils"]
min_gems_ruby, min_gems_jruby, max_gems_ruby, max_gems_jruby = parse_gemfiles("gemfiles/")
integrations = get_integration_names('lib/datadog/tracing/contrib/')

integration_json_mapping = {}

integrations.each do |integration|
if excluded.include?(integration)
next
end
integration_name = mapping[integration] || integration

min_version_jruby = min_gems_jruby[integration_name]
min_version_ruby = min_gems_ruby[integration_name]
max_version_jruby = max_gems_jruby[integration_name]
max_version_ruby = max_gems_ruby[integration_name]

# mapping jruby, ruby
integration_json_mapping[integration] = [min_version_ruby, max_version_ruby, min_version_jruby, max_version_jruby]
integration_json_mapping.replace(integration_json_mapping.sort.to_h)
end

File.write("gem_output.json", JSON.pretty_generate(integration_json_mapping))
25 changes: 25 additions & 0 deletions .github/scripts/generate_table_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'json'

# Input and output file names
input_file = 'gem_output.json'
output_file = 'integration_versions.md'

# Read JSON data from the input file
data = JSON.parse(File.read(input_file))

# Prepare the Markdown content
comment = "# This is a table of supported integration versions generated from gemfiles.\n\n"
quinna-h marked this conversation as resolved.
Show resolved Hide resolved
header = "| Integration | Ruby Min | Ruby Max | JRuby Min | JRuby Max |\n"
separator = "|-------------|----------|-----------|----------|----------|\n"
rows = data.map do |integration_name, versions|
ruby_min, ruby_max, jruby_min, jruby_max = versions.map { |v| v || "None" }
"| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |"
end

# Write the Markdown file
File.open(output_file, 'w') do |file|
file.puts comment
file.puts header
file.puts separator
rows.each { |row| file.puts row }
end
Loading
Loading