From 3ad45c51bfc39415917f44b8f9ad13856b77f221 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 22 Feb 2025 17:11:22 +0100 Subject: [PATCH 1/4] Improve script for listing versions --- versions-strings-for-builder.rb | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/versions-strings-for-builder.rb b/versions-strings-for-builder.rb index 6a5000c28..4217803a7 100644 --- a/versions-strings-for-builder.rb +++ b/versions-strings-for-builder.rb @@ -2,21 +2,32 @@ hash = File.read('ruby-builder-versions.json') versions = JSON.load(hash).transform_keys(&:to_sym) -by_minor = versions[:ruby].group_by { |v| v[/^\d\.\d/] } +ONLY_LATEST_PATCH = ENV['ONLY_LATEST_PATCH'] -by_minor.each_pair do |minor, versions| - puts versions.map { |v| "ruby-#{v}" }.join(', ') if minor +def filter(versions) + versions -= %w[head] + if ONLY_LATEST_PATCH + versions = versions.group_by { |v| v[/^\d+\.\d+/] }.map { _2.last } + end + versions end -puts -puts (versions[:truffleruby] - %w[head]).map { |v| "truffleruby-#{v}" }.join(', ') +if ONLY_LATEST_PATCH + puts filter(versions[:ruby]).map { |v| "ruby-#{v}" }.join(', ') +else + by_minor = versions[:ruby].group_by { |v| v[/^\d+\.\d+/] } + by_minor.each_pair do |minor, versions| + puts versions.map { |v| "ruby-#{v}" }.join(', ') if minor + end +end puts -puts (versions[:"truffleruby+graalvm"] - %w[head]).map { |v| "truffleruby+graalvm-#{v}" }.join(', ') +puts filter(versions[:truffleruby]).map { |v| "truffleruby-#{v}" }.join(', ') puts -puts (versions[:jruby] - %w[head]).map { |v| "jruby-#{v}" }.join(', ') +puts filter(versions[:"truffleruby+graalvm"]).map { |v| "truffleruby+graalvm-#{v}" }.join(', ') -(versions[:jruby] - %w[head]).each do |v| - puts "- { os: windows-latest, jruby-version: #{v}, ruby: jruby-#{v} }" -end +puts +puts filter(versions[:jruby]).map { |v| "jruby-#{v}" }.join(', ') +puts "For Windows:" +puts filter(versions[:jruby]).join(', ') From 88a81550956928fbd643062a28bfa2e436f3a0aa Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 22 Feb 2025 17:21:43 +0100 Subject: [PATCH 2/4] Make targetRubyVersion() more complete --- common.js | 6 ++++++ dist/index.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/common.js b/common.js index d6d5b40f8..574dabfe1 100644 --- a/common.js +++ b/common.js @@ -128,6 +128,8 @@ export function targetRubyVersion(engine, rubyVersion) { return 2.5 } else if (version === 9.3) { return 2.6 + } else if (version === 9.4) { + return 3.1 } } else if (engine.startsWith('truffleruby')) { if (version < 21.0) { @@ -136,6 +138,10 @@ export function targetRubyVersion(engine, rubyVersion) { return 2.7 } else if (version < 23.0) { return 3.0 + } else if (version < 23.1) { + return 3.1 + } else if (version < 24.2) { + return 3.2 } } diff --git a/dist/index.js b/dist/index.js index 7455a92b4..0eb1382b0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -447,6 +447,8 @@ function targetRubyVersion(engine, rubyVersion) { return 2.5 } else if (version === 9.3) { return 2.6 + } else if (version === 9.4) { + return 3.1 } } else if (engine.startsWith('truffleruby')) { if (version < 21.0) { @@ -455,6 +457,10 @@ function targetRubyVersion(engine, rubyVersion) { return 2.7 } else if (version < 23.0) { return 3.0 + } else if (version < 23.1) { + return 3.1 + } else if (version < 24.2) { + return 3.2 } } From 04c2e2b8e83fbca87e4c7ea9c16e82a1c029c074 Mon Sep 17 00:00:00 2001 From: Ivo Anjo Date: Tue, 18 Feb 2025 14:20:48 +0000 Subject: [PATCH 3/4] Expose `3.4-asan` Ruby builds from ruby-dev-builder **What does this PR do?** This PR provides the final piece of the puzzle to fix #682: now that ruby-dev-builder is building `3.4-asan` Rubies since https://github.com/ruby/ruby-dev-builder/pull/15, we can make them available for use. **Motivation:** At Datadog, we're using ASan builds to check for issues [in our library](https://github.com/datadog/dd-trace-rb), and having a `3.4-asan` build improves the experience of having these checks be a required CI step. Using the ASan builds built from ruby-head means our CI could break because of unrelated issues/changes from ruby-head. **Additional Notes:** `yarn` was trying really hard to update a bunch of things, which generated A LOT of diff noise. I've manually pared them down just to the actual changes related to adding the new variant so the diff makes a bit more sense. **How to test the change?** I've already tested this in https://github.com/DataDog/dd-trace-rb/actions/runs/13392865620/job/37696781848 and it seems to be working fine! --- .github/workflows/test.yml | 1 + README.md | 3 +++ common.js | 3 ++- dist/index.js | 5 +++-- ruby-builder-versions.json | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 85d7095e4..1db330ffc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,7 @@ jobs: - { os: windows-2025, ruby: mswin } - { os: windows-2025, ruby: ucrt } - { os: ubuntu-24.04, ruby: asan } + - { os: ubuntu-24.04, ruby: 3.4-asan } exclude: # https://github.com/ruby/setup-ruby/issues/496 - { os: ubuntu-22.04, ruby: '2.2' } diff --git a/README.md b/README.md index 405b13ceb..f20b1ef18 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby: Native extensions are automatically compiled with AddressSanitizer when using `ruby-asan`. `ruby-asan` is currently only available on `ubuntu-24.04`. +`ruby-3.4-asan` is similar to `ruby-asan` but built from the latest stable 3.4 release tag. +Like `ruby-asan`, it's currently only available on `ubuntu-24.04`. + Regarding Windows ruby master builds, `mingw` is a MSYS2/MinGW build, `head` & `ucrt` are MSYS2/UCRT64 builds, and `mswin` is a MSVC/VS 2022 build. diff --git a/common.js b/common.js index 574dabfe1..99a7b71e2 100644 --- a/common.js +++ b/common.js @@ -66,7 +66,8 @@ export async function time(name, block) { } export function isHeadVersion(rubyVersion) { - return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan'].includes(rubyVersion) + // 3.4-asan counts as "head" because the version cannot be selected -- you can only get whatever's latest + return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', '3.4-asan'].includes(rubyVersion) } export function isStableVersion(engine, rubyVersion) { diff --git a/dist/index.js b/dist/index.js index 0eb1382b0..754edbdc2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -385,7 +385,8 @@ async function time(name, block) { } function isHeadVersion(rubyVersion) { - return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan'].includes(rubyVersion) + // 3.4-asan counts as "head" because the version cannot be selected -- you can only get whatever's latest + return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', '3.4-asan'].includes(rubyVersion) } function isStableVersion(engine, rubyVersion) { @@ -74713,7 +74714,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"ruby":["1.9.3-p551","2.0.0-p648","2.1.9","2.2.10","2.3.0","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.4.9","2.4.10","2.5.0","2.5.1","2.5.2","2.5.3","2.5.4","2.5.5","2.5.6","2.5.7","2.5.8","2.5.9","2.6.0","2.6.1","2.6.2","2.6.3","2.6.4","2.6.5","2.6.6","2.6.7","2.6.8","2.6.9","2.6.10","2.7.0","2.7.1","2.7.2","2.7.3","2.7.4","2.7.5","2.7.6","2.7.7","2.7.8","3.0.0-preview1","3.0.0-preview2","3.0.0-rc1","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.0.7","3.1.0-preview1","3.1.0","3.1.1","3.1.2","3.1.3","3.1.4","3.1.5","3.1.6","3.2.0-preview1","3.2.0-preview2","3.2.0-preview3","3.2.0-rc1","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.2.7","3.3.0-preview1","3.3.0-preview2","3.3.0-preview3","3.3.0-rc1","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.4.0-preview1","3.4.0-preview2","3.4.0-rc1","3.4.0","3.4.1","3.4.2","head","debug","asan"],"jruby":["9.1.17.0","9.2.9.0","9.2.10.0","9.2.11.0","9.2.11.1","9.2.12.0","9.2.13.0","9.2.14.0","9.2.15.0","9.2.16.0","9.2.17.0","9.2.18.0","9.2.19.0","9.2.20.0","9.2.20.1","9.2.21.0","9.3.0.0","9.3.1.0","9.3.2.0","9.3.3.0","9.3.4.0","9.3.6.0","9.3.7.0","9.3.8.0","9.3.9.0","9.3.10.0","9.3.11.0","9.3.13.0","9.3.14.0","9.3.15.0","9.4.0.0","9.4.1.0","9.4.2.0","9.4.3.0","9.4.4.0","9.4.5.0","9.4.6.0","9.4.7.0","9.4.8.0","9.4.9.0","9.4.10.0","9.4.11.0","9.4.12.0","head"],"truffleruby":["19.3.0","19.3.1","20.0.0","20.1.0","20.2.0","20.3.0","21.0.0","21.1.0","21.2.0","21.2.0.1","21.3.0","22.0.0.2","22.1.0","22.2.0","22.3.0","22.3.1","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","head"],"truffleruby+graalvm":["21.2.0","21.3.0","22.0.0.2","22.1.0","22.2.0","22.3.0","22.3.1","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","head"]}'); +module.exports = JSON.parse('{"ruby":["1.9.3-p551","2.0.0-p648","2.1.9","2.2.10","2.3.0","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.4.9","2.4.10","2.5.0","2.5.1","2.5.2","2.5.3","2.5.4","2.5.5","2.5.6","2.5.7","2.5.8","2.5.9","2.6.0","2.6.1","2.6.2","2.6.3","2.6.4","2.6.5","2.6.6","2.6.7","2.6.8","2.6.9","2.6.10","2.7.0","2.7.1","2.7.2","2.7.3","2.7.4","2.7.5","2.7.6","2.7.7","2.7.8","3.0.0-preview1","3.0.0-preview2","3.0.0-rc1","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.0.7","3.1.0-preview1","3.1.0","3.1.1","3.1.2","3.1.3","3.1.4","3.1.5","3.1.6","3.2.0-preview1","3.2.0-preview2","3.2.0-preview3","3.2.0-rc1","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.2.7","3.3.0-preview1","3.3.0-preview2","3.3.0-preview3","3.3.0-rc1","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.4.0-preview1","3.4.0-preview2","3.4.0-rc1","3.4.0","3.4.1","3.4.2","head","debug","asan","3.4-asan"],"jruby":["9.1.17.0","9.2.9.0","9.2.10.0","9.2.11.0","9.2.11.1","9.2.12.0","9.2.13.0","9.2.14.0","9.2.15.0","9.2.16.0","9.2.17.0","9.2.18.0","9.2.19.0","9.2.20.0","9.2.20.1","9.2.21.0","9.3.0.0","9.3.1.0","9.3.2.0","9.3.3.0","9.3.4.0","9.3.6.0","9.3.7.0","9.3.8.0","9.3.9.0","9.3.10.0","9.3.11.0","9.3.13.0","9.3.14.0","9.3.15.0","9.4.0.0","9.4.1.0","9.4.2.0","9.4.3.0","9.4.4.0","9.4.5.0","9.4.6.0","9.4.7.0","9.4.8.0","9.4.9.0","9.4.10.0","9.4.11.0","9.4.12.0","head"],"truffleruby":["19.3.0","19.3.1","20.0.0","20.1.0","20.2.0","20.3.0","21.0.0","21.1.0","21.2.0","21.2.0.1","21.3.0","22.0.0.2","22.1.0","22.2.0","22.3.0","22.3.1","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","head"],"truffleruby+graalvm":["21.2.0","21.3.0","22.0.0.2","22.1.0","22.2.0","22.3.0","22.3.1","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","head"]}'); /***/ }), diff --git a/ruby-builder-versions.json b/ruby-builder-versions.json index 76f398390..f1cbfff41 100644 --- a/ruby-builder-versions.json +++ b/ruby-builder-versions.json @@ -14,7 +14,7 @@ "3.2.0-preview1", "3.2.0-preview2", "3.2.0-preview3", "3.2.0-rc1", "3.2.0", "3.2.1", "3.2.2", "3.2.3", "3.2.4", "3.2.5", "3.2.6", "3.2.7", "3.3.0-preview1", "3.3.0-preview2", "3.3.0-preview3", "3.3.0-rc1", "3.3.0", "3.3.1", "3.3.2", "3.3.3", "3.3.4", "3.3.5", "3.3.6", "3.3.7", "3.4.0-preview1", "3.4.0-preview2", "3.4.0-rc1", "3.4.0", "3.4.1", "3.4.2", - "head", "debug", "asan" + "head", "debug", "asan", "3.4-asan" ], "jruby": [ "9.1.17.0", From 277ba2a127aba66d45bad0fa2dc56f80dbfedffa Mon Sep 17 00:00:00 2001 From: Joel Tannas Date: Tue, 4 Mar 2025 10:55:31 -0700 Subject: [PATCH 4/4] deal with multiple versions in .tool-versions --- dist/index.js | 2 +- index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 754edbdc2..d87486b6d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -74933,7 +74933,7 @@ function parseRubyEngineAndVersion(rubyVersion) { } else if (rubyVersion === '.tool-versions') { // Read from .tool-versions const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim() const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0] - rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1] + rubyVersion = rubyLine.split(/\s/)[1] console.log(`Using ${rubyVersion} as input from file .tool-versions`) } else if (rubyVersion === 'mise.toml') { // Read from mise.toml const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim() diff --git a/index.js b/index.js index e50f92dd9..683f713f9 100644 --- a/index.js +++ b/index.js @@ -130,7 +130,7 @@ function parseRubyEngineAndVersion(rubyVersion) { } else if (rubyVersion === '.tool-versions') { // Read from .tool-versions const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim() const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0] - rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1] + rubyVersion = rubyLine.split(/\s/)[1] console.log(`Using ${rubyVersion} as input from file .tool-versions`) } else if (rubyVersion === 'mise.toml') { // Read from mise.toml const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()