mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12, windows-2019, windows-2022 ]
|
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:
|
include:
|
||||||
- { os: windows-2019, ruby: mingw }
|
- { os: windows-2019, ruby: mingw }
|
||||||
- { os: windows-2019, ruby: mswin }
|
- { os: windows-2019, ruby: mswin }
|
||||||
@@ -190,10 +195,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
ruby-version: '2.2'
|
ruby-version: '3.1.0'
|
||||||
rubygems: 2.7.11
|
rubygems: 3.4.0
|
||||||
- run: gem --version | grep -F "2.7.11"
|
- run: gem --version | grep -F "3.4.0"
|
||||||
- run: bundle --version | grep -F "1.16.6"
|
- run: bundle --version | grep -F "2.4.0"
|
||||||
|
|
||||||
testFixedBundlerVersionForOldRuby:
|
testFixedBundlerVersionForOldRuby:
|
||||||
name: "Test bundler: 1.x for old Ruby"
|
name: "Test bundler: 1.x for old Ruby"
|
||||||
@@ -239,6 +244,17 @@ jobs:
|
|||||||
bundler: 2.2.3
|
bundler: 2.2.3
|
||||||
- run: bundle --version | grep -F "Bundler version 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:
|
testBundlerDev:
|
||||||
name: "Test BUNDLED WITH Bundler dev"
|
name: "Test BUNDLED WITH Bundler dev"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ 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-preview1, 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.0, head, debug, mingw, mswin, ucrt |
|
||||||
| `jruby` | 9.1.17.0 - 9.4.0.0, head |
|
| `jruby` | 9.1.17.0 - 9.4.0.0, head |
|
||||||
| `truffleruby` | 19.3.0 - 22.3.0, head |
|
| `truffleruby` | 19.3.0 - 22.3.0, head |
|
||||||
| `truffleruby+graalvm` | 21.2.0 - 22.3.0, head |
|
| `truffleruby+graalvm` | 21.2.0 - 22.3.0, head |
|
||||||
@@ -38,13 +38,13 @@ which means Ruby ≤ 2.4 is unmaintained and considered insecure.
|
|||||||
|
|
||||||
### Supported Platforms
|
### 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 |
|
| Operating System | Supported |
|
||||||
| ---------------- | ----------- | ------------------------ |
|
| ---------------- | --------- |
|
||||||
| Ubuntu | `ubuntu-latest` (= `ubuntu-20.04`) | `ubuntu-18.04`, `ubuntu-22.04` |
|
| Ubuntu | `ubuntu-18.04`, `ubuntu-20.04`, `ubuntu-22.04` |
|
||||||
| macOS | `macos-latest` (= `macos-11`) | `macos-10.15`, `macos-12` |
|
| macOS | `macos-10.15`, `macos-11`, `macos-12` |
|
||||||
| Windows | `windows-latest` (= `windows-2022`) | `windows-2019` |
|
| Windows | `windows-2019`, `windows-2022` |
|
||||||
|
|
||||||
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
|
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
|
||||||
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
|
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`
|
* 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`)
|
* 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
|
* 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
|
* `.ruby-version` reads from the project's `.ruby-version` file
|
||||||
* `.tool-versions` reads from the project's `.tool-versions` 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`
|
* 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
|
## 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)
|
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.
|
* 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.
|
* 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.
|
||||||
|
|||||||
+31
-15
@@ -6,7 +6,10 @@ const cache = require('@actions/cache')
|
|||||||
const common = require('./common')
|
const common = require('./common')
|
||||||
|
|
||||||
export const DEFAULT_CACHE_VERSION = '0'
|
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
|
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
||||||
export function detectGemfiles() {
|
export function detectGemfiles() {
|
||||||
@@ -33,7 +36,7 @@ function readBundledWithFromGemfileLock(lockFile) {
|
|||||||
const nextLine = lines[bundledWithLine+1]
|
const nextLine = lines[bundledWithLine+1]
|
||||||
if (nextLine) {
|
if (nextLine) {
|
||||||
const bundlerVersion = nextLine.trim()
|
const bundlerVersion = nextLine.trim()
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||||
return bundlerVersion
|
return bundlerVersion
|
||||||
} else {
|
} else {
|
||||||
@@ -100,7 +103,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
bundlerVersion = '2'
|
bundlerVersion = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
// OK - input is a 1, 2, or 3 part version number
|
// OK - input is a 1, 2, or 3 part version number
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
@@ -120,16 +123,37 @@ 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')
|
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||||
// and for https://github.com/oracle/truffleruby/issues/2780
|
// and for https://github.com/oracle/truffleruby/issues/2780
|
||||||
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
||||||
|
|
||||||
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
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])
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,27 +163,19 @@ 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], envOptions)
|
await exec.exec('bundle', ['config', '--local', 'path', bundleCachePath])
|
||||||
|
|
||||||
if (fs.existsSync(lockFile)) {
|
if (fs.existsSync(lockFile)) {
|
||||||
await exec.exec('bundle', ['config', '--local', 'deployment', 'true'], envOptions)
|
await exec.exec('bundle', ['config', '--local', 'deployment', 'true'])
|
||||||
} 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'], envOptions)
|
await exec.exec('bundle', ['lock'])
|
||||||
}
|
}
|
||||||
|
|
||||||
await afterLockFile(lockFile, platform, engine, rubyVersion)
|
await afterLockFile(lockFile, platform, engine, rubyVersion)
|
||||||
|
|||||||
@@ -95,6 +95,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) {
|
export function floatVersion(rubyVersion) {
|
||||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||||
if (match) {
|
if (match) {
|
||||||
|
|||||||
+77
-24
File diff suppressed because one or more lines are too long
@@ -1,62 +0,0 @@
|
|||||||
engine_input, version = ARGV.fetch(0).split('-', 2)
|
|
||||||
|
|
||||||
if engine_input == 'windows'
|
|
||||||
require_relative 'generate-windows-versions'
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
MATCH = case engine_input
|
|
||||||
when 'ruby', 'jruby'
|
|
||||||
/^\d+\.\d+\./
|
|
||||||
when 'truffleruby'
|
|
||||||
/^\d+\./
|
|
||||||
end
|
|
||||||
|
|
||||||
raise unless version[MATCH]
|
|
||||||
|
|
||||||
engines = [engine_input]
|
|
||||||
engines << 'truffleruby+graalvm' if engine_input == 'truffleruby'
|
|
||||||
|
|
||||||
engines.each do |engine|
|
|
||||||
puts engine
|
|
||||||
|
|
||||||
# Update ruby-builder-versions.json
|
|
||||||
file = "#{__dir__}/ruby-builder-versions.json"
|
|
||||||
lines = File.readlines(file, chomp: true)
|
|
||||||
|
|
||||||
from = lines.index { |line| line.include?(%{"#{engine}": [}) }
|
|
||||||
raise "Could not find start of #{engine}" unless from
|
|
||||||
to = from
|
|
||||||
to += 1 until lines[to].include?(']')
|
|
||||||
|
|
||||||
from += 1 # [
|
|
||||||
to -= 2 # head, ]
|
|
||||||
|
|
||||||
puts lines[from..to]
|
|
||||||
|
|
||||||
release_line = lines[from..to].find { |line|
|
|
||||||
v = line[/"([^"]+)"/, 1] and v[MATCH] == version[MATCH]
|
|
||||||
}
|
|
||||||
|
|
||||||
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+)+)/) do
|
|
||||||
if Gem::Version.new(version) > Gem::Version.new($2)
|
|
||||||
"#{$1} #{version}"
|
|
||||||
else
|
|
||||||
$&
|
|
||||||
end
|
|
||||||
end
|
|
||||||
File.write(file, lines.join)
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
versions = ARGV.fetch(0).split(',').map(&:strip)
|
||||||
|
versions.each do |engine_version|
|
||||||
|
engine_input, version = engine_version.split('-', 2)
|
||||||
|
|
||||||
|
if engine_input == 'windows'
|
||||||
|
require_relative 'generate-windows-versions'
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
|
MATCH = case engine_input
|
||||||
|
when 'ruby', 'jruby'
|
||||||
|
/^\d+\.\d+\./
|
||||||
|
when 'truffleruby'
|
||||||
|
/^\d+\./
|
||||||
|
end
|
||||||
|
|
||||||
|
raise unless version[MATCH]
|
||||||
|
|
||||||
|
engines = [engine_input]
|
||||||
|
engines << 'truffleruby+graalvm' if engine_input == 'truffleruby'
|
||||||
|
|
||||||
|
engines.each do |engine|
|
||||||
|
puts engine
|
||||||
|
|
||||||
|
# Update ruby-builder-versions.json
|
||||||
|
file = "#{__dir__}/ruby-builder-versions.json"
|
||||||
|
lines = File.readlines(file, chomp: true)
|
||||||
|
|
||||||
|
from = lines.index { |line| line.include?(%{"#{engine}": [}) }
|
||||||
|
raise "Could not find start of #{engine}" unless from
|
||||||
|
to = from
|
||||||
|
to += 1 until lines[to].include?(']')
|
||||||
|
|
||||||
|
from += 1 # [
|
||||||
|
to -= 2 # head, ]
|
||||||
|
|
||||||
|
puts lines[from..to]
|
||||||
|
|
||||||
|
release_line = lines[from..to].find { |line|
|
||||||
|
v = line[/"([^"]+)"/, 1] and v[MATCH] == version[MATCH]
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
"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.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.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.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.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.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.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-preview1", "3.2.0-preview2", "3.2.0-preview3", "3.2.0-rc1", "3.2.0",
|
||||||
"head", "debug"
|
"head", "debug"
|
||||||
],
|
],
|
||||||
"jruby": [
|
"jruby": [
|
||||||
|
|||||||
@@ -40,14 +40,18 @@
|
|||||||
"2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z",
|
"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.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.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.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.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.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.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.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.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.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.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",
|
||||||
"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",
|
||||||
|
|||||||
+18
-6
@@ -1,6 +1,8 @@
|
|||||||
// 7z arguments
|
// 7z arguments
|
||||||
// -aoa overwrite existing, -bd disable progress indicator
|
// -aoa overwrite existing, -bd disable progress indicator
|
||||||
|
|
||||||
|
// OpenSSL version detection is needed in installGCCTools and installJRubyTools
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const cp = require('child_process')
|
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
|
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
|
||||||
// ucrt64 or mingw64 installed, depending on Ruby version
|
// ucrt64 or mingw64 installed, depending on Ruby version
|
||||||
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
|
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
|
||||||
await installGCCTools(msys2Type)
|
await installGCCTools(msys2Type, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version === 'mswin') {
|
if (version === 'mswin') {
|
||||||
@@ -97,14 +99,23 @@ export async function install(platform, engine, version) {
|
|||||||
|
|
||||||
// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
|
// 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.
|
// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
|
||||||
async function installGCCTools(type) {
|
async function installGCCTools(type, version) {
|
||||||
const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => {
|
// 2022-Dec ruby/msys2-gcc-pkgs now uses a suffix to delineate different archive versions.
|
||||||
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/${type}.7z`
|
// 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.
|
||||||
|
// Currently, OpenSSL 3 is used in Ruby 3.2 & 'head', both use a custom RubyInstaller2 package.
|
||||||
|
let suffix = ''
|
||||||
|
if ((version === 'head') || (!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)
|
console.log(url)
|
||||||
return await tc.downloadTool(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 }))
|
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +140,8 @@ async function installMSYS2Tools() {
|
|||||||
// windows-2022 and later images
|
// windows-2022 and later images
|
||||||
export async function installJRubyTools() {
|
export async function installJRubyTools() {
|
||||||
await installMSYS2Tools()
|
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
|
// Install vcpkg files needed to build mswin Ruby
|
||||||
|
|||||||
Reference in New Issue
Block a user