mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
708024e6c9 | ||
|
|
757ecf59ea | ||
|
|
6963d48fc7 | ||
|
|
3fc6249beb | ||
|
|
b939495830 | ||
|
|
4fc31e1c82 | ||
|
|
675dd7ba1b | ||
|
|
5dd816ae01 | ||
|
|
c2f29a7833 | ||
|
|
d5f787ce33 | ||
|
|
1010da45f3 | ||
|
|
7f50f6e3b3 | ||
|
|
be19563477 | ||
|
|
b90be12699 | ||
|
|
4c24fa5ec0 | ||
|
|
8a836efbce | ||
|
|
ae195bbe74 |
+51
-88
@@ -13,90 +13,27 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test-matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ruby-version: ruby
|
||||||
|
- id: matrix
|
||||||
|
run: echo "matrix=$(ruby generate-test-matrix.rb)" | tee -a "$GITHUB_OUTPUT"
|
||||||
|
- run: echo "$MATRIX" | yq -P
|
||||||
|
env:
|
||||||
|
MATRIX: ${{ steps.matrix.outputs.matrix }}
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
needs: [test-matrix]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm, macos-14, macos-15, macos-15-intel, windows-2022, windows-2025, windows-11-arm ]
|
include: ${{ fromJSON(needs.test-matrix.outputs.matrix) }}
|
||||||
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', '3.3', '3.4', '4.0', ruby-head,
|
|
||||||
jruby-9.4, jruby, jruby-head,
|
|
||||||
truffleruby, truffleruby-head,
|
|
||||||
truffleruby+graalvm, truffleruby+graalvm-head
|
|
||||||
]
|
|
||||||
include:
|
|
||||||
- { os: windows-2022, ruby: mingw }
|
|
||||||
- { os: windows-2022, ruby: mswin }
|
|
||||||
- { os: windows-2022, ruby: ucrt }
|
|
||||||
- { os: windows-2025, ruby: mingw }
|
|
||||||
- { os: windows-2025, ruby: mswin }
|
|
||||||
- { os: windows-2025, ruby: ucrt }
|
|
||||||
- { os: ubuntu-24.04, ruby: asan }
|
|
||||||
- { os: ubuntu-24.04, ruby: 3.4-asan }
|
|
||||||
exclude:
|
|
||||||
# https://github.com/ruby/setup-ruby/issues/496
|
|
||||||
- { os: ubuntu-22.04, ruby: '2.2' }
|
|
||||||
- { os: ubuntu-24.04, ruby: '1.9' }
|
|
||||||
- { os: ubuntu-24.04, ruby: '2.2' }
|
|
||||||
# These old Rubies fail to compile on macOS arm64
|
|
||||||
- { os: macos-14, ruby: '1.9' }
|
|
||||||
- { os: macos-14, ruby: '2.0' }
|
|
||||||
- { os: macos-14, ruby: '2.1' }
|
|
||||||
- { os: macos-14, ruby: '2.2' }
|
|
||||||
- { os: macos-14, ruby: '2.3' }
|
|
||||||
- { os: macos-14, ruby: '2.4' }
|
|
||||||
- { os: macos-14, ruby: '2.5' }
|
|
||||||
- { os: macos-15, ruby: '1.9' }
|
|
||||||
- { os: macos-15, ruby: '2.0' }
|
|
||||||
- { os: macos-15, ruby: '2.1' }
|
|
||||||
- { os: macos-15, ruby: '2.2' }
|
|
||||||
- { os: macos-15, ruby: '2.3' }
|
|
||||||
- { os: macos-15, ruby: '2.4' }
|
|
||||||
- { os: macos-15, ruby: '2.5' }
|
|
||||||
# These old Rubies fail to compile or segfault on Linux arm64
|
|
||||||
- { os: ubuntu-22.04-arm, ruby: '1.9' }
|
|
||||||
- { os: ubuntu-22.04-arm, ruby: '2.0' }
|
|
||||||
- { os: ubuntu-22.04-arm, ruby: '2.1' }
|
|
||||||
- { os: ubuntu-22.04-arm, ruby: '2.2' }
|
|
||||||
- { os: ubuntu-24.04-arm, ruby: '1.9' }
|
|
||||||
- { os: ubuntu-24.04-arm, ruby: '2.0' }
|
|
||||||
- { os: ubuntu-24.04-arm, ruby: '2.1' }
|
|
||||||
- { os: ubuntu-24.04-arm, ruby: '2.2' }
|
|
||||||
# RubyInstaller windows-arm64 builds only exist for Ruby 3.4+
|
|
||||||
- { os: windows-11-arm, ruby: '2.0' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.1' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.2' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.3' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.4' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.5' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.6' }
|
|
||||||
- { os: windows-11-arm, ruby: '2.7' }
|
|
||||||
- { os: windows-11-arm, ruby: '3.0' }
|
|
||||||
- { os: windows-11-arm, ruby: '3.1' }
|
|
||||||
- { os: windows-11-arm, ruby: '3.2' }
|
|
||||||
- { os: windows-11-arm, ruby: '3.3' }
|
|
||||||
# RubyInstaller has no 64-bit builds of 1.9 on Windows
|
|
||||||
- { 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 }
|
|
||||||
- { os: windows-11-arm, ruby: truffleruby }
|
|
||||||
- { os: windows-2022, ruby: truffleruby-head }
|
|
||||||
- { os: windows-2025, ruby: truffleruby-head }
|
|
||||||
- { os: windows-11-arm, ruby: truffleruby-head }
|
|
||||||
- { os: windows-2022, ruby: truffleruby+graalvm }
|
|
||||||
- { os: windows-2025, ruby: truffleruby+graalvm }
|
|
||||||
- { os: windows-11-arm, ruby: truffleruby+graalvm }
|
|
||||||
- { os: windows-2022, ruby: truffleruby+graalvm-head }
|
|
||||||
- { os: windows-2025, ruby: truffleruby+graalvm-head }
|
|
||||||
- { os: windows-11-arm, ruby: truffleruby+graalvm-head }
|
|
||||||
|
|
||||||
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -117,7 +54,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
|
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
|
||||||
- name: gcc and ridk version (mingw)
|
- name: gcc and ridk version (mingw)
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
|
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
|
||||||
if ($plat.Contains('mingw')) {
|
if ($plat.Contains('mingw')) {
|
||||||
@@ -158,15 +95,15 @@ jobs:
|
|||||||
- name: bundle install (bash)
|
- name: bundle install (bash)
|
||||||
run: bundle install
|
run: bundle install
|
||||||
shell: bash
|
shell: bash
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: runner.os == 'Windows'
|
||||||
- name: bundle exec rake --version (bash)
|
- name: bundle exec rake --version (bash)
|
||||||
run: bundle exec rake --version
|
run: bundle exec rake --version
|
||||||
shell: bash
|
shell: bash
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: runner.os == 'Windows'
|
||||||
- name: bundle exec rake (bash)
|
- name: bundle exec rake (bash)
|
||||||
run: bundle exec rake
|
run: bundle exec rake
|
||||||
shell: bash
|
shell: bash
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: runner.os == 'Windows'
|
||||||
|
|
||||||
- name: Test `gem github:` in a Gemfile
|
- name: Test `gem github:` in a Gemfile
|
||||||
run: bundle install
|
run: bundle install
|
||||||
@@ -183,9 +120,9 @@ jobs:
|
|||||||
if: "matrix.ruby != 'mingw' && matrix.ruby != 'mswin' && matrix.ruby != 'ucrt'"
|
if: "matrix.ruby != 'mingw' && matrix.ruby != 'mswin' && matrix.ruby != 'ucrt'"
|
||||||
- name: which rake
|
- name: which rake
|
||||||
run: which -a rake
|
run: which -a rake
|
||||||
if: "!startsWith(matrix.os, 'windows')"
|
if: runner.os != 'Windows'
|
||||||
- name: where ruby, rake, bundle
|
- name: where ruby, rake, bundle
|
||||||
if: startsWith(matrix.os, 'windows')
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
$where = 'ruby', 'rake', 'bundle'
|
$where = 'ruby', 'rake', 'bundle'
|
||||||
@@ -199,7 +136,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: echo ~ && bundle install
|
run: echo ~ && bundle install
|
||||||
- name: Windows JRuby
|
- name: Windows JRuby
|
||||||
if: startsWith(matrix.os, 'windows') && startsWith(matrix.ruby, 'jruby')
|
if: runner.os == 'Windows' && startsWith(matrix.ruby, 'jruby')
|
||||||
run: gem install sassc
|
run: gem install sassc
|
||||||
|
|
||||||
testDotRubyVersion:
|
testDotRubyVersion:
|
||||||
@@ -352,6 +289,19 @@ jobs:
|
|||||||
bundler: 2.2.3
|
bundler: 2.2.3
|
||||||
- run: bundle --version | grep -F "Bundler version 2.2.3"
|
- run: bundle --version | grep -F "Bundler version 2.2.3"
|
||||||
|
|
||||||
|
# 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:
|
testBundlerPre:
|
||||||
name: "Test with a Bundler pre/rc version"
|
name: "Test with a Bundler pre/rc version"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -419,7 +369,20 @@ jobs:
|
|||||||
- name: C:/msys64/mingw64/bin/gcc.exe not installed
|
- name: C:/msys64/mingw64/bin/gcc.exe not installed
|
||||||
run: ruby -e "abort if File.exist?('C:/msys64/mingw64/bin/gcc.exe')"
|
run: ruby -e "abort if File.exist?('C:/msys64/mingw64/bin/gcc.exe')"
|
||||||
|
|
||||||
lint:
|
validate-windows-versions:
|
||||||
|
name: "Check windows*versions.json are up-to-date"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ruby-version: ruby
|
||||||
|
- run: ruby generate-windows-versions.rb
|
||||||
|
- name: Check generated files are up to date
|
||||||
|
run: git diff --exit-code
|
||||||
|
|
||||||
|
check-dist-index:
|
||||||
|
name: "Check dist/index.js is up-to-date"
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
|||||||
|
|
||||||
| Interpreter | Versions |
|
| Interpreter | Versions |
|
||||||
| ----------- | -------- |
|
| ----------- | -------- |
|
||||||
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 4.0.0-preview3, head, debug, mingw, mswin, ucrt |
|
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 4.0.1, head, debug, mingw, mswin, ucrt |
|
||||||
| `jruby` | 9.1.17.0 - 10.0.2.0, head |
|
| `jruby` | 9.1.17.0 - 10.0.2.0, head |
|
||||||
| `truffleruby` | 19.3.0 - 25.0.0, head |
|
| `truffleruby` | 19.3.0 - 33.0.0, head |
|
||||||
| `truffleruby+graalvm` | 21.2.0 - 25.0.0, head |
|
| `truffleruby+graalvm` | 21.2.0 - 33.0.0, head |
|
||||||
|
|
||||||
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
||||||
|
|
||||||
@@ -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`.
|
Native extensions are automatically compiled with AddressSanitizer when using `ruby-asan`.
|
||||||
`ruby-asan` is currently only available on `ubuntu-24.04`.
|
`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`.
|
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
|
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).
|
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.
|
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
|
## Windows
|
||||||
|
|
||||||
Note that running CI on Windows can be quite challenging if you are not very familiar with 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.
|
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.
|
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.
|
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:
|
outputs:
|
||||||
ruby-prefix:
|
ruby-prefix:
|
||||||
|
|||||||
+4
-4
@@ -162,10 +162,10 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
|
|||||||
}
|
}
|
||||||
|
|
||||||
let envOptions = {}
|
let envOptions = {}
|
||||||
if (bundlerVersion.startsWith('1') && common.isBundler2PlusDefault(engine, rubyVersion)) {
|
if (bundlerVersion.match(/^\d+/)) {
|
||||||
// If Bundler 1 is specified on Rubies which ship with Bundler 2+,
|
// If a specific Bundler version is given or determined, we need to specify the version to use explicitly until the lockfile exists.
|
||||||
// we need to specify which Bundler 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 1 is 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 } }
|
envOptions = { env: { ...process.env, BUNDLER_VERSION: bundlerVersion } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ export const drive = (windows ? (process.env['RUNNER_TEMP'] || 'C')[0] : undefin
|
|||||||
const PATH_ENV_VAR = windows ? 'Path' : 'PATH'
|
const PATH_ENV_VAR = windows ? 'Path' : 'PATH'
|
||||||
|
|
||||||
export const inputs = {
|
export const inputs = {
|
||||||
selfHosted: undefined
|
selfHosted: undefined,
|
||||||
|
token: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export function partition(string, separator) {
|
export function partition(string, separator) {
|
||||||
@@ -68,8 +69,8 @@ export async function time(name, block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isHeadVersion(rubyVersion) {
|
export function isHeadVersion(rubyVersion) {
|
||||||
// 3.4-asan counts as "head" because the version cannot be selected -- you can only get whatever's latest
|
// 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', '3.4-asan'].includes(rubyVersion)
|
return ['head', 'debug', 'mingw', 'mswin', 'ucrt', 'asan', 'asan-release'].includes(rubyVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isStableVersion(engine, rubyVersion) {
|
export function isStableVersion(engine, rubyVersion) {
|
||||||
@@ -441,3 +442,8 @@ export function isExactCacheKeyMatch(key, cacheKey) {
|
|||||||
}) === 0
|
}) === 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function download(url) {
|
||||||
|
const auth = inputs.token ? `token ${inputs.token}` : undefined
|
||||||
|
return await tc.downloadTool(url, undefined, auth)
|
||||||
|
}
|
||||||
|
|||||||
+24
-17
File diff suppressed because one or more lines are too long
@@ -0,0 +1,77 @@
|
|||||||
|
require 'json'
|
||||||
|
|
||||||
|
# Returns unique semantic versions and symbolic versions
|
||||||
|
#
|
||||||
|
# segment_count = 1 returns unique major versions
|
||||||
|
# segment_count = 2 returns unique minor versions
|
||||||
|
# segment_count = 3 returns unique patch versions
|
||||||
|
def unique_versions(versions, segment_count, *symbolic)
|
||||||
|
versions.filter_map do |version|
|
||||||
|
next unless Gem::Version.correct?(version)
|
||||||
|
|
||||||
|
ruby_version = Gem::Version.new(version)
|
||||||
|
next if ruby_version.prerelease? && ruby_version.segments[-2] != 'p'
|
||||||
|
|
||||||
|
ruby_version.segments[0, segment_count].join('.')
|
||||||
|
end.uniq + versions.intersection(symbolic)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Runners
|
||||||
|
runners = %w[
|
||||||
|
macos-14
|
||||||
|
macos-15
|
||||||
|
macos-15-intel
|
||||||
|
ubuntu-22.04
|
||||||
|
ubuntu-24.04
|
||||||
|
ubuntu-22.04-arm
|
||||||
|
ubuntu-24.04-arm
|
||||||
|
windows-2022
|
||||||
|
windows-2025
|
||||||
|
windows-11-arm
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
macos_runners = runners.select { |runner| runner.start_with?('macos-') }
|
||||||
|
ubuntu_runners = runners.select { |runner| runner.start_with?('ubuntu-') }
|
||||||
|
windows_runners, non_windows_runners = runners.partition { |runner| runner.start_with?('windows-') }
|
||||||
|
|
||||||
|
macos_arm64_runners, _macos_x64_runners = macos_runners.partition { |runner| !runner.end_with?('-intel')}
|
||||||
|
ubuntu_arm64_runners, ubuntu_x64_runners = ubuntu_runners.partition { |runner| runner.end_with?('-arm')}
|
||||||
|
windows_arm64_runners, windows_x64_runners = windows_runners.partition { |runner| runner.end_with?('-arm') }
|
||||||
|
|
||||||
|
# Versions
|
||||||
|
ruby_builder_versions = JSON.load(File.read('ruby-builder-versions.json'))
|
||||||
|
windows_versions = JSON.load(File.read('windows-versions.json'))
|
||||||
|
|
||||||
|
# ruby: each minor release + head
|
||||||
|
ruby_versions = unique_versions(ruby_builder_versions['ruby'], 2, 'head')
|
||||||
|
windows_ruby_versions = unique_versions(windows_versions.keys, 2, 'head')
|
||||||
|
matrix = non_windows_runners.product(ruby_versions) + windows_runners.product(windows_ruby_versions)
|
||||||
|
|
||||||
|
# jruby: each major release + head
|
||||||
|
jruby_versions = unique_versions(ruby_builder_versions['jruby'], 1, 'head').map { |version| "jruby-#{version}" }
|
||||||
|
matrix += runners.product(jruby_versions)
|
||||||
|
|
||||||
|
# truffleruby: latest release + head
|
||||||
|
truffleruby_versions = %w[truffleruby truffleruby-head truffleruby+graalvm truffleruby+graalvm-head]
|
||||||
|
matrix += non_windows_runners.product(truffleruby_versions)
|
||||||
|
|
||||||
|
# ruby-loco: head
|
||||||
|
ruby_loco_versions = %w[mingw mswin ucrt]
|
||||||
|
matrix += windows_x64_runners.product(ruby_loco_versions)
|
||||||
|
|
||||||
|
# asan: latest release + head
|
||||||
|
asan_versions = %w[asan-release asan]
|
||||||
|
matrix += ubuntu_x64_runners.sort.last(1).product(asan_versions)
|
||||||
|
|
||||||
|
# https://github.com/ruby/setup-ruby/pull/596#discussion_r1606047680
|
||||||
|
matrix -= (ubuntu_runners - %w[ubuntu-22.04]).product(%w[1.9])
|
||||||
|
# https://github.com/ruby/setup-ruby/issues/496
|
||||||
|
matrix -= ubuntu_runners.product(%w[2.2])
|
||||||
|
# These old Rubies fail to compile on macOS arm64
|
||||||
|
matrix -= macos_arm64_runners.product(%w[1.9 2.0 2.1 2.2 2.3 2.4 2.5])
|
||||||
|
# These old Rubies fail to compile or segfault on Linux arm64
|
||||||
|
matrix -= ubuntu_arm64_runners.product(%w[1.9 2.0 2.1 2.2])
|
||||||
|
# RubyInstaller windows-arm64 builds only exist for Ruby 3.4+
|
||||||
|
matrix -= windows_arm64_runners.product(%w[2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3])
|
||||||
|
|
||||||
|
puts(JSON.generate(matrix.sort.map { |os, ruby| { os:, ruby: } }))
|
||||||
@@ -2,6 +2,31 @@ require 'open-uri'
|
|||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
|
# General rules:
|
||||||
|
# - All the static parts of the expected URL are checked literally.
|
||||||
|
# - Each path component must begin with [\w], or a more restrictive character set.
|
||||||
|
# - Percent (`%`) shall not be allowed to avoid any percent encoding.
|
||||||
|
WINDOWS_VERSIONS_URLS_REGEXPS = [
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller/releases/download'}/\w[\w.-]*/\w[\w.-]*\z},
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller2/releases/download'}/\w[\w.-]*/\w[\w.-]*\z},
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/MSP-Greg/ruby-loco/releases/download'}/\w[\w.-]*/\w[\w.-]*\z}
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
WINDOWS_TOOLCHAIN_VERSIONS_URLS_REGEXPS = [
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'}\z},
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/ruby/setup-msys2-gcc/releases/download'}/\w[\w.-]*/\w[\w@.-]*\z},
|
||||||
|
%r{\A#{Regexp.escape 'https://github.com/ruby/setup-msys2-gcc/releases/latest/download'}/\w[\w@.-]*\z}
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
# Validate all the URLs in the versions json
|
||||||
|
def validate(versions, allowed_urls_regexps)
|
||||||
|
versions.values.flat_map(&:values).each do |url|
|
||||||
|
if allowed_urls_regexps.none? { |regexp| regexp.match? url }
|
||||||
|
raise SecurityError, "Unexpected URL: #{url}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
min_requirements = ['~> 2.0.0', '~> 2.1.9', '>= 2.2.6'].map { |req| Gem::Requirement.new(req) }
|
min_requirements = ['~> 2.0.0', '~> 2.1.9', '>= 2.2.6'].map { |req| Gem::Requirement.new(req) }
|
||||||
|
|
||||||
url = 'https://raw.githubusercontent.com/oneclick/rubyinstaller.org-website/master/_data/downloads.yaml'
|
url = 'https://raw.githubusercontent.com/oneclick/rubyinstaller.org-website/master/_data/downloads.yaml'
|
||||||
@@ -48,6 +73,7 @@ versions['ucrt'] = {
|
|||||||
'x64' => 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z'
|
'x64' => 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validate(versions, WINDOWS_VERSIONS_URLS_REGEXPS)
|
||||||
File.binwrite 'windows-versions.json', "#{JSON.pretty_generate(versions)}\n"
|
File.binwrite 'windows-versions.json', "#{JSON.pretty_generate(versions)}\n"
|
||||||
|
|
||||||
base_url = 'https://github.com/ruby/setup-msys2-gcc/releases/latest/download/windows-toolchain.json'
|
base_url = 'https://github.com/ruby/setup-msys2-gcc/releases/latest/download/windows-toolchain.json'
|
||||||
@@ -90,4 +116,5 @@ versions.each do |raw_version, archs|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
validate(versions, WINDOWS_TOOLCHAIN_VERSIONS_URLS_REGEXPS)
|
||||||
File.binwrite 'windows-toolchain-versions.json', "#{JSON.pretty_generate(versions)}\n"
|
File.binwrite 'windows-toolchain-versions.json', "#{JSON.pretty_generate(versions)}\n"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const inputDefaults = {
|
|||||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||||
'self-hosted': 'false',
|
'self-hosted': 'false',
|
||||||
'windows-toolchain': 'default',
|
'windows-toolchain': 'default',
|
||||||
|
'token': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
// entry point when this action is run on its own
|
// 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.selfHosted = inputs['self-hosted']
|
||||||
|
common.inputs.token = inputs['token']
|
||||||
|
|
||||||
process.chdir(inputs['working-directory'])
|
process.chdir(inputs['working-directory'])
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
"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",
|
"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.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.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.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.2.10",
|
||||||
"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.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.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",
|
"3.5.0-preview1",
|
||||||
"4.0.0-preview2", "4.0.0-preview3",
|
"4.0.0-preview2", "4.0.0-preview3", "4.0.0", "4.0.1",
|
||||||
"head", "debug", "asan", "3.4-asan"
|
"head", "debug", "asan", "asan-release"
|
||||||
],
|
],
|
||||||
"jruby": [
|
"jruby": [
|
||||||
"9.1.17.0",
|
"9.1.17.0",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"23.0.0-preview1", "23.0.0", "23.1.0", "23.1.1", "23.1.2",
|
"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",
|
"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",
|
"25.0.0",
|
||||||
|
"33.0.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby+graalvm": [
|
"truffleruby+graalvm": [
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
"23.0.0-preview1", "23.0.0", "23.1.0", "23.1.1", "23.1.2",
|
"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",
|
"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",
|
"25.0.0",
|
||||||
|
"33.0.0",
|
||||||
"head"
|
"head"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -4,7 +4,6 @@ const path = require('path')
|
|||||||
const core = require('@actions/core')
|
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 common = require('./common')
|
const common = require('./common')
|
||||||
const rubyBuilderVersions = require('./ruby-builder-versions')
|
const rubyBuilderVersions = require('./ruby-builder-versions')
|
||||||
|
|
||||||
@@ -75,7 +74,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
|||||||
const url = getDownloadURL(platform, engine, version)
|
const url = getDownloadURL(platform, engine, version)
|
||||||
console.log(url)
|
console.log(url)
|
||||||
try {
|
try {
|
||||||
return await tc.downloadTool(url)
|
return await common.download(url)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message.includes('404')) {
|
if (error.message.includes('404')) {
|
||||||
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
|
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
|
||||||
|
|||||||
@@ -271,6 +271,10 @@
|
|||||||
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-clangarm64.7z",
|
"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"
|
"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": {
|
"head": {
|
||||||
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-clangarm64.7z",
|
"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"
|
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/msys2-ucrt64.7z"
|
||||||
|
|||||||
@@ -271,6 +271,10 @@
|
|||||||
"arm64": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.8-1/rubyinstaller-3.4.8-1-arm.7z",
|
"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"
|
"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": {
|
"head": {
|
||||||
"arm64": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-arm.7z",
|
"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"
|
"x64": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z"
|
||||||
|
|||||||
+4
-5
@@ -7,7 +7,6 @@ const path = require('path')
|
|||||||
const cp = require('child_process')
|
const cp = require('child_process')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const exec = require('@actions/exec')
|
const exec = require('@actions/exec')
|
||||||
const tc = require('@actions/tool-cache')
|
|
||||||
const common = require('./common')
|
const common = require('./common')
|
||||||
const rubyInstallerVersions = require('./windows-versions.json')
|
const rubyInstallerVersions = require('./windows-versions.json')
|
||||||
const toolchainVersions = require('./windows-toolchain-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) {
|
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
return await common.download(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const extractPath = process.env.RUNNER_TEMP
|
const extractPath = process.env.RUNNER_TEMP
|
||||||
@@ -113,7 +112,7 @@ export async function installJRubyTools() {
|
|||||||
async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
|
async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
|
||||||
const downloadPath = await common.measure('Downloading msys2 build tools', async () => {
|
const downloadPath = await common.measure('Downloading msys2 build tools', async () => {
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
return await common.download(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const extractPath = path.join(process.env.RUNNER_TEMP, 'msys64')
|
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 () => {
|
const downloadPath = await common.measure('Downloading msys1 build tools', async () => {
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
return await common.download(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const msys1Path = `${common.drive}:\\DevKit64`
|
const msys1Path = `${common.drive}:\\DevKit64`
|
||||||
@@ -196,7 +195,7 @@ async function installMSYS1(url) {
|
|||||||
async function installVCPKG(url) {
|
async function installVCPKG(url) {
|
||||||
const downloadPath = await common.measure('Downloading mswin vcpkg packages', async () => {
|
const downloadPath = await common.measure('Downloading mswin vcpkg packages', async () => {
|
||||||
console.log(url)
|
console.log(url)
|
||||||
return await tc.downloadTool(url)
|
return await common.download(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const extractPath = process.env.VCPKG_INSTALLATION_ROOT
|
const extractPath = process.env.VCPKG_INSTALLATION_ROOT
|
||||||
|
|||||||
Reference in New Issue
Block a user