mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3c9825d67 | ||
|
|
f60ef1e808 | ||
|
|
bc4e585e26 | ||
|
|
2cf593d66b | ||
|
|
a26e1fb6b3 | ||
|
|
4d060a10e6 | ||
|
|
77fe3b48b7 | ||
|
|
8df78e5576 | ||
|
|
b8e62b879e | ||
|
|
d60780f6b6 | ||
|
|
8aa012b56d | ||
|
|
628be4e0e4 | ||
|
|
ee26e27437 | ||
|
|
93287a1fa8 |
@@ -15,10 +15,10 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
|||||||
|
|
||||||
| Interpreter | Versions |
|
| Interpreter | Versions |
|
||||||
| ----------- | -------- |
|
| ----------- | -------- |
|
||||||
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.2.0, head, debug, mingw, mswin, ucrt |
|
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.2.1, head, debug, mingw, mswin, ucrt |
|
||||||
| `jruby` | 9.1.17.0 - 9.4.0.0, head |
|
| `jruby` | 9.1.17.0 - 9.4.1.0, head |
|
||||||
| `truffleruby` | 19.3.0 - 22.3.0, head |
|
| `truffleruby` | 19.3.0 - 22.3.1, head |
|
||||||
| `truffleruby+graalvm` | 21.2.0 - 22.3.0, head |
|
| `truffleruby+graalvm` | 21.2.0 - 22.3.1, head |
|
||||||
|
|
||||||
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
||||||
|
|
||||||
|
|||||||
+20
-14
@@ -126,7 +126,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
const targetRubyVersion = common.targetRubyVersion(engine, rubyVersion)
|
const targetRubyVersion = common.targetRubyVersion(engine, rubyVersion)
|
||||||
// Use Bundler 2.3 when we use Ruby 2.3.2 - 2.5
|
// Use Bundler 2.3 when we use Ruby 2.3.2 - 2.5
|
||||||
// Use Bundler 2.4 when we use Ruby 2.6-2.7
|
// Use Bundler 2.4 when we use Ruby 2.6-2.7
|
||||||
if (bundlerVersion === '2') {
|
if (bundlerVersion == '2') {
|
||||||
if (targetRubyVersion <= 2.5) { // < 2.3.2 already handled above
|
if (targetRubyVersion <= 2.5) { // < 2.3.2 already handled above
|
||||||
console.log('Ruby 2.3.2 - 2.5 only works with Bundler 2.3')
|
console.log('Ruby 2.3.2 - 2.5 only works with Bundler 2.3')
|
||||||
bundlerVersion = '2.3'
|
bundlerVersion = '2.3'
|
||||||
@@ -146,14 +146,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
|
|
||||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||||
|
|
||||||
if (bundlerVersion.startsWith('1') && common.isBundler2Default(engine, rubyVersion)) {
|
|
||||||
// If Bundler 1 is specified on Rubies which ship with Bundler 2,
|
|
||||||
// we need to specify which Bundler version to use explicitly until the lockfile exists.
|
|
||||||
// We actually set it globally for the case of bundler-cache: false with manual bundler install later.
|
|
||||||
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} to ensure Bundler 1 is used`)
|
|
||||||
core.exportVariable('BUNDLER_VERSION', bundlerVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
return bundlerVersion
|
return bundlerVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,19 +155,27 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let envOptions = {}
|
||||||
|
if (bundlerVersion.startsWith('1') && common.isBundler2Default(engine, rubyVersion)) {
|
||||||
|
// If Bundler 1 is specified on Rubies which ship with Bundler 2,
|
||||||
|
// we need to specify which Bundler version to use explicitly until the lockfile exists.
|
||||||
|
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler 1 is used`)
|
||||||
|
envOptions = { env: { ...process.env, BUNDLER_VERSION: bundlerVersion } }
|
||||||
|
}
|
||||||
|
|
||||||
// config
|
// config
|
||||||
const cachePath = 'vendor/bundle'
|
const cachePath = 'vendor/bundle'
|
||||||
// An absolute path, so it is reliably under $PWD/vendor/bundle, and not relative to the gemfile's directory
|
// An absolute path, so it is reliably under $PWD/vendor/bundle, and not relative to the gemfile's directory
|
||||||
const bundleCachePath = path.join(process.cwd(), cachePath)
|
const bundleCachePath = path.join(process.cwd(), cachePath)
|
||||||
|
|
||||||
await exec.exec('bundle', ['config', '--local', 'path', bundleCachePath])
|
await exec.exec('bundle', ['config', '--local', 'path', bundleCachePath], envOptions)
|
||||||
|
|
||||||
if (fs.existsSync(lockFile)) {
|
if (fs.existsSync(lockFile)) {
|
||||||
await exec.exec('bundle', ['config', '--local', 'deployment', 'true'])
|
await exec.exec('bundle', ['config', '--local', 'deployment', 'true'], envOptions)
|
||||||
} else {
|
} else {
|
||||||
// Generate the lockfile so we can use it to compute the cache key.
|
// Generate the lockfile so we can use it to compute the cache key.
|
||||||
// This will also automatically pick up the latest gem versions compatible with the Gemfile.
|
// This will also automatically pick up the latest gem versions compatible with the Gemfile.
|
||||||
await exec.exec('bundle', ['lock'])
|
await exec.exec('bundle', ['lock'], envOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
await afterLockFile(lockFile, platform, engine, rubyVersion)
|
await afterLockFile(lockFile, platform, engine, rubyVersion)
|
||||||
@@ -232,8 +232,14 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
|
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
|
||||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
const cwd = process.cwd()
|
||||||
let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
const bundleWith = process.env['BUNDLE_WITH'] || ''
|
||||||
|
const bundleWithout = process.env['BUNDLE_WITHOUT'] || ''
|
||||||
|
let key = `setup-ruby-bundler-cache-v5-${platform}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}`
|
||||||
|
|
||||||
|
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
|
||||||
|
key += `-v-${cacheVersion}`
|
||||||
|
}
|
||||||
|
|
||||||
if (common.isHeadVersion(version)) {
|
if (common.isHeadVersion(version)) {
|
||||||
if (engine !== 'jruby') {
|
if (engine !== 'jruby') {
|
||||||
|
|||||||
@@ -47,6 +47,18 @@ export async function measure(name, block) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Same as mesaure() but without the group, and no time shown on error
|
||||||
|
export async function time(name, block) {
|
||||||
|
console.log(`> ${name}`)
|
||||||
|
const start = performance.now()
|
||||||
|
const value = await block()
|
||||||
|
const end = performance.now()
|
||||||
|
|
||||||
|
const duration = (end - start) / 1000.0
|
||||||
|
console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`)
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
export function isHeadVersion(rubyVersion) {
|
export function isHeadVersion(rubyVersion) {
|
||||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
|
return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-21
File diff suppressed because one or more lines are too long
@@ -23,7 +23,11 @@ export async function run() {
|
|||||||
try {
|
try {
|
||||||
await setupRuby()
|
await setupRuby()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.stack)
|
if (/\bprocess\b.+\bfailed\b/.test(error.message)) {
|
||||||
|
core.setFailed(error.message)
|
||||||
|
} else {
|
||||||
|
core.setFailed(error.stack)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +92,7 @@ export async function setupRuby(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputs['bundler-cache'] === 'true') {
|
if (inputs['bundler-cache'] === 'true') {
|
||||||
await common.measure('bundle install', async () =>
|
await common.time('bundle install', async () =>
|
||||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+43
-46
@@ -1,65 +1,62 @@
|
|||||||
versions = ARGV.fetch(0).split(',').map(&:strip)
|
versions = ARGV.fetch(0).split(',').map(&:strip)
|
||||||
versions.each do |engine_version|
|
p versions
|
||||||
engine_input, version = engine_version.split('-', 2)
|
|
||||||
|
|
||||||
if engine_input == 'windows'
|
versions.each do |engine_version|
|
||||||
|
puts engine_version
|
||||||
|
engine, version = engine_version.split('-', 2)
|
||||||
|
p [engine, version]
|
||||||
|
|
||||||
|
if engine == 'windows'
|
||||||
require_relative 'generate-windows-versions'
|
require_relative 'generate-windows-versions'
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
MATCH = case engine_input
|
match = case engine
|
||||||
when 'ruby', 'jruby'
|
when 'ruby', 'jruby'
|
||||||
/^\d+\.\d+\./
|
/^\d+\.\d+\./
|
||||||
when 'truffleruby'
|
when 'truffleruby', 'truffleruby+graalvm'
|
||||||
/^\d+\./
|
/^\d+\./
|
||||||
end
|
end
|
||||||
|
|
||||||
raise unless version[MATCH]
|
raise engine_version unless version[match]
|
||||||
|
|
||||||
engines = [engine_input]
|
# Update ruby-builder-versions.json
|
||||||
engines << 'truffleruby+graalvm' if engine_input == 'truffleruby'
|
file = "#{__dir__}/ruby-builder-versions.json"
|
||||||
|
lines = File.readlines(file, chomp: true)
|
||||||
|
|
||||||
engines.each do |engine|
|
from = lines.index { |line| line.include?(%{"#{engine}": [}) }
|
||||||
puts engine
|
raise "Could not find start of #{engine}" unless from
|
||||||
|
to = from
|
||||||
|
to += 1 until lines[to].include?(']')
|
||||||
|
|
||||||
# Update ruby-builder-versions.json
|
from += 1 # [
|
||||||
file = "#{__dir__}/ruby-builder-versions.json"
|
to -= 2 # head, ]
|
||||||
lines = File.readlines(file, chomp: true)
|
|
||||||
|
|
||||||
from = lines.index { |line| line.include?(%{"#{engine}": [}) }
|
puts lines[from..to]
|
||||||
raise "Could not find start of #{engine}" unless from
|
|
||||||
to = from
|
|
||||||
to += 1 until lines[to].include?(']')
|
|
||||||
|
|
||||||
from += 1 # [
|
release_line = lines[from..to].find { |line|
|
||||||
to -= 2 # head, ]
|
v = line[/"([^"]+)"/, 1] and v[match] == version[match]
|
||||||
|
}
|
||||||
|
|
||||||
puts lines[from..to]
|
if release_line
|
||||||
|
append = " #{version.inspect},"
|
||||||
release_line = lines[from..to].find { |line|
|
release_line << append unless release_line.end_with?(append)
|
||||||
v = line[/"([^"]+)"/, 1] and v[MATCH] == version[MATCH]
|
else
|
||||||
}
|
lines.insert to+1, " #{version.inspect},"
|
||||||
|
|
||||||
if release_line
|
|
||||||
append = " #{version.inspect},"
|
|
||||||
release_line << append unless release_line.end_with?(append)
|
|
||||||
else
|
|
||||||
lines.insert to+1, " #{version.inspect},"
|
|
||||||
end
|
|
||||||
|
|
||||||
File.write(file, lines.join("\n") + "\n")
|
|
||||||
|
|
||||||
# Update README.md
|
|
||||||
file = "#{__dir__}/README.md"
|
|
||||||
lines = File.readlines(file)
|
|
||||||
engine_line = lines.find { |line| line.start_with?("| `#{engine}`") }
|
|
||||||
engine_line.sub!(/(.+ (?:-|until)) (\d+(?:\.\d+)+(?:-\w+)?)/) do
|
|
||||||
if Gem::Version.new(version) > Gem::Version.new($2)
|
|
||||||
"#{$1} #{version}"
|
|
||||||
else
|
|
||||||
$&
|
|
||||||
end
|
|
||||||
end
|
|
||||||
File.write(file, lines.join)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
File.write(file, lines.join("\n") + "\n")
|
||||||
|
|
||||||
|
# Update README.md
|
||||||
|
file = "#{__dir__}/README.md"
|
||||||
|
lines = File.readlines(file)
|
||||||
|
engine_line = lines.find { |line| line.start_with?("| `#{engine}`") }
|
||||||
|
engine_line.sub!(/(.+ (?:-|until)) (\d+(?:\.\d+)+(?:-\w+)?)/) do
|
||||||
|
if Gem::Version.new(version) > Gem::Version.new($2)
|
||||||
|
"#{$1} #{version}"
|
||||||
|
else
|
||||||
|
$&
|
||||||
|
end
|
||||||
|
end
|
||||||
|
File.write(file, lines.join)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,26 +11,26 @@
|
|||||||
"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.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", "2.7.5", "2.7.6", "2.7.7",
|
||||||
"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.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.1.0-preview1", "3.1.0", "3.1.1", "3.1.2", "3.1.3",
|
"3.1.0-preview1", "3.1.0", "3.1.1", "3.1.2", "3.1.3",
|
||||||
"3.2.0-preview1", "3.2.0-preview2", "3.2.0-preview3", "3.2.0-rc1", "3.2.0",
|
"3.2.0-preview1", "3.2.0-preview2", "3.2.0-preview3", "3.2.0-rc1", "3.2.0", "3.2.1",
|
||||||
"head", "debug"
|
"head", "debug"
|
||||||
],
|
],
|
||||||
"jruby": [
|
"jruby": [
|
||||||
"9.1.17.0",
|
"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.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.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.4.0.0",
|
"9.4.0.0", "9.4.1.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby": [
|
"truffleruby": [
|
||||||
"19.3.0", "19.3.1",
|
"19.3.0", "19.3.1",
|
||||||
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
"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",
|
"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.0.0.2", "22.1.0", "22.2.0", "22.3.0", "22.3.1",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby+graalvm": [
|
"truffleruby+graalvm": [
|
||||||
"21.2.0", "21.3.0",
|
"21.2.0", "21.3.0",
|
||||||
"22.0.0.2", "22.1.0", "22.2.0", "22.3.0",
|
"22.0.0.2", "22.1.0", "22.2.0", "22.3.0", "22.3.1",
|
||||||
"head"
|
"head"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"3.1.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-3.1.2-1-x64.7z",
|
"3.1.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-3.1.2-1-x64.7z",
|
||||||
"3.1.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.3-1/rubyinstaller-3.1.3-1-x64.7z",
|
"3.1.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.3-1/rubyinstaller-3.1.3-1-x64.7z",
|
||||||
"3.2.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.0-1/rubyinstaller-3.2.0-1-x64.7z",
|
"3.2.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.0-1/rubyinstaller-3.2.0-1-x64.7z",
|
||||||
|
"3.2.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.1-1/rubyinstaller-3.2.1-1-x64.7z",
|
||||||
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
|
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
|
||||||
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
|
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
|
||||||
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z",
|
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z",
|
||||||
|
|||||||
+4
-3
@@ -103,10 +103,11 @@ async function installGCCTools(type, version) {
|
|||||||
// 2022-Dec ruby/msys2-gcc-pkgs now uses a suffix to delineate different archive versions.
|
// 2022-Dec ruby/msys2-gcc-pkgs now uses a suffix to delineate different archive versions.
|
||||||
// At present, the only use is to indicate the included OpenSSL version.
|
// At present, the only use is to indicate the included OpenSSL version.
|
||||||
// With no suffix, archives include OpenSSL 1.1.1, with a '-3.0' suffix, they include
|
// With no suffix, archives include OpenSSL 1.1.1, with a '-3.0' suffix, they include
|
||||||
// OpenSSL 3.0.x.
|
// OpenSSL 3.0.x. Note that the mswin archive uses OpenSSL 3.
|
||||||
// Currently, OpenSSL 3 is used in Ruby 3.2 & 'head', both use a custom RubyInstaller2 package.
|
// As of Jan-2023, OpenSSL 3 is used in Ruby 3.2 & all head versions. MSYS2 updated
|
||||||
|
// to OpenSSL 3 on 14-Jan-2023.
|
||||||
let suffix = ''
|
let suffix = ''
|
||||||
if ((version === 'head') || (!common.isHeadVersion(version) && common.floatVersion(version) >= 3.2)) {
|
if (common.isHeadVersion(version) || common.floatVersion(version) >= 3.2) {
|
||||||
suffix = '-3.0'
|
suffix = '-3.0'
|
||||||
}
|
}
|
||||||
const downloadPath = await common.measure(`Downloading ${type}${suffix} build tools`, async () => {
|
const downloadPath = await common.measure(`Downloading ${type}${suffix} build tools`, async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user