mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5f787ce33 | ||
|
|
1010da45f3 | ||
|
|
7f50f6e3b3 | ||
|
|
be19563477 | ||
|
|
b90be12699 |
@@ -32,7 +32,7 @@ jobs:
|
||||
- { os: windows-2025, ruby: mswin }
|
||||
- { os: windows-2025, ruby: ucrt }
|
||||
- { os: ubuntu-24.04, ruby: asan }
|
||||
- { os: ubuntu-24.04, ruby: 3.4-asan }
|
||||
- { os: ubuntu-24.04, ruby: asan-release }
|
||||
exclude:
|
||||
# https://github.com/ruby/setup-ruby/issues/496
|
||||
- { os: ubuntu-22.04, ruby: '2.2' }
|
||||
@@ -79,10 +79,6 @@ jobs:
|
||||
- { os: windows-2022, ruby: '1.9' }
|
||||
- { os: windows-2025, ruby: '1.9' }
|
||||
- { os: windows-11-arm, ruby: '1.9' }
|
||||
# No preview builds on Windows
|
||||
- { os: windows-2022, ruby: '4.0' }
|
||||
- { os: windows-2025, ruby: '4.0' }
|
||||
- { os: windows-11-arm, ruby: '4.0' }
|
||||
# TruffleRuby does not support Windows
|
||||
- { os: windows-2022, ruby: truffleruby }
|
||||
- { os: windows-2025, ruby: truffleruby }
|
||||
|
||||
@@ -26,7 +26,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
||||
Native extensions are automatically compiled with AddressSanitizer when using `ruby-asan`.
|
||||
`ruby-asan` is currently only available on `ubuntu-24.04`.
|
||||
|
||||
`ruby-3.4-asan` is similar to `ruby-asan` but built from the latest stable 3.4 release tag.
|
||||
`asan-release` is similar to `ruby-asan` but built from the latest stable release tag.
|
||||
Like `ruby-asan`, it's currently only available on `ubuntu-24.04`.
|
||||
|
||||
Regarding Windows ruby master builds, `mingw` is a MSYS2/MinGW build, `head` & `ucrt` are MSYS2/UCRT64
|
||||
@@ -230,6 +230,22 @@ It is also possible to cache gems manually, but this is not recommended because
|
||||
There are many concerns which means using `actions/cache` is never enough for caching gems (e.g., incomplete cache key, cleaning old gems when restoring from another key, correctly hashing the lockfile if not checked in, OS versions, ABI compatibility for `ruby-head`, etc).
|
||||
So, please use `bundler-cache: true` instead and report any issue.
|
||||
|
||||
### Authentication Token
|
||||
|
||||
By default, this action uses `${{ github.token }}` to authenticate when downloading Ruby release assets from GitHub.
|
||||
This helps avoid rate limiting issues.
|
||||
|
||||
If you're running this action on a GitHub Enterprise Server (GHES) instance, or if you're experiencing rate limiting,
|
||||
you can provide a custom token:
|
||||
|
||||
```yaml
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
token: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
In most cases, you don't need to set this input as the default value is sufficient for use on github.com.
|
||||
|
||||
## Windows
|
||||
|
||||
Note that running CI on Windows can be quite challenging if you are not very familiar with Windows.
|
||||
|
||||
@@ -44,6 +44,12 @@ inputs:
|
||||
It also sets environment variables using 'ridk' or 'vcvars64.bat' based on the selected Ruby.
|
||||
At present, the only other setting than 'default' is 'none', which only adds Ruby to PATH.
|
||||
No build tools or packages are installed, nor are any ENV setting changed to activate them.
|
||||
token:
|
||||
description: |
|
||||
Used to authenticate with GitHub when downloading Ruby release assets.
|
||||
When running this action on github.com, the default value is sufficient.
|
||||
When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
||||
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||
|
||||
outputs:
|
||||
ruby-prefix:
|
||||
|
||||
@@ -16,7 +16,8 @@ export const drive = (windows ? (process.env['RUNNER_TEMP'] || 'C')[0] : undefin
|
||||
const PATH_ENV_VAR = windows ? 'Path' : 'PATH'
|
||||
|
||||
export const inputs = {
|
||||
selfHosted: undefined
|
||||
selfHosted: undefined,
|
||||
token: undefined
|
||||
}
|
||||
|
||||
export function partition(string, separator) {
|
||||
@@ -68,8 +69,8 @@ export async function time(name, block) {
|
||||
}
|
||||
|
||||
export function isHeadVersion(rubyVersion) {
|
||||
// 3.4-asan counts as "head" because the version cannot be selected -- you can only get whatever's latest
|
||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', '3.4-asan'].includes(rubyVersion)
|
||||
// asan-release counts as "head" because the version cannot be selected -- you can only get whatever's latest
|
||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', 'asan-release'].includes(rubyVersion)
|
||||
}
|
||||
|
||||
export function isStableVersion(engine, rubyVersion) {
|
||||
@@ -441,3 +442,8 @@ export function isExactCacheKeyMatch(key, cacheKey) {
|
||||
}) === 0
|
||||
);
|
||||
}
|
||||
|
||||
export async function download(url) {
|
||||
const auth = inputs.token ? `token ${inputs.token}` : undefined
|
||||
return await tc.downloadTool(url, undefined, auth)
|
||||
}
|
||||
|
||||
+18
-11
@@ -297,6 +297,7 @@ async function computeBaseKey(engine, version, lockFile, cacheVersion) {
|
||||
__nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ createToolCacheCompleteFile: () => (/* binding */ createToolCacheCompleteFile),
|
||||
/* harmony export */ download: () => (/* binding */ download),
|
||||
/* harmony export */ drive: () => (/* binding */ drive),
|
||||
/* harmony export */ floatVersion: () => (/* binding */ floatVersion),
|
||||
/* harmony export */ getOSName: () => (/* binding */ getOSName),
|
||||
@@ -348,7 +349,8 @@ const drive = (windows ? (process.env['RUNNER_TEMP'] || 'C')[0] : undefined)
|
||||
const PATH_ENV_VAR = windows ? 'Path' : 'PATH'
|
||||
|
||||
const inputs = {
|
||||
selfHosted: undefined
|
||||
selfHosted: undefined,
|
||||
token: undefined
|
||||
}
|
||||
|
||||
function partition(string, separator) {
|
||||
@@ -400,8 +402,8 @@ async function time(name, block) {
|
||||
}
|
||||
|
||||
function isHeadVersion(rubyVersion) {
|
||||
// 3.4-asan counts as "head" because the version cannot be selected -- you can only get whatever's latest
|
||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', '3.4-asan'].includes(rubyVersion)
|
||||
// asan-release counts as "head" because the version cannot be selected -- you can only get whatever's latest
|
||||
return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', 'asan-release'].includes(rubyVersion)
|
||||
}
|
||||
|
||||
function isStableVersion(engine, rubyVersion) {
|
||||
@@ -774,6 +776,11 @@ function isExactCacheKeyMatch(key, cacheKey) {
|
||||
);
|
||||
}
|
||||
|
||||
async function download(url) {
|
||||
const auth = inputs.token ? `token ${inputs.token}` : undefined
|
||||
return await tc.downloadTool(url, undefined, auth)
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -71303,7 +71310,6 @@ const path = __nccwpck_require__(6928)
|
||||
const core = __nccwpck_require__(7484)
|
||||
const exec = __nccwpck_require__(5236)
|
||||
const io = __nccwpck_require__(4994)
|
||||
const tc = __nccwpck_require__(3472)
|
||||
const common = __nccwpck_require__(7211)
|
||||
const rubyBuilderVersions = __nccwpck_require__(1942)
|
||||
|
||||
@@ -71374,7 +71380,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
||||
const url = getDownloadURL(platform, engine, version)
|
||||
console.log(url)
|
||||
try {
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
} catch (error) {
|
||||
if (error.message.includes('404')) {
|
||||
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
|
||||
@@ -71525,7 +71531,6 @@ const path = __nccwpck_require__(6928)
|
||||
const cp = __nccwpck_require__(5317)
|
||||
const core = __nccwpck_require__(7484)
|
||||
const exec = __nccwpck_require__(5236)
|
||||
const tc = __nccwpck_require__(3472)
|
||||
const common = __nccwpck_require__(7211)
|
||||
const rubyInstallerVersions = __nccwpck_require__(668)
|
||||
const toolchainVersions = __nccwpck_require__(4977)
|
||||
@@ -71599,7 +71604,7 @@ async function install(platform, engine, version) {
|
||||
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = process.env.RUNNER_TEMP
|
||||
@@ -71631,7 +71636,7 @@ async function installJRubyTools() {
|
||||
async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
|
||||
const downloadPath = await common.measure('Downloading msys2 build tools', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = path.join(process.env.RUNNER_TEMP, 'msys64')
|
||||
@@ -71678,7 +71683,7 @@ async function installMSYS1(url) {
|
||||
|
||||
const downloadPath = await common.measure('Downloading msys1 build tools', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const msys1Path = `${common.drive}:\\DevKit64`
|
||||
@@ -71714,7 +71719,7 @@ async function installMSYS1(url) {
|
||||
async function installVCPKG(url) {
|
||||
const downloadPath = await common.measure('Downloading mswin vcpkg packages', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = process.env.VCPKG_INSTALLATION_ROOT
|
||||
@@ -85185,7 +85190,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = /*#__PURE__*/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","2.7.8","3.0.0-preview1","3.0.0-preview2","3.0.0-rc1","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.0.7","3.1.0-preview1","3.1.0","3.1.1","3.1.2","3.1.3","3.1.4","3.1.5","3.1.6","3.1.7","3.2.0-preview1","3.2.0-preview2","3.2.0-preview3","3.2.0-rc1","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.2.7","3.2.8","3.2.9","3.3.0-preview1","3.3.0-preview2","3.3.0-preview3","3.3.0-rc1","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8","3.3.9","3.3.10","3.4.0-preview1","3.4.0-preview2","3.4.0-rc1","3.4.0","3.4.1","3.4.2","3.4.3","3.4.4","3.4.5","3.4.6","3.4.7","3.4.8","3.5.0-preview1","4.0.0-preview2","4.0.0-preview3","4.0.0","head","debug","asan","3.4-asan"],"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.3.11.0","9.3.13.0","9.3.14.0","9.3.15.0","9.4.0.0","9.4.1.0","9.4.2.0","9.4.3.0","9.4.4.0","9.4.5.0","9.4.6.0","9.4.7.0","9.4.8.0","9.4.9.0","9.4.10.0","9.4.11.0","9.4.12.0","9.4.12.1","9.4.13.0","9.4.14.0","10.0.0.0","10.0.0.1","10.0.1.0","10.0.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","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","24.2.0","24.2.1","25.0.0","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","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","24.2.0","24.2.1","25.0.0","head"]}');
|
||||
module.exports = /*#__PURE__*/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","2.7.8","3.0.0-preview1","3.0.0-preview2","3.0.0-rc1","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.0.7","3.1.0-preview1","3.1.0","3.1.1","3.1.2","3.1.3","3.1.4","3.1.5","3.1.6","3.1.7","3.2.0-preview1","3.2.0-preview2","3.2.0-preview3","3.2.0-rc1","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.2.7","3.2.8","3.2.9","3.3.0-preview1","3.3.0-preview2","3.3.0-preview3","3.3.0-rc1","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8","3.3.9","3.3.10","3.4.0-preview1","3.4.0-preview2","3.4.0-rc1","3.4.0","3.4.1","3.4.2","3.4.3","3.4.4","3.4.5","3.4.6","3.4.7","3.4.8","3.5.0-preview1","4.0.0-preview2","4.0.0-preview3","4.0.0","head","debug","asan","asan-release"],"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.3.11.0","9.3.13.0","9.3.14.0","9.3.15.0","9.4.0.0","9.4.1.0","9.4.2.0","9.4.3.0","9.4.4.0","9.4.5.0","9.4.6.0","9.4.7.0","9.4.8.0","9.4.9.0","9.4.10.0","9.4.11.0","9.4.12.0","9.4.12.1","9.4.13.0","9.4.14.0","10.0.0.0","10.0.0.1","10.0.1.0","10.0.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","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","24.2.0","24.2.1","25.0.0","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","23.0.0-preview1","23.0.0","23.1.0","23.1.1","23.1.2","24.0.0","24.0.1","24.0.2","24.1.0","24.1.1","24.1.2","24.2.0","24.2.1","25.0.0","head"]}');
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -85300,6 +85305,7 @@ const inputDefaults = {
|
||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||
'self-hosted': 'false',
|
||||
'windows-toolchain': 'default',
|
||||
'token': '',
|
||||
}
|
||||
|
||||
// entry point when this action is run on its own
|
||||
@@ -85327,6 +85333,7 @@ async function setupRuby(options = {}) {
|
||||
}
|
||||
}
|
||||
common.inputs.selfHosted = inputs['self-hosted']
|
||||
common.inputs.token = inputs['token']
|
||||
|
||||
process.chdir(inputs['working-directory'])
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ const inputDefaults = {
|
||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||
'self-hosted': 'false',
|
||||
'windows-toolchain': 'default',
|
||||
'token': '',
|
||||
}
|
||||
|
||||
// entry point when this action is run on its own
|
||||
@@ -45,6 +46,7 @@ export async function setupRuby(options = {}) {
|
||||
}
|
||||
}
|
||||
common.inputs.selfHosted = inputs['self-hosted']
|
||||
common.inputs.token = inputs['token']
|
||||
|
||||
process.chdir(inputs['working-directory'])
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"3.4.0-preview1", "3.4.0-preview2", "3.4.0-rc1", "3.4.0", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8",
|
||||
"3.5.0-preview1",
|
||||
"4.0.0-preview2", "4.0.0-preview3", "4.0.0",
|
||||
"head", "debug", "asan", "3.4-asan"
|
||||
"head", "debug", "asan", "asan-release"
|
||||
],
|
||||
"jruby": [
|
||||
"9.1.17.0",
|
||||
|
||||
+1
-2
@@ -4,7 +4,6 @@ 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')
|
||||
const common = require('./common')
|
||||
const rubyBuilderVersions = require('./ruby-builder-versions')
|
||||
|
||||
@@ -75,7 +74,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
||||
const url = getDownloadURL(platform, engine, version)
|
||||
console.log(url)
|
||||
try {
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
} catch (error) {
|
||||
if (error.message.includes('404')) {
|
||||
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
|
||||
|
||||
+4
-5
@@ -7,7 +7,6 @@ const path = require('path')
|
||||
const cp = require('child_process')
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const tc = require('@actions/tool-cache')
|
||||
const common = require('./common')
|
||||
const rubyInstallerVersions = require('./windows-versions.json')
|
||||
const toolchainVersions = require('./windows-toolchain-versions.json')
|
||||
@@ -81,7 +80,7 @@ export async function install(platform, engine, version) {
|
||||
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = process.env.RUNNER_TEMP
|
||||
@@ -113,7 +112,7 @@ export async function installJRubyTools() {
|
||||
async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
|
||||
const downloadPath = await common.measure('Downloading msys2 build tools', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = path.join(process.env.RUNNER_TEMP, 'msys64')
|
||||
@@ -160,7 +159,7 @@ async function installMSYS1(url) {
|
||||
|
||||
const downloadPath = await common.measure('Downloading msys1 build tools', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const msys1Path = `${common.drive}:\\DevKit64`
|
||||
@@ -196,7 +195,7 @@ async function installMSYS1(url) {
|
||||
async function installVCPKG(url) {
|
||||
const downloadPath = await common.measure('Downloading mswin vcpkg packages', async () => {
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
return await common.download(url)
|
||||
})
|
||||
|
||||
const extractPath = process.env.VCPKG_INSTALLATION_ROOT
|
||||
|
||||
Reference in New Issue
Block a user