Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Native extensions are automatically compiled with AddressSanitizer when using `r
`ruby-asan` and `asan-release` are currently only available on `ubuntu-24.04` and `ubuntu-26.04`.

Regarding Windows ruby master builds, `mingw` is a MSYS2/MinGW build, `head` & `ucrt` are MSYS2/UCRT64
builds, and `mswin` is a MSVC/VS 2022 build.
builds, and `mswin` is a MSVC build.

Preview and RC versions of Ruby might be available too on Ubuntu and macOS (not on Windows).
However, it is recommended to test against `ruby-head` rather than previews,
Expand Down Expand Up @@ -62,7 +62,8 @@ only has builds of CRuby 2.3 and newer, as older CRuby versions do not compile o

The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
The `mingw`, `ucrt` and `mswin` builds are generated by [ruby-loco](https://github.com/MSP-Greg/ruby-loco).
The `mingw` and `ucrt` builds are generated by [ruby-loco](https://github.com/MSP-Greg/ruby-loco).
The `mswin` build is the daily master build published at [cache.ruby-lang.org](https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/).
`ruby-head` is generated by [ruby-dev-builder](https://github.com/ruby/ruby-dev-builder),
`jruby-head` is generated by [jruby-dev-builder](https://github.com/ruby/jruby-dev-builder),
`truffleruby-head` and `truffleruby+graalvm-head` are generated by [truffleruby-dev-builder](https://github.com/ruby/truffleruby-dev-builder).
Expand Down
3 changes: 2 additions & 1 deletion common.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ export function isExactCacheKeyMatch(key, cacheKey) {
}

export async function download(url) {
const auth = inputs.token ? `token ${inputs.token}` : undefined
// The token is for github.com, so it must not reach other hosts such as cache.ruby-lang.org
const auth = inputs.token && new URL(url).hostname === 'github.com' ? `token ${inputs.token}` : undefined
return await tc.downloadTool(url, undefined, auth)
}
61 changes: 37 additions & 24 deletions dist/index.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion generate-test-matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ def unique_versions(versions, segment_count, *symbolic)
matrix += (macos_arm64_runners + ubuntu_runners).product(truffleruby_versions)

# ruby-loco: head
ruby_loco_versions = %w[mingw mswin ucrt]
ruby_loco_versions = %w[mingw ucrt]
matrix += windows_x64_runners.product(ruby_loco_versions)

# mswin: head
matrix += windows_runners.product(%w[mswin])

# asan: latest release + head
asan_versions = %w[asan-release asan]
matrix += asan_runners.sort.last(1).product(asan_versions)
Expand Down
8 changes: 5 additions & 3 deletions generate-windows-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
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}
%r{\A#{Regexp.escape 'https://github.com/MSP-Greg/ruby-loco/releases/download'}/\w[\w.-]*/\w[\w.-]*\z},
%r{\A#{Regexp.escape 'https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/dev'}/\w[\w.-]*\z}
].freeze

WINDOWS_TOOLCHAIN_VERSIONS_URLS_REGEXPS = [
Expand Down Expand Up @@ -67,7 +68,8 @@ def validate(versions, allowed_urls_regexps)
'x64' => 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z'
}
versions['mswin'] = {
'x64' => 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z'
'arm64' => 'https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/dev/ruby-head-arm64-mswin64_140.zip',
'x64' => 'https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/dev/ruby-head-x64-mswin64_140.zip'
}
versions['ucrt'] = {
'x64' => 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z'
Expand All @@ -92,7 +94,7 @@ def validate(versions, allowed_urls_regexps)
when 'mingw'
"#{arch}-mingw32"
when 'mswin'
"#{arch}-mswin64"
"#{raw_arch}-mswin64"
else
if version >= Gem::Version.new('3.1.0.dev')
"#{arch}-mingw-ucrt"
Expand Down
1 change: 1 addition & 0 deletions windows-toolchain-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/download/v20261024.010459/msys2-mingw64.7z"
},
"mswin": {
"arm64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/vcpkg-arm64-windows.7z",
"x64": "https://github.com/ruby/setup-msys2-gcc/releases/latest/download/vcpkg-x64-windows.7z"
},
"ucrt": {
Expand Down
3 changes: 2 additions & 1 deletion windows-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@
"x64": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z"
},
"mswin": {
"x64": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z"
"arm64": "https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/dev/ruby-head-arm64-mswin64_140.zip",
"x64": "https://cache.ruby-lang.org/pub/ruby/binaries/mswin64/dev/ruby-head-x64-mswin64_140.zip"
},
"ucrt": {
"x64": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z"
Expand Down
54 changes: 33 additions & 21 deletions windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export function getAvailableVersions(_platform, engine) {
export async function install(platform, engine, version) {
const url = rubyInstallerVersions[version][os.arch()]

if (!url.endsWith('.7z')) {
throw new Error(`URL should end in .7z: ${url}`)
const ext = path.posix.extname(url)
if (ext !== '.7z' && ext !== '.zip') {
throw new Error(`URL should end in .7z or .zip: ${url}`)
}
const base = path.posix.basename(url, '.7z')
const base = path.posix.basename(url, ext)

let rubyPrefix, inToolCache
if (common.shouldUseToolCache(engine, version)) {
Expand All @@ -43,13 +44,6 @@ export async function install(platform, engine, version) {
await downloadAndExtract(engine, version, url, base, rubyPrefix);
}

const paths = [`${rubyPrefix}\\bin`]
const windowsToolchain = core.getInput('windows-toolchain')
if (windowsToolchain === 'none') {
common.setupPath(paths)
return rubyPrefix
}

const toolchainUrl = toolchainVersions[version][os.arch()]

// Examples:
Expand All @@ -58,6 +52,17 @@ export async function install(platform, engine, version) {
// - vcpkg-x64-windows.7z
const toolchainName = path.posix.basename(toolchainUrl).split('-')[0].toLowerCase()

if (toolchainName === 'devkit' || version === 'mswin') {
await setupSslCertFile()
}

const paths = [`${rubyPrefix}\\bin`]
const windowsToolchain = core.getInput('windows-toolchain')
if (windowsToolchain === 'none') {
common.setupPath(paths)
return rubyPrefix
}

if (toolchainName === 'msys2') {
paths.push(...await installMSYS2(toolchainUrl, rubyPrefix))
} else {
Expand Down Expand Up @@ -148,16 +153,24 @@ async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
return [`${msys2Path}\\${msys2Type}\\bin`, `${msys2Path}\\usr\\bin`]
}

async function installMSYS1(url) {
const certFile = [
'C:\\Program Files\\Git\\ucrt64\\etc\\ssl\\cert.pem',
'C:\\Program Files\\Git\\mingw64\\etc\\ssl\\cert.pem',
'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem',
].find(file => fs.existsSync(file))
if (certFile === undefined) {
throw new Error("Cannot find Git's cert file")
}
// DevKit and mswin Rubies have no usable CA certificates on runners, so they use the bundle of Git for Windows
async function setupSslCertFile() {
await core.group('Setting up CA certificates', async () => {
const certFile = [
'C:\\Program Files\\Git\\ucrt64\\etc\\ssl\\cert.pem',
'C:\\Program Files\\Git\\mingw64\\etc\\ssl\\cert.pem',
'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem',
'C:\\Program Files\\Git\\clangarm64\\etc\\ssl\\cert.pem',
].find(file => fs.existsSync(file))
if (certFile === undefined) {
throw new Error("Cannot find Git's cert file")
}

exportEnv({ SSL_CERT_FILE: certFile })
})
}

async function installMSYS1(url) {
const downloadPath = await common.measure('Downloading msys1 build tools', async () => {
console.log(url)
return await common.download(url)
Expand All @@ -182,8 +195,7 @@ async function installMSYS1(url) {
CPP: 'cpp',
CXX: 'g++',
MAKE: 'make',
RI_DEVKIT: msys1Path,
SSL_CERT_FILE: certFile
RI_DEVKIT: msys1Path
})
})

Expand Down
Loading