mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9669f3ee51 | ||
|
|
31a7f6d628 | ||
|
|
59b5745c73 | ||
|
|
d03a71de6e | ||
|
|
ddde3938f5 | ||
|
|
5a73aa9f67 | ||
|
|
d01c52ad8b | ||
|
|
377a94bc68 | ||
|
|
66dc012cc3 | ||
|
|
2789f85824 | ||
|
|
fbb865d04d | ||
|
|
96ac949ea0 | ||
|
|
92aece5fc9 | ||
|
|
db791aad7b |
@@ -3,7 +3,12 @@ description: Create a report to help us improve
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Please note we will close your issue without comment if you do not fill out the requested information.
|
||||
value: |
|
||||
First, take some time to think whether this is really an issue of ruby/setup-ruby and whether it is fixable in this action.
|
||||
This action basically just downloads a prebuilt Ruby and adds it to `PATH`, so it is unlikely the bug is in this action.
|
||||
Give some thoughts whether it could be an issue in your workflow, in the gems you use, in GitHub Actions, in Ruby, RubyGems, Bundler, etc.
|
||||
This is NOT the place to ask help about your workflow failing (ask that on [GitHub Community](https://github.com/orgs/community/discussions/categories/actions) or [Discussions](https://github.com/ruby/setup-ruby/discussions) instead), it is only to report issues about ruby/setup-ruby.
|
||||
Please note we will close your issue without comment if you do not fill out the requested information.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Ensure the following before filing this issue
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
strategy:
|
||||
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 ]
|
||||
os: [ ubuntu-20.04, ubuntu-22.04, 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', '3.2', ruby-head,
|
||||
jruby, jruby-head,
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.1, head, debug, mingw, mswin, ucrt |
|
||||
| `jruby` | 9.1.17.0 - 9.4.1.0, head |
|
||||
| `jruby` | 9.1.17.0 - 9.4.2.0, head |
|
||||
| `truffleruby` | 19.3.0 - 22.3.1, head |
|
||||
| `truffleruby+graalvm` | 21.2.0 - 22.3.1, head |
|
||||
|
||||
@@ -42,8 +42,8 @@ The action works on these [GitHub-hosted runners](https://docs.github.com/en/act
|
||||
|
||||
| Operating System | Supported |
|
||||
| ---------------- | --------- |
|
||||
| Ubuntu | `ubuntu-18.04`, `ubuntu-20.04`, `ubuntu-22.04` |
|
||||
| macOS | `macos-10.15`, `macos-11`, `macos-12` |
|
||||
| Ubuntu | `ubuntu-20.04`, `ubuntu-22.04` |
|
||||
| macOS | `macos-11`, `macos-12` |
|
||||
| Windows | `windows-2019`, `windows-2022` |
|
||||
|
||||
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
|
||||
@@ -252,7 +252,6 @@ This action might work with [self-hosted runners](https://docs.github.com/en/act
|
||||
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.
|
||||
* Make sure to use the same version of libssl.
|
||||
* Make sure that the operating system has `libyaml-0` and [`libgmp`](https://stackoverflow.com/questions/26555902/ruby-v-dyld-library-not-loaded-usr-local-lib-libgmp-10-dylib) installed
|
||||
* The default tool cache directory (`/opt/hostedtoolcache` on Linux, `/Users/runner/hostedtoolcache` on macOS,
|
||||
@@ -260,9 +259,9 @@ if the [Runner Image](https://github.com/actions/runner-images) is very similar
|
||||
This is necessary since the Ruby builds embed the install path when built and cannot be moved around.
|
||||
* `/home/runner` must be writable by the `runner` user.
|
||||
|
||||
In other cases, please use a system Ruby or [install Ruby manually](https://github.com/postmodern/chruby/wiki#installing-rubies) instead.
|
||||
|
||||
On a self-hosted runner you need to define the `ImageOs` as an evironment variable on the host, you can do this in the `~/actions-runner/.env` file (See [#230](https://github.com/ruby/setup-ruby/issues/230)).
|
||||
In other cases, you will need to install Ruby in the runner tool cache as shown by the action when it detects that case
|
||||
(run it so it will show you where to install Ruby).
|
||||
You could of course also not use this action and e.g. use Ruby from a system package or use a Docker image instead.
|
||||
|
||||
## History
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ inputs:
|
||||
description: |
|
||||
Arbitrary string that will be added to the cache key of the bundler cache. Set or change it if you need
|
||||
to invalidate the cache.
|
||||
self-hosted:
|
||||
description: |
|
||||
Consider the runner as a self-hosted runner, which means not using prebuilt Ruby binaries which only work
|
||||
on GitHub-hosted runners or self-hosted runners with a very similar image to the ones used by GitHub runners.
|
||||
The default is to detect this automatically based on the OS, OS version and $RUNNER_TOOL_CACHE.
|
||||
outputs:
|
||||
ruby-prefix:
|
||||
description: 'The prefix of the installed ruby'
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
||||
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}`
|
||||
let key = `setup-ruby-bundler-cache-v5-${common.getOSNameVersionArch()}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}`
|
||||
|
||||
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
|
||||
key += `-v-${cacheVersion}`
|
||||
|
||||
@@ -5,12 +5,19 @@ const util = require('util')
|
||||
const stream = require('stream')
|
||||
const crypto = require('crypto')
|
||||
const core = require('@actions/core')
|
||||
const tc = require('@actions/tool-cache')
|
||||
const { performance } = require('perf_hooks')
|
||||
const linuxOSInfo = require('linux-os-info')
|
||||
import macosRelease from 'macos-release'
|
||||
|
||||
export const windows = (os.platform() === 'win32')
|
||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
||||
export const drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||
|
||||
export const inputs = {
|
||||
selfHosted: undefined
|
||||
}
|
||||
|
||||
export function partition(string, separator) {
|
||||
const i = string.indexOf(separator)
|
||||
if (i === -1) {
|
||||
@@ -151,75 +158,144 @@ export async function hashFile(file) {
|
||||
return hash.digest('hex')
|
||||
}
|
||||
|
||||
function getImageOS() {
|
||||
const imageOS = process.env['ImageOS']
|
||||
if (!imageOS) {
|
||||
throw new Error('The environment variable ImageOS must be set')
|
||||
}
|
||||
return imageOS
|
||||
}
|
||||
|
||||
export const supportedPlatforms = [
|
||||
'ubuntu-18.04',
|
||||
'ubuntu-20.04',
|
||||
'ubuntu-22.04',
|
||||
'macos-10.15',
|
||||
'macos-11',
|
||||
'macos-12',
|
||||
'windows-2019',
|
||||
'windows-2022',
|
||||
const GitHubHostedPlatforms = [
|
||||
'ubuntu-20.04-x64',
|
||||
'ubuntu-22.04-x64',
|
||||
'macos-11-x64',
|
||||
'macos-12-x64',
|
||||
'windows-2019-x64',
|
||||
'windows-2022-x64',
|
||||
]
|
||||
|
||||
// Actually a self-hosted runner for which the OS and OS version does not correspond to a GitHub-hosted runner image,
|
||||
export function isSelfHostedRunner() {
|
||||
if (inputs.selfHosted === undefined) {
|
||||
throw new Error('inputs.selfHosted should have been already set')
|
||||
}
|
||||
|
||||
return inputs.selfHosted === 'true' ||
|
||||
!GitHubHostedPlatforms.includes(getOSNameVersionArch())
|
||||
}
|
||||
|
||||
export function selfHostedRunnerReason() {
|
||||
if (inputs.selfHosted === 'true') {
|
||||
return 'the self-hosted input was set'
|
||||
} else if (!GitHubHostedPlatforms.includes(getOSNameVersionArch())) {
|
||||
return 'the platform does not match a GitHub-hosted runner image (or that image is deprecated and no longer supported)'
|
||||
} else {
|
||||
return 'unknown reason'
|
||||
}
|
||||
}
|
||||
|
||||
let virtualEnvironmentName = undefined
|
||||
|
||||
export function getVirtualEnvironmentName() {
|
||||
const imageOS = getImageOS()
|
||||
|
||||
let match = imageOS.match(/^ubuntu(\d+)/) // e.g. ubuntu18
|
||||
if (match) {
|
||||
return `ubuntu-${match[1]}.04`
|
||||
if (virtualEnvironmentName !== undefined) {
|
||||
return virtualEnvironmentName
|
||||
}
|
||||
|
||||
match = imageOS.match(/^macos(\d{2})(\d+)?/) // e.g. macos1015, macos11
|
||||
if (match) {
|
||||
if (match[2]) {
|
||||
return `macos-${match[1]}.${match[2]}`
|
||||
} else {
|
||||
return `macos-${match[1]}`
|
||||
}
|
||||
const platform = os.platform()
|
||||
let osName
|
||||
let osVersion
|
||||
if (platform === 'linux') {
|
||||
const info = linuxOSInfo({mode: 'sync'})
|
||||
osName = info.id
|
||||
osVersion = info.version_id
|
||||
} else if (platform === 'darwin') {
|
||||
osName = 'macos'
|
||||
osVersion = macosRelease().version
|
||||
} else if (platform === 'win32') {
|
||||
osName = 'windows'
|
||||
osVersion = findWindowsVersion()
|
||||
} else {
|
||||
throw new Error(`Unknown platform ${platform}`)
|
||||
}
|
||||
|
||||
match = imageOS.match(/^win(\d+)/) // e.g. win19
|
||||
if (match) {
|
||||
return `windows-20${match[1]}`
|
||||
}
|
||||
virtualEnvironmentName = `${osName}-${osVersion}`
|
||||
return virtualEnvironmentName
|
||||
}
|
||||
|
||||
throw new Error(`Unknown ImageOS ${imageOS}`)
|
||||
export function getOSNameVersionArch() {
|
||||
return `${getVirtualEnvironmentName()}-${os.arch()}`
|
||||
}
|
||||
|
||||
function findWindowsVersion() {
|
||||
const version = os.version();
|
||||
const match = version.match(/^Windows Server (\d+) Datacenter/)
|
||||
if (match) {
|
||||
return match[1]
|
||||
} else {
|
||||
throw new Error('Could not find Windows version')
|
||||
}
|
||||
}
|
||||
|
||||
export function shouldUseToolCache(engine, version) {
|
||||
return engine === 'ruby' && !isHeadVersion(version)
|
||||
return (engine === 'ruby' && !isHeadVersion(version)) || isSelfHostedRunner()
|
||||
}
|
||||
|
||||
function getPlatformToolCache(platform) {
|
||||
// Hardcode paths rather than using $RUNNER_TOOL_CACHE because the prebuilt Rubies cannot be moved anyway
|
||||
export function getToolCachePath() {
|
||||
if (isSelfHostedRunner()) {
|
||||
return getRunnerToolCache()
|
||||
} else {
|
||||
// Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE
|
||||
// so use that path is not isSelfHostedRunner()
|
||||
return getDefaultToolCachePath()
|
||||
}
|
||||
}
|
||||
|
||||
export function getRunnerToolCache() {
|
||||
const runnerToolCache = process.env['RUNNER_TOOL_CACHE']
|
||||
if (!runnerToolCache) {
|
||||
throw new Error('$RUNNER_TOOL_CACHE must be set')
|
||||
}
|
||||
return runnerToolCache
|
||||
}
|
||||
|
||||
// Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE
|
||||
function getDefaultToolCachePath() {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
if (platform.startsWith('ubuntu-')) {
|
||||
return '/opt/hostedtoolcache'
|
||||
} else if (platform.startsWith('macos-')) {
|
||||
return '/Users/runner/hostedtoolcache'
|
||||
} else if (platform.startsWith('windows-')) {
|
||||
return 'C:/hostedtoolcache/windows'
|
||||
return 'C:\\hostedtoolcache\\windows'
|
||||
} else {
|
||||
throw new Error('Unknown platform')
|
||||
}
|
||||
}
|
||||
|
||||
export function getToolCacheRubyPrefix(platform, version) {
|
||||
const toolCache = getPlatformToolCache(platform)
|
||||
return path.join(toolCache, 'Ruby', version, 'x64')
|
||||
// tc.find() but using RUNNER_TOOL_CACHE=getToolCachePath()
|
||||
export function toolCacheFind(engine, version) {
|
||||
const originalToolCache = getToolCachePath()
|
||||
process.env['RUNNER_TOOL_CACHE'] = getToolCachePath()
|
||||
try {
|
||||
return tc.find(engineToToolCacheName(engine), version)
|
||||
} finally {
|
||||
process.env['RUNNER_TOOL_CACHE'] = originalToolCache
|
||||
}
|
||||
}
|
||||
|
||||
function engineToToolCacheName(engine) {
|
||||
return {
|
||||
ruby: 'Ruby',
|
||||
jruby: 'JRuby',
|
||||
truffleruby: 'TruffleRuby',
|
||||
"truffleruby+graalvm": 'TruffleRubyGraalVM'
|
||||
}[engine]
|
||||
}
|
||||
|
||||
export function getToolCacheRubyPrefix(platform, engine, version) {
|
||||
const toolCache = getToolCachePath()
|
||||
return path.join(toolCache, engineToToolCacheName(engine), version, os.arch())
|
||||
}
|
||||
|
||||
export function toolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||
return `${toolCacheRubyPrefix}.complete`
|
||||
}
|
||||
|
||||
export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||
const completeFile = `${toolCacheRubyPrefix}.complete`
|
||||
fs.writeFileSync(completeFile, '')
|
||||
fs.writeFileSync(toolCacheCompleteFile(toolCacheRubyPrefix), '')
|
||||
}
|
||||
|
||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||
|
||||
+396
-102
@@ -17,7 +17,7 @@ const path = __nccwpck_require__(1017)
|
||||
const core = __nccwpck_require__(2186)
|
||||
const exec = __nccwpck_require__(1514)
|
||||
const cache = __nccwpck_require__(7799)
|
||||
const common = __nccwpck_require__(4717)
|
||||
const common = __nccwpck_require__(3143)
|
||||
|
||||
const DEFAULT_CACHE_VERSION = '0'
|
||||
|
||||
@@ -249,7 +249,7 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
||||
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}`
|
||||
let key = `setup-ruby-bundler-cache-v5-${common.getOSNameVersionArch()}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}`
|
||||
|
||||
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
|
||||
key += `-v-${cacheVersion}`
|
||||
@@ -278,47 +278,103 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4717:
|
||||
/***/ 3143:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
// ESM COMPAT FLAG
|
||||
__nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "windows": () => (/* binding */ windows),
|
||||
/* harmony export */ "drive": () => (/* binding */ drive),
|
||||
/* harmony export */ "partition": () => (/* binding */ partition),
|
||||
/* harmony export */ "measure": () => (/* binding */ measure),
|
||||
/* harmony export */ "time": () => (/* binding */ time),
|
||||
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
||||
/* harmony export */ "hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
/* harmony export */ "isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
||||
/* harmony export */ "targetRubyVersion": () => (/* binding */ targetRubyVersion),
|
||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
||||
/* harmony export */ "hashFile": () => (/* binding */ hashFile),
|
||||
/* harmony export */ "supportedPlatforms": () => (/* binding */ supportedPlatforms),
|
||||
/* harmony export */ "getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName),
|
||||
/* harmony export */ "shouldUseToolCache": () => (/* binding */ shouldUseToolCache),
|
||||
/* harmony export */ "getToolCacheRubyPrefix": () => (/* binding */ getToolCacheRubyPrefix),
|
||||
/* harmony export */ "createToolCacheCompleteFile": () => (/* binding */ createToolCacheCompleteFile),
|
||||
/* harmony export */ "win2nix": () => (/* binding */ win2nix),
|
||||
/* harmony export */ "setupPath": () => (/* binding */ setupPath)
|
||||
/* harmony export */ });
|
||||
|
||||
// EXPORTS
|
||||
__nccwpck_require__.d(__webpack_exports__, {
|
||||
"createToolCacheCompleteFile": () => (/* binding */ createToolCacheCompleteFile),
|
||||
"drive": () => (/* binding */ drive),
|
||||
"floatVersion": () => (/* binding */ floatVersion),
|
||||
"getOSNameVersionArch": () => (/* binding */ getOSNameVersionArch),
|
||||
"getRunnerToolCache": () => (/* binding */ getRunnerToolCache),
|
||||
"getToolCachePath": () => (/* binding */ getToolCachePath),
|
||||
"getToolCacheRubyPrefix": () => (/* binding */ getToolCacheRubyPrefix),
|
||||
"getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName),
|
||||
"hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||
"hashFile": () => (/* binding */ hashFile),
|
||||
"inputs": () => (/* binding */ inputs),
|
||||
"isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
"isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
"isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
||||
"isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||
"isSelfHostedRunner": () => (/* binding */ isSelfHostedRunner),
|
||||
"isStableVersion": () => (/* binding */ isStableVersion),
|
||||
"measure": () => (/* binding */ measure),
|
||||
"partition": () => (/* binding */ partition),
|
||||
"selfHostedRunnerReason": () => (/* binding */ selfHostedRunnerReason),
|
||||
"setupPath": () => (/* binding */ setupPath),
|
||||
"shouldUseToolCache": () => (/* binding */ shouldUseToolCache),
|
||||
"targetRubyVersion": () => (/* binding */ targetRubyVersion),
|
||||
"time": () => (/* binding */ time),
|
||||
"toolCacheCompleteFile": () => (/* binding */ toolCacheCompleteFile),
|
||||
"toolCacheFind": () => (/* binding */ toolCacheFind),
|
||||
"win2nix": () => (/* binding */ win2nix),
|
||||
"windows": () => (/* binding */ windows)
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: external "node:os"
|
||||
const external_node_os_namespaceObject = require("node:os");
|
||||
;// CONCATENATED MODULE: ./node_modules/macos-release/index.js
|
||||
|
||||
|
||||
const nameMap = new Map([
|
||||
[22, ['Ventura', '13']],
|
||||
[21, ['Monterey', '12']],
|
||||
[20, ['Big Sur', '11']],
|
||||
[19, ['Catalina', '10.15']],
|
||||
[18, ['Mojave', '10.14']],
|
||||
[17, ['High Sierra', '10.13']],
|
||||
[16, ['Sierra', '10.12']],
|
||||
[15, ['El Capitan', '10.11']],
|
||||
[14, ['Yosemite', '10.10']],
|
||||
[13, ['Mavericks', '10.9']],
|
||||
[12, ['Mountain Lion', '10.8']],
|
||||
[11, ['Lion', '10.7']],
|
||||
[10, ['Snow Leopard', '10.6']],
|
||||
[9, ['Leopard', '10.5']],
|
||||
[8, ['Tiger', '10.4']],
|
||||
[7, ['Panther', '10.3']],
|
||||
[6, ['Jaguar', '10.2']],
|
||||
[5, ['Puma', '10.1']],
|
||||
]);
|
||||
|
||||
function macosRelease(release) {
|
||||
release = Number((release || external_node_os_namespaceObject.release()).split('.')[0]);
|
||||
|
||||
const [name, version] = nameMap.get(release) || ['Unknown', ''];
|
||||
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
};
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./common.js
|
||||
const os = __nccwpck_require__(2037)
|
||||
const path = __nccwpck_require__(1017)
|
||||
const fs = __nccwpck_require__(7147)
|
||||
const util = __nccwpck_require__(3837)
|
||||
const stream = __nccwpck_require__(2781)
|
||||
const crypto = __nccwpck_require__(6113)
|
||||
const common_crypto = __nccwpck_require__(6113)
|
||||
const core = __nccwpck_require__(2186)
|
||||
const tc = __nccwpck_require__(7784)
|
||||
const { performance } = __nccwpck_require__(4074)
|
||||
const linuxOSInfo = __nccwpck_require__(8487)
|
||||
;
|
||||
|
||||
const windows = (os.platform() === 'win32')
|
||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
||||
const drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||
|
||||
const inputs = {
|
||||
selfHosted: undefined
|
||||
}
|
||||
|
||||
function partition(string, separator) {
|
||||
const i = string.indexOf(separator)
|
||||
if (i === -1) {
|
||||
@@ -453,81 +509,150 @@ function floatVersion(rubyVersion) {
|
||||
|
||||
async function hashFile(file) {
|
||||
// See https://github.com/actions/runner/blob/master/src/Misc/expressionFunc/hashFiles/src/hashFiles.ts
|
||||
const hash = crypto.createHash('sha256')
|
||||
const hash = common_crypto.createHash('sha256')
|
||||
const pipeline = util.promisify(stream.pipeline)
|
||||
await pipeline(fs.createReadStream(file), hash)
|
||||
return hash.digest('hex')
|
||||
}
|
||||
|
||||
function getImageOS() {
|
||||
const imageOS = process.env['ImageOS']
|
||||
if (!imageOS) {
|
||||
throw new Error('The environment variable ImageOS must be set')
|
||||
}
|
||||
return imageOS
|
||||
}
|
||||
|
||||
const supportedPlatforms = [
|
||||
'ubuntu-18.04',
|
||||
'ubuntu-20.04',
|
||||
'ubuntu-22.04',
|
||||
'macos-10.15',
|
||||
'macos-11',
|
||||
'macos-12',
|
||||
'windows-2019',
|
||||
'windows-2022',
|
||||
const GitHubHostedPlatforms = [
|
||||
'ubuntu-20.04-x64',
|
||||
'ubuntu-22.04-x64',
|
||||
'macos-11-x64',
|
||||
'macos-12-x64',
|
||||
'windows-2019-x64',
|
||||
'windows-2022-x64',
|
||||
]
|
||||
|
||||
// Actually a self-hosted runner for which the OS and OS version does not correspond to a GitHub-hosted runner image,
|
||||
function isSelfHostedRunner() {
|
||||
if (inputs.selfHosted === undefined) {
|
||||
throw new Error('inputs.selfHosted should have been already set')
|
||||
}
|
||||
|
||||
return inputs.selfHosted === 'true' ||
|
||||
!GitHubHostedPlatforms.includes(getOSNameVersionArch())
|
||||
}
|
||||
|
||||
function selfHostedRunnerReason() {
|
||||
if (inputs.selfHosted === 'true') {
|
||||
return 'the self-hosted input was set'
|
||||
} else if (!GitHubHostedPlatforms.includes(getOSNameVersionArch())) {
|
||||
return 'the platform does not match a GitHub-hosted runner image (or that image is deprecated and no longer supported)'
|
||||
} else {
|
||||
return 'unknown reason'
|
||||
}
|
||||
}
|
||||
|
||||
let virtualEnvironmentName = undefined
|
||||
|
||||
function getVirtualEnvironmentName() {
|
||||
const imageOS = getImageOS()
|
||||
|
||||
let match = imageOS.match(/^ubuntu(\d+)/) // e.g. ubuntu18
|
||||
if (match) {
|
||||
return `ubuntu-${match[1]}.04`
|
||||
if (virtualEnvironmentName !== undefined) {
|
||||
return virtualEnvironmentName
|
||||
}
|
||||
|
||||
match = imageOS.match(/^macos(\d{2})(\d+)?/) // e.g. macos1015, macos11
|
||||
if (match) {
|
||||
if (match[2]) {
|
||||
return `macos-${match[1]}.${match[2]}`
|
||||
} else {
|
||||
return `macos-${match[1]}`
|
||||
}
|
||||
const platform = os.platform()
|
||||
let osName
|
||||
let osVersion
|
||||
if (platform === 'linux') {
|
||||
const info = linuxOSInfo({mode: 'sync'})
|
||||
osName = info.id
|
||||
osVersion = info.version_id
|
||||
} else if (platform === 'darwin') {
|
||||
osName = 'macos'
|
||||
osVersion = macosRelease().version
|
||||
} else if (platform === 'win32') {
|
||||
osName = 'windows'
|
||||
osVersion = findWindowsVersion()
|
||||
} else {
|
||||
throw new Error(`Unknown platform ${platform}`)
|
||||
}
|
||||
|
||||
match = imageOS.match(/^win(\d+)/) // e.g. win19
|
||||
if (match) {
|
||||
return `windows-20${match[1]}`
|
||||
}
|
||||
virtualEnvironmentName = `${osName}-${osVersion}`
|
||||
return virtualEnvironmentName
|
||||
}
|
||||
|
||||
throw new Error(`Unknown ImageOS ${imageOS}`)
|
||||
function getOSNameVersionArch() {
|
||||
return `${getVirtualEnvironmentName()}-${os.arch()}`
|
||||
}
|
||||
|
||||
function findWindowsVersion() {
|
||||
const version = os.version();
|
||||
const match = version.match(/^Windows Server (\d+) Datacenter/)
|
||||
if (match) {
|
||||
return match[1]
|
||||
} else {
|
||||
throw new Error('Could not find Windows version')
|
||||
}
|
||||
}
|
||||
|
||||
function shouldUseToolCache(engine, version) {
|
||||
return engine === 'ruby' && !isHeadVersion(version)
|
||||
return (engine === 'ruby' && !isHeadVersion(version)) || isSelfHostedRunner()
|
||||
}
|
||||
|
||||
function getPlatformToolCache(platform) {
|
||||
// Hardcode paths rather than using $RUNNER_TOOL_CACHE because the prebuilt Rubies cannot be moved anyway
|
||||
function getToolCachePath() {
|
||||
if (isSelfHostedRunner()) {
|
||||
return getRunnerToolCache()
|
||||
} else {
|
||||
// Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE
|
||||
// so use that path is not isSelfHostedRunner()
|
||||
return getDefaultToolCachePath()
|
||||
}
|
||||
}
|
||||
|
||||
function getRunnerToolCache() {
|
||||
const runnerToolCache = process.env['RUNNER_TOOL_CACHE']
|
||||
if (!runnerToolCache) {
|
||||
throw new Error('$RUNNER_TOOL_CACHE must be set')
|
||||
}
|
||||
return runnerToolCache
|
||||
}
|
||||
|
||||
// Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE
|
||||
function getDefaultToolCachePath() {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
if (platform.startsWith('ubuntu-')) {
|
||||
return '/opt/hostedtoolcache'
|
||||
} else if (platform.startsWith('macos-')) {
|
||||
return '/Users/runner/hostedtoolcache'
|
||||
} else if (platform.startsWith('windows-')) {
|
||||
return 'C:/hostedtoolcache/windows'
|
||||
return 'C:\\hostedtoolcache\\windows'
|
||||
} else {
|
||||
throw new Error('Unknown platform')
|
||||
}
|
||||
}
|
||||
|
||||
function getToolCacheRubyPrefix(platform, version) {
|
||||
const toolCache = getPlatformToolCache(platform)
|
||||
return path.join(toolCache, 'Ruby', version, 'x64')
|
||||
// tc.find() but using RUNNER_TOOL_CACHE=getToolCachePath()
|
||||
function toolCacheFind(engine, version) {
|
||||
const originalToolCache = getToolCachePath()
|
||||
process.env['RUNNER_TOOL_CACHE'] = getToolCachePath()
|
||||
try {
|
||||
return tc.find(engineToToolCacheName(engine), version)
|
||||
} finally {
|
||||
process.env['RUNNER_TOOL_CACHE'] = originalToolCache
|
||||
}
|
||||
}
|
||||
|
||||
function engineToToolCacheName(engine) {
|
||||
return {
|
||||
ruby: 'Ruby',
|
||||
jruby: 'JRuby',
|
||||
truffleruby: 'TruffleRuby',
|
||||
"truffleruby+graalvm": 'TruffleRubyGraalVM'
|
||||
}[engine]
|
||||
}
|
||||
|
||||
function getToolCacheRubyPrefix(platform, engine, version) {
|
||||
const toolCache = getToolCachePath()
|
||||
return path.join(toolCache, engineToToolCacheName(engine), version, os.arch())
|
||||
}
|
||||
|
||||
function toolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||
return `${toolCacheRubyPrefix}.complete`
|
||||
}
|
||||
|
||||
function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||
const completeFile = `${toolCacheRubyPrefix}.complete`
|
||||
fs.writeFileSync(completeFile, '')
|
||||
fs.writeFileSync(toolCacheCompleteFile(toolCacheRubyPrefix), '')
|
||||
}
|
||||
|
||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||
@@ -50428,6 +50553,177 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8487:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
const fs = __nccwpck_require__(7147)
|
||||
const os = __nccwpck_require__(2037)
|
||||
|
||||
/**
|
||||
* Get OS release info from the node os module and augment that with information
|
||||
* from '/etc/os-release', '/usr/lib/os-release', or '/etc/alpine-release'. The
|
||||
* information in that file is distribution-dependent. If not Linux return only
|
||||
* the node os module info.
|
||||
*
|
||||
* @returns info {object} via Promise | callback | return value
|
||||
*
|
||||
* the file property in the info object will be filled in with one of:
|
||||
* - undefined, if not Linux
|
||||
* - the file path (above) used
|
||||
* - an Error instance if no file could be read
|
||||
*/
|
||||
function linuxOsInfo (opts) {
|
||||
let outputData = {
|
||||
type: os.type(),
|
||||
platform: os.platform(),
|
||||
hostname: os.hostname(),
|
||||
arch: os.arch(),
|
||||
release: os.release(),
|
||||
file: undefined,
|
||||
}
|
||||
|
||||
let mode = 'promise'
|
||||
opts = opts || {}
|
||||
|
||||
|
||||
|
||||
const list = Array.isArray(opts.list) ? opts.list : defaultList
|
||||
|
||||
if (typeof opts.mode === 'function') {
|
||||
mode = 'callback'
|
||||
} else if (opts.mode === 'sync') {
|
||||
mode = 'sync'
|
||||
}
|
||||
|
||||
if (os.type() !== 'Linux') {
|
||||
if (mode === 'promise') {
|
||||
return Promise.resolve(outputData)
|
||||
} else if (mode === 'callback') {
|
||||
return opts.mode(null, outputData)
|
||||
} else {
|
||||
return outputData
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === 'sync') {
|
||||
return synchronousRead()
|
||||
} else {
|
||||
// return a Promise that can be ignored if caller expects a callback
|
||||
return new Promise(asynchronousRead)
|
||||
}
|
||||
|
||||
// loop through the file list synchronously
|
||||
function synchronousRead () {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let data
|
||||
try {
|
||||
data = fs.readFileSync(list[i].path, 'utf8')
|
||||
list[i].parser(data, outputData)
|
||||
outputData.file = list[i].path
|
||||
return outputData
|
||||
} catch (e) {
|
||||
// accumulate errors?
|
||||
}
|
||||
}
|
||||
outputData.file = new Error('linux-os-info - no file found')
|
||||
return outputData
|
||||
}
|
||||
|
||||
// loop through the file list on completion of async reads
|
||||
function asynchronousRead (resolve, reject) {
|
||||
let i = 0
|
||||
|
||||
function tryRead () {
|
||||
if (i >= list.length) {
|
||||
const e = new Error('linux-os-info - no file found')
|
||||
outputData.file = e
|
||||
mode === 'promise' ? resolve(outputData) : opts.mode(null, outputData)
|
||||
} else {
|
||||
// try to read the file.
|
||||
let file = list[i].path
|
||||
fs.readFile(file, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
i += 1
|
||||
tryRead()
|
||||
} else {
|
||||
list[i].parser(data, outputData)
|
||||
outputData.file = file
|
||||
mode === 'promise' ? resolve(outputData) : opts.mode(null, outputData)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
tryRead()
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// the default list of files to try to read and their parsers.
|
||||
// in theory this can be replaced, especially for testing purposes.
|
||||
// but it's not documented at this time unless one is reading this.
|
||||
//
|
||||
const defaultList = [
|
||||
{path: '/etc/os-release', parser: etcOsRelease},
|
||||
{path: '/usr/lib/os-release', parser: usrLibOsRelease},
|
||||
{path: '/etc/alpine-release', parser: etcAlpineRelease}
|
||||
]
|
||||
|
||||
//
|
||||
// helper functions to parse file data
|
||||
//
|
||||
|
||||
function etcOsRelease(data, outputData) {
|
||||
addOsReleaseToOutputData(data, outputData)
|
||||
}
|
||||
|
||||
function usrLibOsRelease(data, outputData) {
|
||||
addOsReleaseToOutputData(data, outputData)
|
||||
}
|
||||
|
||||
// the alpine-release file only contains the version string
|
||||
// so fill in the basics based on that.
|
||||
function etcAlpineRelease(data, outputData) {
|
||||
outputData.name = 'Alpine'
|
||||
outputData.id = 'alpine'
|
||||
outputData.version = data
|
||||
outputData.version_id = data
|
||||
}
|
||||
|
||||
function addOsReleaseToOutputData(data, outputData) {
|
||||
const lines = data.split('\n')
|
||||
|
||||
lines.forEach(line => {
|
||||
let index = line.indexOf('=')
|
||||
// only look at lines with at least a one character key
|
||||
if (index >= 1) {
|
||||
// lowercase key and remove quotes on value
|
||||
let key = line.slice(0, index).toLowerCase()
|
||||
let value = line.slice(index + 1).replace(/"/g, '')
|
||||
|
||||
Object.defineProperty(outputData, key, {
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = linuxOsInfo
|
||||
|
||||
//
|
||||
// a tiny bit of testing
|
||||
//
|
||||
if (false) {}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7129:
|
||||
@@ -67981,10 +68277,11 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
const os = __nccwpck_require__(2037)
|
||||
const fs = __nccwpck_require__(7147)
|
||||
const path = __nccwpck_require__(1017)
|
||||
const core = __nccwpck_require__(2186)
|
||||
const exec = __nccwpck_require__(1514)
|
||||
const io = __nccwpck_require__(7436)
|
||||
const tc = __nccwpck_require__(7784)
|
||||
const common = __nccwpck_require__(4717)
|
||||
const common = __nccwpck_require__(3143)
|
||||
const rubyBuilderVersions = __nccwpck_require__(5959)
|
||||
|
||||
const builderReleaseTag = 'toolcache'
|
||||
@@ -67993,21 +68290,31 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
|
||||
const windows = common.windows
|
||||
|
||||
function getAvailableVersions(platform, engine) {
|
||||
if (!common.supportedPlatforms.includes(platform)) {
|
||||
throw new Error(`Unsupported platform ${platform}`)
|
||||
}
|
||||
|
||||
return rubyBuilderVersions[engine]
|
||||
}
|
||||
|
||||
async function install(platform, engine, version) {
|
||||
let rubyPrefix, inToolCache
|
||||
if (common.shouldUseToolCache(engine, version)) {
|
||||
inToolCache = tc.find('Ruby', version)
|
||||
inToolCache = common.toolCacheFind(engine, version)
|
||||
if (inToolCache) {
|
||||
rubyPrefix = inToolCache
|
||||
} else {
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
||||
const toolCacheRubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||
if (common.isSelfHostedRunner()) {
|
||||
const rubyBuildDefinition = engine === 'ruby' ? version : `${engine}-${version}`
|
||||
core.error(
|
||||
`The current runner (${common.getOSNameVersionArch()}) was detected as self-hosted because ${common.selfHostedRunnerReason()}.\n` +
|
||||
`In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build\n` +
|
||||
`You can take inspiration from this workflow for more details: https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml\n` +
|
||||
`$ ruby-build ${rubyBuildDefinition} ${toolCacheRubyPrefix}\n` +
|
||||
`Once that completes successfully, mark it as complete with:\n` +
|
||||
`$ touch ${common.toolCacheCompleteFile(toolCacheRubyPrefix)}\n` +
|
||||
`It is your responsibility to ensure installing Ruby like that is not done in parallel.\n`)
|
||||
process.exit(1)
|
||||
} else {
|
||||
rubyPrefix = toolCacheRubyPrefix
|
||||
}
|
||||
}
|
||||
} else if (windows) {
|
||||
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
||||
@@ -68019,7 +68326,7 @@ async function install(platform, engine, version) {
|
||||
common.setupPath([path.join(rubyPrefix, 'bin')])
|
||||
|
||||
if (!inToolCache) {
|
||||
await preparePrefix(rubyPrefix)
|
||||
await io.mkdirP(rubyPrefix)
|
||||
if (engine === 'truffleruby+graalvm') {
|
||||
await installWithRubyBuild(engine, version, rubyPrefix)
|
||||
} else {
|
||||
@@ -68030,15 +68337,6 @@ async function install(platform, engine, version) {
|
||||
return rubyPrefix
|
||||
}
|
||||
|
||||
async function preparePrefix(rubyPrefix) {
|
||||
const parentDir = path.dirname(rubyPrefix)
|
||||
|
||||
await io.rmRF(rubyPrefix)
|
||||
if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) {
|
||||
await io.mkdirP(parentDir)
|
||||
}
|
||||
}
|
||||
|
||||
async function installWithRubyBuild(engine, version, rubyPrefix) {
|
||||
const tmp = process.env['RUNNER_TEMP'] || os.tmpdir()
|
||||
const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')
|
||||
@@ -68164,7 +68462,7 @@ const core = __nccwpck_require__(2186)
|
||||
const exec = __nccwpck_require__(1514)
|
||||
const io = __nccwpck_require__(7436)
|
||||
const tc = __nccwpck_require__(7784)
|
||||
const common = __nccwpck_require__(4717)
|
||||
const common = __nccwpck_require__(3143)
|
||||
const rubyInstallerVersions = __nccwpck_require__(6459)
|
||||
|
||||
const drive = common.drive
|
||||
@@ -68181,13 +68479,7 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
||||
const msys1 = `${drive}:\\DevKit64`
|
||||
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
||||
|
||||
const virtualEnv = common.getVirtualEnvironmentName()
|
||||
|
||||
function getAvailableVersions(platform, engine) {
|
||||
if (!common.supportedPlatforms.includes(platform)) {
|
||||
throw new Error(`Unsupported platform ${platform}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby') {
|
||||
return Object.keys(rubyInstallerVersions)
|
||||
} else {
|
||||
@@ -68200,7 +68492,7 @@ async function install(platform, engine, version) {
|
||||
|
||||
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
|
||||
// and MinGW build tools installed. The windows-2022 image has neither.
|
||||
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv)
|
||||
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(platform)
|
||||
|
||||
if (!url.endsWith('.7z')) {
|
||||
throw new Error(`URL should end in .7z: ${url}`)
|
||||
@@ -68209,11 +68501,11 @@ async function install(platform, engine, version) {
|
||||
|
||||
let rubyPrefix, inToolCache
|
||||
if (common.shouldUseToolCache(engine, version)) {
|
||||
inToolCache = tc.find('Ruby', version)
|
||||
inToolCache = common.toolCacheFind(engine, version)
|
||||
if (inToolCache) {
|
||||
rubyPrefix = inToolCache
|
||||
} else {
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||
}
|
||||
} else {
|
||||
rubyPrefix = `${drive}:\\${base}`
|
||||
@@ -68660,7 +68952,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","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.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.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.3.1","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","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.3.10.0","9.4.0.0","9.4.1.0","9.4.2.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","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","head"]}');
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -68752,7 +69044,7 @@ const fs = __nccwpck_require__(7147)
|
||||
const path = __nccwpck_require__(1017)
|
||||
const core = __nccwpck_require__(2186)
|
||||
const exec = __nccwpck_require__(1514)
|
||||
const common = __nccwpck_require__(4717)
|
||||
const common = __nccwpck_require__(3143)
|
||||
const rubygems = __nccwpck_require__(160)
|
||||
const bundler = __nccwpck_require__(1641)
|
||||
|
||||
@@ -68765,6 +69057,7 @@ const inputDefaults = {
|
||||
'bundler-cache': 'false',
|
||||
'working-directory': '.',
|
||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||
'self-hosted': 'false',
|
||||
}
|
||||
|
||||
// entry point when this action is run on its own
|
||||
@@ -68788,6 +69081,7 @@ async function setupRuby(options = {}) {
|
||||
inputs[key] = core.getInput(key) || inputDefaults[key]
|
||||
}
|
||||
}
|
||||
common.inputs.selfHosted = inputs['self-hosted']
|
||||
|
||||
process.chdir(inputs['working-directory'])
|
||||
|
||||
@@ -68795,7 +69089,7 @@ async function setupRuby(options = {}) {
|
||||
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
||||
|
||||
let installer
|
||||
if (platform.startsWith('windows-') && engine === 'ruby') {
|
||||
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
|
||||
installer = __nccwpck_require__(3216)
|
||||
} else {
|
||||
installer = __nccwpck_require__(9974)
|
||||
@@ -68809,7 +69103,7 @@ async function setupRuby(options = {}) {
|
||||
|
||||
// JRuby can use compiled extension code, so make sure gcc exists.
|
||||
// As of Jan-2022, JRuby compiles against msvcrt.
|
||||
if (platform.startsWith('windows') && (engine === 'jruby') &&
|
||||
if (platform.startsWith('windows') && engine === 'jruby' &&
|
||||
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
|
||||
await (__nccwpck_require__(3216).installJRubyTools)()
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ const inputDefaults = {
|
||||
'bundler-cache': 'false',
|
||||
'working-directory': '.',
|
||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||
'self-hosted': 'false',
|
||||
}
|
||||
|
||||
// entry point when this action is run on its own
|
||||
@@ -39,6 +40,7 @@ export async function setupRuby(options = {}) {
|
||||
inputs[key] = core.getInput(key) || inputDefaults[key]
|
||||
}
|
||||
}
|
||||
common.inputs.selfHosted = inputs['self-hosted']
|
||||
|
||||
process.chdir(inputs['working-directory'])
|
||||
|
||||
@@ -46,7 +48,7 @@ export async function setupRuby(options = {}) {
|
||||
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
||||
|
||||
let installer
|
||||
if (platform.startsWith('windows-') && engine === 'ruby') {
|
||||
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
|
||||
installer = require('./windows')
|
||||
} else {
|
||||
installer = require('./ruby-builder')
|
||||
@@ -60,7 +62,7 @@ export async function setupRuby(options = {}) {
|
||||
|
||||
// JRuby can use compiled extension code, so make sure gcc exists.
|
||||
// As of Jan-2022, JRuby compiles against msvcrt.
|
||||
if (platform.startsWith('windows') && (engine === 'jruby') &&
|
||||
if (platform.startsWith('windows') && engine === 'jruby' &&
|
||||
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
|
||||
await require('./windows').installJRubyTools()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2",
|
||||
"linux-os-info": "^2.0.0",
|
||||
"macos-release": "^3.1.0",
|
||||
"semver": "^7.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"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.4.0.0", "9.4.1.0",
|
||||
"9.4.0.0", "9.4.1.0", "9.4.2.0",
|
||||
"head"
|
||||
],
|
||||
"truffleruby": [
|
||||
|
||||
+18
-16
@@ -1,6 +1,7 @@
|
||||
const os = require('os')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const io = require('@actions/io')
|
||||
const tc = require('@actions/tool-cache')
|
||||
@@ -13,21 +14,31 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
|
||||
const windows = common.windows
|
||||
|
||||
export function getAvailableVersions(platform, engine) {
|
||||
if (!common.supportedPlatforms.includes(platform)) {
|
||||
throw new Error(`Unsupported platform ${platform}`)
|
||||
}
|
||||
|
||||
return rubyBuilderVersions[engine]
|
||||
}
|
||||
|
||||
export async function install(platform, engine, version) {
|
||||
let rubyPrefix, inToolCache
|
||||
if (common.shouldUseToolCache(engine, version)) {
|
||||
inToolCache = tc.find('Ruby', version)
|
||||
inToolCache = common.toolCacheFind(engine, version)
|
||||
if (inToolCache) {
|
||||
rubyPrefix = inToolCache
|
||||
} else {
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
||||
const toolCacheRubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||
if (common.isSelfHostedRunner()) {
|
||||
const rubyBuildDefinition = engine === 'ruby' ? version : `${engine}-${version}`
|
||||
core.error(
|
||||
`The current runner (${common.getOSNameVersionArch()}) was detected as self-hosted because ${common.selfHostedRunnerReason()}.\n` +
|
||||
`In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build\n` +
|
||||
`You can take inspiration from this workflow for more details: https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml\n` +
|
||||
`$ ruby-build ${rubyBuildDefinition} ${toolCacheRubyPrefix}\n` +
|
||||
`Once that completes successfully, mark it as complete with:\n` +
|
||||
`$ touch ${common.toolCacheCompleteFile(toolCacheRubyPrefix)}\n` +
|
||||
`It is your responsibility to ensure installing Ruby like that is not done in parallel.\n`)
|
||||
process.exit(1)
|
||||
} else {
|
||||
rubyPrefix = toolCacheRubyPrefix
|
||||
}
|
||||
}
|
||||
} else if (windows) {
|
||||
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
||||
@@ -39,7 +50,7 @@ export async function install(platform, engine, version) {
|
||||
common.setupPath([path.join(rubyPrefix, 'bin')])
|
||||
|
||||
if (!inToolCache) {
|
||||
await preparePrefix(rubyPrefix)
|
||||
await io.mkdirP(rubyPrefix)
|
||||
if (engine === 'truffleruby+graalvm') {
|
||||
await installWithRubyBuild(engine, version, rubyPrefix)
|
||||
} else {
|
||||
@@ -50,15 +61,6 @@ export async function install(platform, engine, version) {
|
||||
return rubyPrefix
|
||||
}
|
||||
|
||||
async function preparePrefix(rubyPrefix) {
|
||||
const parentDir = path.dirname(rubyPrefix)
|
||||
|
||||
await io.rmRF(rubyPrefix)
|
||||
if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) {
|
||||
await io.mkdirP(parentDir)
|
||||
}
|
||||
}
|
||||
|
||||
async function installWithRubyBuild(engine, version, rubyPrefix) {
|
||||
const tmp = process.env['RUNNER_TEMP'] || os.tmpdir()
|
||||
const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')
|
||||
|
||||
+3
-9
@@ -27,13 +27,7 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
||||
const msys1 = `${drive}:\\DevKit64`
|
||||
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
||||
|
||||
const virtualEnv = common.getVirtualEnvironmentName()
|
||||
|
||||
export function getAvailableVersions(platform, engine) {
|
||||
if (!common.supportedPlatforms.includes(platform)) {
|
||||
throw new Error(`Unsupported platform ${platform}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby') {
|
||||
return Object.keys(rubyInstallerVersions)
|
||||
} else {
|
||||
@@ -46,7 +40,7 @@ export async function install(platform, engine, version) {
|
||||
|
||||
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
|
||||
// and MinGW build tools installed. The windows-2022 image has neither.
|
||||
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv)
|
||||
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(platform)
|
||||
|
||||
if (!url.endsWith('.7z')) {
|
||||
throw new Error(`URL should end in .7z: ${url}`)
|
||||
@@ -55,11 +49,11 @@ export async function install(platform, engine, version) {
|
||||
|
||||
let rubyPrefix, inToolCache
|
||||
if (common.shouldUseToolCache(engine, version)) {
|
||||
inToolCache = tc.find('Ruby', version)
|
||||
inToolCache = common.toolCacheFind(engine, version)
|
||||
if (inToolCache) {
|
||||
rubyPrefix = inToolCache
|
||||
} else {
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||
}
|
||||
} else {
|
||||
rubyPrefix = `${drive}:\\${base}`
|
||||
|
||||
@@ -283,6 +283,11 @@ ip-regex@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
|
||||
integrity sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==
|
||||
|
||||
linux-os-info@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/linux-os-info/-/linux-os-info-2.0.0.tgz#32a251077c13af1a69dbcb36a168901208e32776"
|
||||
integrity sha512-ZopyH4kT2Ehnmix8iUgS/41pfv7fSlUV1JukIn3DB3qD3byvhBNtgCbUApoAtiqcHRLKXCY3zakXlJgiExm2Qg==
|
||||
|
||||
lru-cache@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||
@@ -290,6 +295,11 @@ lru-cache@^6.0.0:
|
||||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
macos-release@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-3.1.0.tgz#6165bb0736ae567ed6649e36ce6a24d87cbb7aca"
|
||||
integrity sha512-/M/R0gCDgM+Cv1IuBG1XGdfTFnMEG6PZeT+KGWHO/OG+imqmaD9CH5vHBTycEM3+Kc4uG2Il+tFAuUWLqQOeUA==
|
||||
|
||||
mime-db@1.52.0:
|
||||
version "1.52.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||
|
||||
Reference in New Issue
Block a user