Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows - Add support for ucrt & Windows-2022 image #224

Merged
merged 15 commits into from
Jan 13, 2022
Merged
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
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ]
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019, windows-2022 ]
ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
include:
- { os: windows-2016, ruby: mingw }
- { os: windows-2019, ruby: mingw }
- { os: windows-2019, ruby: mswin }
- { os: windows-2022, ruby: mingw }
- { os: windows-2022, ruby: ucrt }
exclude:
- { os: windows-2016, ruby: 1.9 }
- { os: windows-2016, ruby: debug }
Expand All @@ -34,6 +36,12 @@ jobs:
- { os: windows-2019, ruby: truffleruby-head }
- { os: windows-2019, ruby: truffleruby+graalvm }
- { os: windows-2019, ruby: truffleruby+graalvm-head }
- { os: windows-2022, ruby: 1.9 }
- { os: windows-2022, ruby: debug }
- { os: windows-2022, ruby: truffleruby }
- { os: windows-2022, ruby: truffleruby-head }
- { os: windows-2022, ruby: truffleruby+graalvm }
- { os: windows-2022, ruby: truffleruby+graalvm-head }

name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
Expand Down
16 changes: 14 additions & 2 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function measure(name, block) {
}

export function isHeadVersion(rubyVersion) {
return rubyVersion === 'head' || rubyVersion === 'debug' || rubyVersion === 'mingw' || rubyVersion === 'mswin'
return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
}

export function isStableVersion(rubyVersion) {
Expand Down Expand Up @@ -155,7 +155,15 @@ export function win2nix(path) {
return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
}

// JRuby is installed after setupPath is called, so folder doesn't exist
function rubyIsUCRT(path) {
return !!(fs.existsSync(path) &&
fs.readdirSync(path, { withFileTypes: true }).find(dirent =>
dirent.isFile() && dirent.name.match(/^x64-ucrt-ruby\d{3}\.dll$/)))
}

export function setupPath(newPathEntries) {
let win_build_sys = null
const envPath = windows ? 'Path' : 'PATH'
const originalPath = process.env[envPath].split(path.delimiter)
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
Expand All @@ -176,8 +184,11 @@ export function setupPath(newPathEntries) {
// Then add new path entries using core.addPath()
let newPath
if (windows) {
// main Ruby dll determines whether mingw or ucrt build
win_build_sys = rubyIsUCRT(newPathEntries[0]) ? 'ucrt64' : 'mingw64'

// add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain
const msys2 = ['C:\\msys64\\mingw64\\bin', 'C:\\msys64\\usr\\bin']
const msys2 = [`C:\\msys64\\${win_build_sys}\\bin`, 'C:\\msys64\\usr\\bin']
newPath = [...newPathEntries, ...msys2]
} else {
newPath = newPathEntries
Expand All @@ -189,4 +200,5 @@ export function setupPath(newPathEntries) {
core.endGroup()

core.addPath(newPath.join(path.delimiter))
return win_build_sys
}
Loading