mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a73aa9f67 | ||
|
|
d01c52ad8b | ||
|
|
377a94bc68 | ||
|
|
66dc012cc3 | ||
|
|
2789f85824 | ||
|
|
fbb865d04d | ||
|
|
96ac949ea0 | ||
|
|
92aece5fc9 | ||
|
|
db791aad7b |
@@ -3,7 +3,12 @@ description: Create a report to help us improve
|
|||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
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
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Ensure the following before filing this issue
|
label: Ensure the following before filing this issue
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
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-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019, windows-2022 ]
|
||||||
ruby: [
|
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,
|
'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,
|
jruby, jruby-head,
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ The action works on these [GitHub-hosted runners](https://docs.github.com/en/act
|
|||||||
|
|
||||||
| Operating System | Supported |
|
| Operating System | Supported |
|
||||||
| ---------------- | --------- |
|
| ---------------- | --------- |
|
||||||
| Ubuntu | `ubuntu-18.04`, `ubuntu-20.04`, `ubuntu-22.04` |
|
| Ubuntu | `ubuntu-20.04`, `ubuntu-22.04` |
|
||||||
| macOS | `macos-10.15`, `macos-11`, `macos-12` |
|
| macOS | `macos-11`, `macos-12` |
|
||||||
| Windows | `windows-2019`, `windows-2022` |
|
| 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)
|
||||||
@@ -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:
|
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.
|
|
||||||
* Make sure to use the same version of libssl.
|
* 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
|
* 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,
|
* 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.
|
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.
|
* `/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.
|
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).
|
||||||
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)).
|
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
|
## History
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ inputs:
|
|||||||
description: |
|
description: |
|
||||||
Arbitrary string that will be added to the cache key of the bundler cache. Set or change it if you need
|
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.
|
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:
|
outputs:
|
||||||
ruby-prefix:
|
ruby-prefix:
|
||||||
description: 'The prefix of the installed ruby'
|
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 cwd = process.cwd()
|
||||||
const bundleWith = process.env['BUNDLE_WITH'] || ''
|
const bundleWith = process.env['BUNDLE_WITH'] || ''
|
||||||
const bundleWithout = process.env['BUNDLE_WITHOUT'] || ''
|
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) {
|
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
|
||||||
key += `-v-${cacheVersion}`
|
key += `-v-${cacheVersion}`
|
||||||
|
|||||||
@@ -6,11 +6,17 @@ const stream = require('stream')
|
|||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const { performance } = require('perf_hooks')
|
const { performance } = require('perf_hooks')
|
||||||
|
const linuxOSInfo = require('linux-os-info')
|
||||||
|
import macosRelease from 'macos-release'
|
||||||
|
|
||||||
export const windows = (os.platform() === 'win32')
|
export const windows = (os.platform() === 'win32')
|
||||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
// 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 drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||||
|
|
||||||
|
export const inputs = {
|
||||||
|
selfHosted: undefined
|
||||||
|
}
|
||||||
|
|
||||||
export function partition(string, separator) {
|
export function partition(string, separator) {
|
||||||
const i = string.indexOf(separator)
|
const i = string.indexOf(separator)
|
||||||
if (i === -1) {
|
if (i === -1) {
|
||||||
@@ -151,75 +157,126 @@ export async function hashFile(file) {
|
|||||||
return hash.digest('hex')
|
return hash.digest('hex')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageOS() {
|
const GitHubHostedPlatforms = [
|
||||||
const imageOS = process.env['ImageOS']
|
'ubuntu-20.04-x64',
|
||||||
if (!imageOS) {
|
'ubuntu-22.04-x64',
|
||||||
throw new Error('The environment variable ImageOS must be set')
|
'macos-11-x64',
|
||||||
}
|
'macos-12-x64',
|
||||||
return imageOS
|
'windows-2019-x64',
|
||||||
}
|
'windows-2022-x64',
|
||||||
|
|
||||||
export const supportedPlatforms = [
|
|
||||||
'ubuntu-18.04',
|
|
||||||
'ubuntu-20.04',
|
|
||||||
'ubuntu-22.04',
|
|
||||||
'macos-10.15',
|
|
||||||
'macos-11',
|
|
||||||
'macos-12',
|
|
||||||
'windows-2019',
|
|
||||||
'windows-2022',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Actually a self-hosted runner for which either
|
||||||
|
// * the OS and OS version does not correspond to a GitHub-hosted runner image,
|
||||||
|
// * or the hosted tool cache is different from the default tool cache path
|
||||||
|
export function isSelfHostedRunner() {
|
||||||
|
if (inputs.selfHosted === undefined) {
|
||||||
|
throw new Error('inputs.selfHosted should have been already set')
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputs.selfHosted === 'true' ||
|
||||||
|
!GitHubHostedPlatforms.includes(getOSNameVersionArch()) ||
|
||||||
|
getRunnerToolCache() !== getDefaultToolCachePath()
|
||||||
|
}
|
||||||
|
|
||||||
|
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 if (getRunnerToolCache() !== getDefaultToolCachePath()) {
|
||||||
|
return 'the $RUNNER_TOOL_CACHE is different than the default tool cache path (they must be the same to reuse prebuilt Ruby binaries)'
|
||||||
|
} else {
|
||||||
|
return 'unknown reason'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let virtualEnvironmentName = undefined
|
||||||
|
|
||||||
export function getVirtualEnvironmentName() {
|
export function getVirtualEnvironmentName() {
|
||||||
const imageOS = getImageOS()
|
if (virtualEnvironmentName !== undefined) {
|
||||||
|
return virtualEnvironmentName
|
||||||
let match = imageOS.match(/^ubuntu(\d+)/) // e.g. ubuntu18
|
|
||||||
if (match) {
|
|
||||||
return `ubuntu-${match[1]}.04`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match = imageOS.match(/^macos(\d{2})(\d+)?/) // e.g. macos1015, macos11
|
const platform = os.platform()
|
||||||
if (match) {
|
let osName
|
||||||
if (match[2]) {
|
let osVersion
|
||||||
return `macos-${match[1]}.${match[2]}`
|
if (platform === 'linux') {
|
||||||
} else {
|
const info = linuxOSInfo({mode: 'sync'})
|
||||||
return `macos-${match[1]}`
|
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
|
virtualEnvironmentName = `${osName}-${osVersion}`
|
||||||
if (match) {
|
return virtualEnvironmentName
|
||||||
return `windows-20${match[1]}`
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
export function shouldUseToolCache(engine, version) {
|
||||||
return engine === 'ruby' && !isHeadVersion(version)
|
return (engine === 'ruby' && !isHeadVersion(version)) || isSelfHostedRunner()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlatformToolCache(platform) {
|
export function getRunnerToolCache() {
|
||||||
// Hardcode paths rather than using $RUNNER_TOOL_CACHE because the prebuilt Rubies cannot be moved anyway
|
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,
|
||||||
|
// so they can only be used if the two paths are the same
|
||||||
|
function getDefaultToolCachePath() {
|
||||||
|
const platform = getVirtualEnvironmentName()
|
||||||
if (platform.startsWith('ubuntu-')) {
|
if (platform.startsWith('ubuntu-')) {
|
||||||
return '/opt/hostedtoolcache'
|
return '/opt/hostedtoolcache'
|
||||||
} else if (platform.startsWith('macos-')) {
|
} else if (platform.startsWith('macos-')) {
|
||||||
return '/Users/runner/hostedtoolcache'
|
return '/Users/runner/hostedtoolcache'
|
||||||
} else if (platform.startsWith('windows-')) {
|
} else if (platform.startsWith('windows-')) {
|
||||||
return 'C:/hostedtoolcache/windows'
|
return 'C:\\hostedtoolcache\\windows'
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown platform')
|
throw new Error('Unknown platform')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getToolCacheRubyPrefix(platform, version) {
|
export function getToolCacheRubyPrefix(platform, engine, version) {
|
||||||
const toolCache = getPlatformToolCache(platform)
|
const toolCache = getRunnerToolCache()
|
||||||
return path.join(toolCache, 'Ruby', version, 'x64')
|
const name = {
|
||||||
|
ruby: 'Ruby',
|
||||||
|
jruby: 'JRuby',
|
||||||
|
truffleruby: 'TruffleRuby',
|
||||||
|
"truffleruby+graalvm": 'TruffleRubyGraalVM'
|
||||||
|
}[engine]
|
||||||
|
return path.join(toolCache, name, version, os.arch())
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||||
|
return `${toolCacheRubyPrefix}.complete`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||||
const completeFile = `${toolCacheRubyPrefix}.complete`
|
fs.writeFileSync(toolCacheCompleteFile(toolCacheRubyPrefix), '')
|
||||||
fs.writeFileSync(completeFile, '')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||||
|
|||||||
+371
-89
@@ -17,7 +17,7 @@ const path = __nccwpck_require__(1017)
|
|||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const exec = __nccwpck_require__(1514)
|
const exec = __nccwpck_require__(1514)
|
||||||
const cache = __nccwpck_require__(7799)
|
const cache = __nccwpck_require__(7799)
|
||||||
const common = __nccwpck_require__(4717)
|
const common = __nccwpck_require__(3143)
|
||||||
|
|
||||||
const DEFAULT_CACHE_VERSION = '0'
|
const DEFAULT_CACHE_VERSION = '0'
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
|||||||
const cwd = process.cwd()
|
const cwd = process.cwd()
|
||||||
const bundleWith = process.env['BUNDLE_WITH'] || ''
|
const bundleWith = process.env['BUNDLE_WITH'] || ''
|
||||||
const bundleWithout = process.env['BUNDLE_WITHOUT'] || ''
|
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) {
|
if (cacheVersion !== DEFAULT_CACHE_VERSION) {
|
||||||
key += `-v-${cacheVersion}`
|
key += `-v-${cacheVersion}`
|
||||||
@@ -278,47 +278,100 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 4717:
|
/***/ 3143:
|
||||||
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
// ESM COMPAT FLAG
|
||||||
__nccwpck_require__.r(__webpack_exports__);
|
__nccwpck_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ "windows": () => (/* binding */ windows),
|
// EXPORTS
|
||||||
/* harmony export */ "drive": () => (/* binding */ drive),
|
__nccwpck_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "partition": () => (/* binding */ partition),
|
"createToolCacheCompleteFile": () => (/* binding */ createToolCacheCompleteFile),
|
||||||
/* harmony export */ "measure": () => (/* binding */ measure),
|
"drive": () => (/* binding */ drive),
|
||||||
/* harmony export */ "time": () => (/* binding */ time),
|
"floatVersion": () => (/* binding */ floatVersion),
|
||||||
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
"getOSNameVersionArch": () => (/* binding */ getOSNameVersionArch),
|
||||||
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
"getRunnerToolCache": () => (/* binding */ getRunnerToolCache),
|
||||||
/* harmony export */ "hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
"getToolCacheRubyPrefix": () => (/* binding */ getToolCacheRubyPrefix),
|
||||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
"getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName),
|
||||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
"hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||||
/* harmony export */ "isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
"hashFile": () => (/* binding */ hashFile),
|
||||||
/* harmony export */ "targetRubyVersion": () => (/* binding */ targetRubyVersion),
|
"inputs": () => (/* binding */ inputs),
|
||||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
"isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||||
/* harmony export */ "hashFile": () => (/* binding */ hashFile),
|
"isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||||
/* harmony export */ "supportedPlatforms": () => (/* binding */ supportedPlatforms),
|
"isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
||||||
/* harmony export */ "getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName),
|
"isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||||
/* harmony export */ "shouldUseToolCache": () => (/* binding */ shouldUseToolCache),
|
"isSelfHostedRunner": () => (/* binding */ isSelfHostedRunner),
|
||||||
/* harmony export */ "getToolCacheRubyPrefix": () => (/* binding */ getToolCacheRubyPrefix),
|
"isStableVersion": () => (/* binding */ isStableVersion),
|
||||||
/* harmony export */ "createToolCacheCompleteFile": () => (/* binding */ createToolCacheCompleteFile),
|
"measure": () => (/* binding */ measure),
|
||||||
/* harmony export */ "win2nix": () => (/* binding */ win2nix),
|
"partition": () => (/* binding */ partition),
|
||||||
/* harmony export */ "setupPath": () => (/* binding */ setupPath)
|
"selfHostedRunnerReason": () => (/* binding */ selfHostedRunnerReason),
|
||||||
/* harmony export */ });
|
"setupPath": () => (/* binding */ setupPath),
|
||||||
|
"shouldUseToolCache": () => (/* binding */ shouldUseToolCache),
|
||||||
|
"targetRubyVersion": () => (/* binding */ targetRubyVersion),
|
||||||
|
"time": () => (/* binding */ time),
|
||||||
|
"toolCacheCompleteFile": () => (/* binding */ toolCacheCompleteFile),
|
||||||
|
"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 os = __nccwpck_require__(2037)
|
||||||
const path = __nccwpck_require__(1017)
|
const path = __nccwpck_require__(1017)
|
||||||
const fs = __nccwpck_require__(7147)
|
const fs = __nccwpck_require__(7147)
|
||||||
const util = __nccwpck_require__(3837)
|
const util = __nccwpck_require__(3837)
|
||||||
const stream = __nccwpck_require__(2781)
|
const stream = __nccwpck_require__(2781)
|
||||||
const crypto = __nccwpck_require__(6113)
|
const common_crypto = __nccwpck_require__(6113)
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const { performance } = __nccwpck_require__(4074)
|
const { performance } = __nccwpck_require__(4074)
|
||||||
|
const linuxOSInfo = __nccwpck_require__(8487)
|
||||||
|
;
|
||||||
|
|
||||||
const windows = (os.platform() === 'win32')
|
const windows = (os.platform() === 'win32')
|
||||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
// 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 drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||||
|
|
||||||
|
const inputs = {
|
||||||
|
selfHosted: undefined
|
||||||
|
}
|
||||||
|
|
||||||
function partition(string, separator) {
|
function partition(string, separator) {
|
||||||
const i = string.indexOf(separator)
|
const i = string.indexOf(separator)
|
||||||
if (i === -1) {
|
if (i === -1) {
|
||||||
@@ -453,81 +506,132 @@ function floatVersion(rubyVersion) {
|
|||||||
|
|
||||||
async function hashFile(file) {
|
async function hashFile(file) {
|
||||||
// See https://github.com/actions/runner/blob/master/src/Misc/expressionFunc/hashFiles/src/hashFiles.ts
|
// 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)
|
const pipeline = util.promisify(stream.pipeline)
|
||||||
await pipeline(fs.createReadStream(file), hash)
|
await pipeline(fs.createReadStream(file), hash)
|
||||||
return hash.digest('hex')
|
return hash.digest('hex')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageOS() {
|
const GitHubHostedPlatforms = [
|
||||||
const imageOS = process.env['ImageOS']
|
'ubuntu-20.04-x64',
|
||||||
if (!imageOS) {
|
'ubuntu-22.04-x64',
|
||||||
throw new Error('The environment variable ImageOS must be set')
|
'macos-11-x64',
|
||||||
}
|
'macos-12-x64',
|
||||||
return imageOS
|
'windows-2019-x64',
|
||||||
}
|
'windows-2022-x64',
|
||||||
|
|
||||||
const supportedPlatforms = [
|
|
||||||
'ubuntu-18.04',
|
|
||||||
'ubuntu-20.04',
|
|
||||||
'ubuntu-22.04',
|
|
||||||
'macos-10.15',
|
|
||||||
'macos-11',
|
|
||||||
'macos-12',
|
|
||||||
'windows-2019',
|
|
||||||
'windows-2022',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Actually a self-hosted runner for which either
|
||||||
|
// * the OS and OS version does not correspond to a GitHub-hosted runner image,
|
||||||
|
// * or the hosted tool cache is different from the default tool cache path
|
||||||
|
function isSelfHostedRunner() {
|
||||||
|
if (inputs.selfHosted === undefined) {
|
||||||
|
throw new Error('inputs.selfHosted should have been already set')
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputs.selfHosted === 'true' ||
|
||||||
|
!GitHubHostedPlatforms.includes(getOSNameVersionArch()) ||
|
||||||
|
getRunnerToolCache() !== getDefaultToolCachePath()
|
||||||
|
}
|
||||||
|
|
||||||
|
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 if (getRunnerToolCache() !== getDefaultToolCachePath()) {
|
||||||
|
return 'the $RUNNER_TOOL_CACHE is different than the default tool cache path (they must be the same to reuse prebuilt Ruby binaries)'
|
||||||
|
} else {
|
||||||
|
return 'unknown reason'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let virtualEnvironmentName = undefined
|
||||||
|
|
||||||
function getVirtualEnvironmentName() {
|
function getVirtualEnvironmentName() {
|
||||||
const imageOS = getImageOS()
|
if (virtualEnvironmentName !== undefined) {
|
||||||
|
return virtualEnvironmentName
|
||||||
let match = imageOS.match(/^ubuntu(\d+)/) // e.g. ubuntu18
|
|
||||||
if (match) {
|
|
||||||
return `ubuntu-${match[1]}.04`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match = imageOS.match(/^macos(\d{2})(\d+)?/) // e.g. macos1015, macos11
|
const platform = os.platform()
|
||||||
if (match) {
|
let osName
|
||||||
if (match[2]) {
|
let osVersion
|
||||||
return `macos-${match[1]}.${match[2]}`
|
if (platform === 'linux') {
|
||||||
} else {
|
const info = linuxOSInfo({mode: 'sync'})
|
||||||
return `macos-${match[1]}`
|
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
|
virtualEnvironmentName = `${osName}-${osVersion}`
|
||||||
if (match) {
|
return virtualEnvironmentName
|
||||||
return `windows-20${match[1]}`
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
function shouldUseToolCache(engine, version) {
|
||||||
return engine === 'ruby' && !isHeadVersion(version)
|
return (engine === 'ruby' && !isHeadVersion(version)) || isSelfHostedRunner()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlatformToolCache(platform) {
|
function getRunnerToolCache() {
|
||||||
// Hardcode paths rather than using $RUNNER_TOOL_CACHE because the prebuilt Rubies cannot be moved anyway
|
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,
|
||||||
|
// so they can only be used if the two paths are the same
|
||||||
|
function getDefaultToolCachePath() {
|
||||||
|
const platform = getVirtualEnvironmentName()
|
||||||
if (platform.startsWith('ubuntu-')) {
|
if (platform.startsWith('ubuntu-')) {
|
||||||
return '/opt/hostedtoolcache'
|
return '/opt/hostedtoolcache'
|
||||||
} else if (platform.startsWith('macos-')) {
|
} else if (platform.startsWith('macos-')) {
|
||||||
return '/Users/runner/hostedtoolcache'
|
return '/Users/runner/hostedtoolcache'
|
||||||
} else if (platform.startsWith('windows-')) {
|
} else if (platform.startsWith('windows-')) {
|
||||||
return 'C:/hostedtoolcache/windows'
|
return 'C:\\hostedtoolcache\\windows'
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown platform')
|
throw new Error('Unknown platform')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getToolCacheRubyPrefix(platform, version) {
|
function getToolCacheRubyPrefix(platform, engine, version) {
|
||||||
const toolCache = getPlatformToolCache(platform)
|
const toolCache = getRunnerToolCache()
|
||||||
return path.join(toolCache, 'Ruby', version, 'x64')
|
const name = {
|
||||||
|
ruby: 'Ruby',
|
||||||
|
jruby: 'JRuby',
|
||||||
|
truffleruby: 'TruffleRuby',
|
||||||
|
"truffleruby+graalvm": 'TruffleRubyGraalVM'
|
||||||
|
}[engine]
|
||||||
|
return path.join(toolCache, name, version, os.arch())
|
||||||
|
}
|
||||||
|
|
||||||
|
function toolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||||
|
return `${toolCacheRubyPrefix}.complete`
|
||||||
}
|
}
|
||||||
|
|
||||||
function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
function createToolCacheCompleteFile(toolCacheRubyPrefix) {
|
||||||
const completeFile = `${toolCacheRubyPrefix}.complete`
|
fs.writeFileSync(toolCacheCompleteFile(toolCacheRubyPrefix), '')
|
||||||
fs.writeFileSync(completeFile, '')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||||
@@ -50428,6 +50532,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:
|
/***/ 7129:
|
||||||
@@ -67981,10 +68256,11 @@ __nccwpck_require__.r(__webpack_exports__);
|
|||||||
const os = __nccwpck_require__(2037)
|
const os = __nccwpck_require__(2037)
|
||||||
const fs = __nccwpck_require__(7147)
|
const fs = __nccwpck_require__(7147)
|
||||||
const path = __nccwpck_require__(1017)
|
const path = __nccwpck_require__(1017)
|
||||||
|
const core = __nccwpck_require__(2186)
|
||||||
const exec = __nccwpck_require__(1514)
|
const exec = __nccwpck_require__(1514)
|
||||||
const io = __nccwpck_require__(7436)
|
const io = __nccwpck_require__(7436)
|
||||||
const tc = __nccwpck_require__(7784)
|
const tc = __nccwpck_require__(7784)
|
||||||
const common = __nccwpck_require__(4717)
|
const common = __nccwpck_require__(3143)
|
||||||
const rubyBuilderVersions = __nccwpck_require__(5959)
|
const rubyBuilderVersions = __nccwpck_require__(5959)
|
||||||
|
|
||||||
const builderReleaseTag = 'toolcache'
|
const builderReleaseTag = 'toolcache'
|
||||||
@@ -67993,10 +68269,6 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
|
|||||||
const windows = common.windows
|
const windows = common.windows
|
||||||
|
|
||||||
function getAvailableVersions(platform, engine) {
|
function getAvailableVersions(platform, engine) {
|
||||||
if (!common.supportedPlatforms.includes(platform)) {
|
|
||||||
throw new Error(`Unsupported platform ${platform}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
return rubyBuilderVersions[engine]
|
return rubyBuilderVersions[engine]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68007,7 +68279,21 @@ async function install(platform, engine, version) {
|
|||||||
if (inToolCache) {
|
if (inToolCache) {
|
||||||
rubyPrefix = inToolCache
|
rubyPrefix = inToolCache
|
||||||
} else {
|
} 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()}, RUNNER_TOOL_CACHE=${common.getRunnerToolCache()}) 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) {
|
} else if (windows) {
|
||||||
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
||||||
@@ -68164,7 +68450,7 @@ const core = __nccwpck_require__(2186)
|
|||||||
const exec = __nccwpck_require__(1514)
|
const exec = __nccwpck_require__(1514)
|
||||||
const io = __nccwpck_require__(7436)
|
const io = __nccwpck_require__(7436)
|
||||||
const tc = __nccwpck_require__(7784)
|
const tc = __nccwpck_require__(7784)
|
||||||
const common = __nccwpck_require__(4717)
|
const common = __nccwpck_require__(3143)
|
||||||
const rubyInstallerVersions = __nccwpck_require__(6459)
|
const rubyInstallerVersions = __nccwpck_require__(6459)
|
||||||
|
|
||||||
const drive = common.drive
|
const drive = common.drive
|
||||||
@@ -68181,13 +68467,7 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
|||||||
const msys1 = `${drive}:\\DevKit64`
|
const msys1 = `${drive}:\\DevKit64`
|
||||||
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
||||||
|
|
||||||
const virtualEnv = common.getVirtualEnvironmentName()
|
|
||||||
|
|
||||||
function getAvailableVersions(platform, engine) {
|
function getAvailableVersions(platform, engine) {
|
||||||
if (!common.supportedPlatforms.includes(platform)) {
|
|
||||||
throw new Error(`Unsupported platform ${platform}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engine === 'ruby') {
|
if (engine === 'ruby') {
|
||||||
return Object.keys(rubyInstallerVersions)
|
return Object.keys(rubyInstallerVersions)
|
||||||
} else {
|
} else {
|
||||||
@@ -68200,7 +68480,7 @@ async function install(platform, engine, version) {
|
|||||||
|
|
||||||
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
|
// 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.
|
// 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')) {
|
if (!url.endsWith('.7z')) {
|
||||||
throw new Error(`URL should end in .7z: ${url}`)
|
throw new Error(`URL should end in .7z: ${url}`)
|
||||||
@@ -68213,7 +68493,7 @@ async function install(platform, engine, version) {
|
|||||||
if (inToolCache) {
|
if (inToolCache) {
|
||||||
rubyPrefix = inToolCache
|
rubyPrefix = inToolCache
|
||||||
} else {
|
} else {
|
||||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
rubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rubyPrefix = `${drive}:\\${base}`
|
rubyPrefix = `${drive}:\\${base}`
|
||||||
@@ -68752,7 +69032,7 @@ const fs = __nccwpck_require__(7147)
|
|||||||
const path = __nccwpck_require__(1017)
|
const path = __nccwpck_require__(1017)
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const exec = __nccwpck_require__(1514)
|
const exec = __nccwpck_require__(1514)
|
||||||
const common = __nccwpck_require__(4717)
|
const common = __nccwpck_require__(3143)
|
||||||
const rubygems = __nccwpck_require__(160)
|
const rubygems = __nccwpck_require__(160)
|
||||||
const bundler = __nccwpck_require__(1641)
|
const bundler = __nccwpck_require__(1641)
|
||||||
|
|
||||||
@@ -68765,6 +69045,7 @@ const inputDefaults = {
|
|||||||
'bundler-cache': 'false',
|
'bundler-cache': 'false',
|
||||||
'working-directory': '.',
|
'working-directory': '.',
|
||||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||||
|
'self-hosted': 'false',
|
||||||
}
|
}
|
||||||
|
|
||||||
// entry point when this action is run on its own
|
// entry point when this action is run on its own
|
||||||
@@ -68788,6 +69069,7 @@ async function setupRuby(options = {}) {
|
|||||||
inputs[key] = core.getInput(key) || inputDefaults[key]
|
inputs[key] = core.getInput(key) || inputDefaults[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
common.inputs.selfHosted = inputs['self-hosted']
|
||||||
|
|
||||||
process.chdir(inputs['working-directory'])
|
process.chdir(inputs['working-directory'])
|
||||||
|
|
||||||
@@ -68795,7 +69077,7 @@ async function setupRuby(options = {}) {
|
|||||||
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
||||||
|
|
||||||
let installer
|
let installer
|
||||||
if (platform.startsWith('windows-') && engine === 'ruby') {
|
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
|
||||||
installer = __nccwpck_require__(3216)
|
installer = __nccwpck_require__(3216)
|
||||||
} else {
|
} else {
|
||||||
installer = __nccwpck_require__(9974)
|
installer = __nccwpck_require__(9974)
|
||||||
@@ -68809,7 +69091,7 @@ async function setupRuby(options = {}) {
|
|||||||
|
|
||||||
// JRuby can use compiled extension code, so make sure gcc exists.
|
// JRuby can use compiled extension code, so make sure gcc exists.
|
||||||
// As of Jan-2022, JRuby compiles against msvcrt.
|
// 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')) {
|
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
|
||||||
await (__nccwpck_require__(3216).installJRubyTools)()
|
await (__nccwpck_require__(3216).installJRubyTools)()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const inputDefaults = {
|
|||||||
'bundler-cache': 'false',
|
'bundler-cache': 'false',
|
||||||
'working-directory': '.',
|
'working-directory': '.',
|
||||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||||
|
'self-hosted': 'false',
|
||||||
}
|
}
|
||||||
|
|
||||||
// entry point when this action is run on its own
|
// 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]
|
inputs[key] = core.getInput(key) || inputDefaults[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
common.inputs.selfHosted = inputs['self-hosted']
|
||||||
|
|
||||||
process.chdir(inputs['working-directory'])
|
process.chdir(inputs['working-directory'])
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ export async function setupRuby(options = {}) {
|
|||||||
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
|
||||||
|
|
||||||
let installer
|
let installer
|
||||||
if (platform.startsWith('windows-') && engine === 'ruby') {
|
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
|
||||||
installer = require('./windows')
|
installer = require('./windows')
|
||||||
} else {
|
} else {
|
||||||
installer = require('./ruby-builder')
|
installer = require('./ruby-builder')
|
||||||
@@ -60,7 +62,7 @@ export async function setupRuby(options = {}) {
|
|||||||
|
|
||||||
// JRuby can use compiled extension code, so make sure gcc exists.
|
// JRuby can use compiled extension code, so make sure gcc exists.
|
||||||
// As of Jan-2022, JRuby compiles against msvcrt.
|
// 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')) {
|
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
|
||||||
await require('./windows').installJRubyTools()
|
await require('./windows').installJRubyTools()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2",
|
"@actions/io": "^1.1.2",
|
||||||
"@actions/tool-cache": "^2",
|
"@actions/tool-cache": "^2",
|
||||||
|
"linux-os-info": "^2.0.0",
|
||||||
|
"macos-release": "^3.1.0",
|
||||||
"semver": "^7.3.7"
|
"semver": "^7.3.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+16
-5
@@ -1,6 +1,7 @@
|
|||||||
const os = require('os')
|
const os = require('os')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const core = require('@actions/core')
|
||||||
const exec = require('@actions/exec')
|
const exec = require('@actions/exec')
|
||||||
const io = require('@actions/io')
|
const io = require('@actions/io')
|
||||||
const tc = require('@actions/tool-cache')
|
const tc = require('@actions/tool-cache')
|
||||||
@@ -13,10 +14,6 @@ const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
|
|||||||
const windows = common.windows
|
const windows = common.windows
|
||||||
|
|
||||||
export function getAvailableVersions(platform, engine) {
|
export function getAvailableVersions(platform, engine) {
|
||||||
if (!common.supportedPlatforms.includes(platform)) {
|
|
||||||
throw new Error(`Unsupported platform ${platform}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
return rubyBuilderVersions[engine]
|
return rubyBuilderVersions[engine]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +24,21 @@ export async function install(platform, engine, version) {
|
|||||||
if (inToolCache) {
|
if (inToolCache) {
|
||||||
rubyPrefix = inToolCache
|
rubyPrefix = inToolCache
|
||||||
} else {
|
} 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()}, RUNNER_TOOL_CACHE=${common.getRunnerToolCache()}) 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) {
|
} else if (windows) {
|
||||||
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
rubyPrefix = path.join(`${common.drive}:`, `${engine}-${version}`)
|
||||||
|
|||||||
+2
-8
@@ -27,13 +27,7 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
|||||||
const msys1 = `${drive}:\\DevKit64`
|
const msys1 = `${drive}:\\DevKit64`
|
||||||
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
|
||||||
|
|
||||||
const virtualEnv = common.getVirtualEnvironmentName()
|
|
||||||
|
|
||||||
export function getAvailableVersions(platform, engine) {
|
export function getAvailableVersions(platform, engine) {
|
||||||
if (!common.supportedPlatforms.includes(platform)) {
|
|
||||||
throw new Error(`Unsupported platform ${platform}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engine === 'ruby') {
|
if (engine === 'ruby') {
|
||||||
return Object.keys(rubyInstallerVersions)
|
return Object.keys(rubyInstallerVersions)
|
||||||
} else {
|
} 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)
|
// 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.
|
// 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')) {
|
if (!url.endsWith('.7z')) {
|
||||||
throw new Error(`URL should end in .7z: ${url}`)
|
throw new Error(`URL should end in .7z: ${url}`)
|
||||||
@@ -59,7 +53,7 @@ export async function install(platform, engine, version) {
|
|||||||
if (inToolCache) {
|
if (inToolCache) {
|
||||||
rubyPrefix = inToolCache
|
rubyPrefix = inToolCache
|
||||||
} else {
|
} else {
|
||||||
rubyPrefix = common.getToolCacheRubyPrefix(platform, version)
|
rubyPrefix = common.getToolCacheRubyPrefix(platform, engine, version)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rubyPrefix = `${drive}:\\${base}`
|
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"
|
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
|
||||||
integrity sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==
|
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:
|
lru-cache@^6.0.0:
|
||||||
version "6.0.0"
|
version "6.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||||
@@ -290,6 +295,11 @@ lru-cache@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist "^4.0.0"
|
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:
|
mime-db@1.52.0:
|
||||||
version "1.52.0"
|
version "1.52.0"
|
||||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||||
|
|||||||
Reference in New Issue
Block a user