Compare commits

...
7 Commits
Author SHA1 Message Date
Benoit Daloze d5f787ce33 Define a helper to download to avoid duplication 2026-01-07 22:23:14 +01:00
Benoit Daloze 1010da45f3 Tweaks 2026-01-07 22:23:14 +01:00
Tingluo Huang 7f50f6e3b3 Add token input and pass it to release assets download. 2026-01-07 22:23:14 +01:00
なつき be19563477 Test ruby 4.0 on windows 2026-01-06 23:59:42 +01:00
Benoit Daloze b90be12699 Rename 3.4-asan to asan-release
* And it is currently based on the latest release, that is 4.0.0.
2026-01-05 18:59:19 +01:00
Benoit Daloze 4c24fa5ec0 Set BUNDLER_VERSION whenever we know which version to use
* Fixes https://github.com/ruby/setup-ruby/issues/845
2025-12-31 23:13:45 +01:00
ruby-builder-bot 8a836efbce Update CRuby releases on Windows 2025-12-30 10:31:12 +01:00
12 changed files with 90 additions and 38 deletions
+14 -5
View File
@@ -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 }
@@ -352,6 +348,19 @@ jobs:
bundler: 2.2.3
- run: bundle --version | grep -F "Bundler version 2.2.3"
# https://github.com/ruby/setup-ruby/issues/845
testOlderBundlerVersion:
name: "Test with an older Bundler version than the one of the default gem"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./
with:
ruby-version: '4.0'
bundler: 2.7.2
bundler-cache: true
- run: bundle --version | grep -F "Bundler version 2.7.2"
testBundlerPre:
name: "Test with a Bundler pre/rc version"
runs-on: ubuntu-latest
+17 -1
View File
@@ -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.
+6
View File
@@ -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:
+4 -4
View File
@@ -162,10 +162,10 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
}
let envOptions = {}
if (bundlerVersion.startsWith('1') && common.isBundler2PlusDefault(engine, rubyVersion)) {
// If Bundler 1 is specified on Rubies which ship with Bundler 2+,
// we need to specify which Bundler version to use explicitly until the lockfile exists.
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler 1 is used`)
if (bundlerVersion.match(/^\d+/)) {
// If a specific Bundler version is given or determined, we need to specify the version to use explicitly until the lockfile exists.
// Otherwise, a newer version of Bundler might be used.
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler ${bundlerVersion} is used`)
envOptions = { env: { ...process.env, BUNDLER_VERSION: bundlerVersion } }
}
+9 -3
View File
@@ -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)
}
Generated Vendored
+24 -17
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -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'])
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -271,6 +271,10 @@
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-clangarm64.7z",
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-ucrt64.7z"
},
"4.0.0": {
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-clangarm64.7z",
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-ucrt64.7z"
},
"head": {
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-clangarm64.7z",
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-ucrt64.7z"
+4
View File
@@ -271,6 +271,10 @@
"arm64": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.8-1/rubyinstaller-3.4.8-1-arm.7z",
"x64": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.8-1/rubyinstaller-3.4.8-1-x64.7z"
},
"4.0.0": {
"arm64": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-4.0.0-1/rubyinstaller-4.0.0-1-arm.7z",
"x64": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-4.0.0-1/rubyinstaller-4.0.0-1-x64.7z"
},
"head": {
"arm64": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-arm.7z",
"x64": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z"
+4 -5
View File
@@ -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