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 | ||
|
|
3190662165 | ||
|
|
eb7f94ffae | ||
|
|
ad718faf7a | ||
|
|
09c10210cc | ||
|
|
f78d71faf4 | ||
|
|
fe42d0e73b | ||
|
|
8a6667e214 | ||
|
|
03b78bdda2 | ||
|
|
5fe1a6694c | ||
|
|
bb3a0553d5 | ||
|
|
02c9cccf0e | ||
|
|
8d6236c5db | ||
|
|
4b2d1d631e | ||
|
|
349473288f | ||
|
|
846173692d | ||
|
|
9d93e96fe7 | ||
|
|
ee2113536a | ||
|
|
ee37499046 | ||
|
|
a5e2883296 | ||
|
|
705fe056cf | ||
|
|
8e7720ca42 | ||
|
|
7a0bff23cb | ||
|
|
c7079efafd | ||
|
|
384fc1b92f | ||
|
|
0a6498048c |
@@ -18,7 +18,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12, windows-2019, windows-2022 ]
|
||||
ruby: [ '1.9', '2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
|
||||
ruby: [
|
||||
'1.9', '2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', ruby-head,
|
||||
jruby, jruby-head,
|
||||
truffleruby, truffleruby-head,
|
||||
truffleruby+graalvm, truffleruby+graalvm-head
|
||||
]
|
||||
include:
|
||||
- { os: windows-2019, ruby: mingw }
|
||||
- { os: windows-2019, ruby: mswin }
|
||||
@@ -190,10 +195,10 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./
|
||||
with:
|
||||
ruby-version: '2.2'
|
||||
rubygems: 2.7.11
|
||||
- run: gem --version | grep -F "2.7.11"
|
||||
- run: bundle --version | grep -F "1.16.6"
|
||||
ruby-version: '3.1.0'
|
||||
rubygems: 3.4.0
|
||||
- run: gem --version | grep -F "3.4.0"
|
||||
- run: bundle --version | grep -F "2.4.0"
|
||||
|
||||
testFixedBundlerVersionForOldRuby:
|
||||
name: "Test bundler: 1.x for old Ruby"
|
||||
@@ -239,6 +244,17 @@ jobs:
|
||||
bundler: 2.2.3
|
||||
- run: bundle --version | grep -F "Bundler version 2.2.3"
|
||||
|
||||
testBundlerPre:
|
||||
name: "Test with a Bundler pre/rc version"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./
|
||||
with:
|
||||
ruby-version: '2.6'
|
||||
bundler: 2.2.0.rc.2
|
||||
- run: bundle --version | grep -F "Bundler version 2.2.0.rc.2"
|
||||
|
||||
testBundlerDev:
|
||||
name: "Test BUNDLED WITH Bundler dev"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -15,10 +15,10 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
||||
|
||||
| Interpreter | Versions |
|
||||
| ----------- | -------- |
|
||||
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.2.0-preview1, head, debug, mingw, mswin, ucrt |
|
||||
| `jruby` | 9.1.17.0 - 9.4.0.0, head |
|
||||
| `truffleruby` | 19.3.0 - 22.3.0, head |
|
||||
| `truffleruby+graalvm` | 21.2.0 - 22.3.0, head |
|
||||
| `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.1.0, head |
|
||||
| `truffleruby` | 19.3.0 - 22.3.1, 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`).
|
||||
|
||||
@@ -38,13 +38,13 @@ which means Ruby ≤ 2.4 is unmaintained and considered insecure.
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
The action works on these [GitHub-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners) virtual environments. Virtual environments not listed below are unsupported.
|
||||
The action works on these [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources) images. Runner images not listed below are not supported yet. `$OS-latest` just alias to one of these images.
|
||||
|
||||
| Operating System | Recommended | Other Supported Versions |
|
||||
| ---------------- | ----------- | ------------------------ |
|
||||
| Ubuntu | `ubuntu-latest` (= `ubuntu-20.04`) | `ubuntu-18.04`, `ubuntu-22.04` |
|
||||
| macOS | `macos-latest` (= `macos-11`) | `macos-10.15`, `macos-12` |
|
||||
| Windows | `windows-latest` (= `windows-2022`) | `windows-2019` |
|
||||
| Operating System | Supported |
|
||||
| ---------------- | --------- |
|
||||
| Ubuntu | `ubuntu-18.04`, `ubuntu-20.04`, `ubuntu-22.04` |
|
||||
| macOS | `macos-10.15`, `macos-11`, `macos-12` |
|
||||
| Windows | `windows-2019`, `windows-2022` |
|
||||
|
||||
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
|
||||
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
|
||||
@@ -132,7 +132,7 @@ and the [condition and expression syntax](https://help.github.com/en/actions/ref
|
||||
* engine-version like `ruby-2.6.5` and `truffleruby-19.3.0`
|
||||
* short version like `'2.6'`, automatically using the latest release matching that version (`2.6.10`)
|
||||
* version only like `'2.6.5'`, assumes MRI for the engine
|
||||
* engine only like `truffleruby`, uses the latest stable release of that implementation
|
||||
* engine only like `ruby` and `truffleruby`, uses the latest stable release of that implementation
|
||||
* `.ruby-version` reads from the project's `.ruby-version` file
|
||||
* `.tool-versions` reads from the project's `.tool-versions` file
|
||||
* If the `ruby-version` input is not specified, `.ruby-version` is tried first, followed by `.tool-versions`
|
||||
@@ -249,7 +249,7 @@ This follows the [recommendations](https://github.com/actions/toolkit/blob/maste
|
||||
## Using self-hosted runners
|
||||
|
||||
This action might work with [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners)
|
||||
if the [virtual environment](https://github.com/actions/virtual-environments) is very similar to the ones used by GitHub runners. Notably:
|
||||
if the [Runner Image](https://github.com/actions/runner-images) is very similar to the ones used by GitHub runners. Notably:
|
||||
|
||||
* Make sure to use the same operating system and version.
|
||||
* Set the environment variable `ImageOS` on the runner to the corresponding value on GitHub-hosted runners (e.g. `ubuntu18`/`macos1015`/`win19`). This is necessary to detect the operating system and version.
|
||||
|
||||
+28
-6
@@ -6,7 +6,10 @@ const cache = require('@actions/cache')
|
||||
const common = require('./common')
|
||||
|
||||
export const DEFAULT_CACHE_VERSION = '0'
|
||||
export const BUNDLER_VERSION_REGEXP = /^\d+(?:\.\d+){0,2}$/
|
||||
|
||||
function isValidBundlerVersion(bundlerVersion) {
|
||||
return /^\d+(?:\.\d+){0,2}/.test(bundlerVersion) && !bundlerVersion.endsWith('.dev')
|
||||
}
|
||||
|
||||
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
||||
export function detectGemfiles() {
|
||||
@@ -33,7 +36,7 @@ function readBundledWithFromGemfileLock(lockFile) {
|
||||
const nextLine = lines[bundledWithLine+1]
|
||||
if (nextLine) {
|
||||
const bundlerVersion = nextLine.trim()
|
||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
||||
if (isValidBundlerVersion(bundlerVersion)) {
|
||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||
return bundlerVersion
|
||||
} else {
|
||||
@@ -100,7 +103,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
bundlerVersion = '2'
|
||||
}
|
||||
|
||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
||||
if (isValidBundlerVersion(bundlerVersion)) {
|
||||
// OK - input is a 1, 2, or 3 part version number
|
||||
} else {
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
@@ -120,13 +123,26 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
}
|
||||
}
|
||||
|
||||
const targetRubyVersion = common.targetRubyVersion(engine, rubyVersion)
|
||||
// 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
|
||||
if (bundlerVersion == '2') {
|
||||
if (targetRubyVersion <= 2.5) { // < 2.3.2 already handled above
|
||||
console.log('Ruby 2.3.2 - 2.5 only works with Bundler 2.3')
|
||||
bundlerVersion = '2.3'
|
||||
} else if (targetRubyVersion <= 2.7) {
|
||||
console.log('Ruby 2.6-2.7 only works with Bundler 2.4')
|
||||
bundlerVersion = '2.4'
|
||||
}
|
||||
}
|
||||
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||
// and for https://github.com/oracle/truffleruby/issues/2780
|
||||
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
||||
|
||||
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
||||
const bundlerVersionConstraint = versionParts === 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
||||
const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
||||
|
||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||
|
||||
@@ -216,8 +232,14 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
|
||||
}
|
||||
|
||||
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
|
||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
||||
let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||
const cwd = process.cwd()
|
||||
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 (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) {
|
||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
|
||||
}
|
||||
@@ -95,6 +107,31 @@ export function isBundler2dot2Default(engine, rubyVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
export function targetRubyVersion(engine, rubyVersion) {
|
||||
const version = floatVersion(rubyVersion)
|
||||
if (engine === 'ruby') {
|
||||
return version
|
||||
} else if (engine === 'jruby') {
|
||||
if (version === 9.1) {
|
||||
return 2.3
|
||||
} else if (version === 9.2) {
|
||||
return 2.5
|
||||
} else if (version === 9.3) {
|
||||
return 2.6
|
||||
}
|
||||
} else if (engine.startsWith('truffleruby')) {
|
||||
if (version < 21.0) {
|
||||
return 2.6
|
||||
} else if (version < 22.0) {
|
||||
return 2.7
|
||||
} else if (version < 23.0) {
|
||||
return 3.0
|
||||
}
|
||||
}
|
||||
|
||||
return 9.9 // unknown, assume recent
|
||||
}
|
||||
|
||||
export function floatVersion(rubyVersion) {
|
||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||
if (match) {
|
||||
|
||||
+94
-17
File diff suppressed because one or more lines are too long
@@ -23,7 +23,11 @@ export async function run() {
|
||||
try {
|
||||
await setupRuby()
|
||||
} 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') {
|
||||
await common.measure('bundle install', async () =>
|
||||
await common.time('bundle install', async () =>
|
||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
engine_input, version = ARGV.fetch(0).split('-', 2)
|
||||
versions = ARGV.fetch(0).split(',').map(&:strip)
|
||||
p versions
|
||||
|
||||
if engine_input == 'windows'
|
||||
require_relative 'generate-windows-versions'
|
||||
exit
|
||||
end
|
||||
versions.each do |engine_version|
|
||||
puts engine_version
|
||||
engine, version = engine_version.split('-', 2)
|
||||
p [engine, version]
|
||||
|
||||
MATCH = case engine_input
|
||||
when 'ruby', 'jruby'
|
||||
/^\d+\.\d+\./
|
||||
when 'truffleruby'
|
||||
/^\d+\./
|
||||
end
|
||||
if engine == 'windows'
|
||||
require_relative 'generate-windows-versions'
|
||||
exit
|
||||
end
|
||||
|
||||
raise unless version[MATCH]
|
||||
match = case engine
|
||||
when 'ruby', 'jruby'
|
||||
/^\d+\.\d+\./
|
||||
when 'truffleruby', 'truffleruby+graalvm'
|
||||
/^\d+\./
|
||||
end
|
||||
|
||||
engines = [engine_input]
|
||||
engines << 'truffleruby+graalvm' if engine_input == 'truffleruby'
|
||||
|
||||
engines.each do |engine|
|
||||
puts engine
|
||||
raise engine_version unless version[match]
|
||||
|
||||
# Update ruby-builder-versions.json
|
||||
file = "#{__dir__}/ruby-builder-versions.json"
|
||||
@@ -35,7 +35,7 @@ engines.each do |engine|
|
||||
puts lines[from..to]
|
||||
|
||||
release_line = lines[from..to].find { |line|
|
||||
v = line[/"([^"]+)"/, 1] and v[MATCH] == version[MATCH]
|
||||
v = line[/"([^"]+)"/, 1] and v[match] == version[match]
|
||||
}
|
||||
|
||||
if release_line
|
||||
@@ -51,7 +51,7 @@ engines.each do |engine|
|
||||
file = "#{__dir__}/README.md"
|
||||
lines = File.readlines(file)
|
||||
engine_line = lines.find { |line| line.start_with?("| `#{engine}`") }
|
||||
engine_line.sub!(/(.+ (?:-|until)) (\d+(?:\.\d+)+)/) do
|
||||
engine_line.sub!(/(.+ (?:-|until)) (\d+(?:\.\d+)+(?:-\w+)?)/) do
|
||||
if Gem::Version.new(version) > Gem::Version.new($2)
|
||||
"#{$1} #{version}"
|
||||
else
|
||||
@@ -8,29 +8,29 @@
|
||||
"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",
|
||||
"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.1.0-preview1", "3.1.0", "3.1.1", "3.1.2",
|
||||
"3.2.0-preview1", "3.2.0-preview2", "3.2.0-preview3",
|
||||
"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.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.1",
|
||||
"head", "debug"
|
||||
],
|
||||
"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.4.0.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.1.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.0.0.2", "22.1.0", "22.2.0", "22.3.0", "22.3.1",
|
||||
"head"
|
||||
],
|
||||
"truffleruby+graalvm": [
|
||||
"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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -40,14 +40,19 @@
|
||||
"2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z",
|
||||
"2.7.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.5-1/rubyinstaller-2.7.5-1-x64.7z",
|
||||
"2.7.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.6-1/rubyinstaller-2.7.6-1-x64.7z",
|
||||
"2.7.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.7-1/rubyinstaller-2.7.7-1-x64.7z",
|
||||
"3.0.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.7z",
|
||||
"3.0.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.1-1/rubyinstaller-3.0.1-1-x64.7z",
|
||||
"3.0.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.2-1/rubyinstaller-3.0.2-1-x64.7z",
|
||||
"3.0.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.3-1/rubyinstaller-3.0.3-1-x64.7z",
|
||||
"3.0.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.4-1/rubyinstaller-3.0.4-1-x64.7z",
|
||||
"3.0.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.5-1/rubyinstaller-3.0.5-1-x64.7z",
|
||||
"3.1.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z",
|
||||
"3.1.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.1-1/rubyinstaller-3.1.1-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.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",
|
||||
"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",
|
||||
|
||||
+19
-6
@@ -1,6 +1,8 @@
|
||||
// 7z arguments
|
||||
// -aoa overwrite existing, -bd disable progress indicator
|
||||
|
||||
// OpenSSL version detection is needed in installGCCTools and installJRubyTools
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const cp = require('child_process')
|
||||
@@ -80,7 +82,7 @@ export async function install(platform, engine, version) {
|
||||
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
|
||||
// ucrt64 or mingw64 installed, depending on Ruby version
|
||||
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
|
||||
await installGCCTools(msys2Type)
|
||||
await installGCCTools(msys2Type, version)
|
||||
}
|
||||
|
||||
if (version === 'mswin') {
|
||||
@@ -97,14 +99,24 @@ export async function install(platform, engine, version) {
|
||||
|
||||
// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
|
||||
// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
|
||||
async function installGCCTools(type) {
|
||||
const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => {
|
||||
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/${type}.7z`
|
||||
async function installGCCTools(type, version) {
|
||||
// 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.
|
||||
// With no suffix, archives include OpenSSL 1.1.1, with a '-3.0' suffix, they include
|
||||
// OpenSSL 3.0.x. Note that the mswin archive uses OpenSSL 3.
|
||||
// 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 = ''
|
||||
if (common.isHeadVersion(version) || common.floatVersion(version) >= 3.2) {
|
||||
suffix = '-3.0'
|
||||
}
|
||||
const downloadPath = await common.measure(`Downloading ${type}${suffix} build tools`, async () => {
|
||||
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/${type}${suffix}.7z`
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
})
|
||||
|
||||
await common.measure(`Extracting ${type} build tools`, async () =>
|
||||
await common.measure(`Extracting ${type}${suffix} build tools`, async () =>
|
||||
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
|
||||
}
|
||||
|
||||
@@ -129,7 +141,8 @@ async function installMSYS2Tools() {
|
||||
// windows-2022 and later images
|
||||
export async function installJRubyTools() {
|
||||
await installMSYS2Tools()
|
||||
await installGCCTools('mingw64')
|
||||
// Will need to add OpenSSL version detection when JRuby uses OpenSSL 3.0 ?
|
||||
await installGCCTools('mingw64', '2.7')
|
||||
}
|
||||
|
||||
// Install vcpkg files needed to build mswin Ruby
|
||||
|
||||
Reference in New Issue
Block a user