From 5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 11 Oct 2023 17:21:51 +0200 Subject: [PATCH] Add support for macos-13-arm64 GitHub runners --- .github/workflows/test.yml | 19 +++++++++++++++++-- README.md | 2 +- common.js | 3 ++- dist/index.js | 11 ++++++++--- ruby-builder.js | 8 ++++++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 381c7b08b..8aca63cdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, macos-13, windows-2019, windows-2022 ] + os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, macos-13, macos-arm-oss, 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', '3.2', '3.3', ruby-head, jruby, jruby-head, @@ -31,7 +31,22 @@ jobs: - { os: windows-2022, ruby: mswin } - { os: windows-2022, ruby: ucrt } exclude: - - { os: ubuntu-22.04, ruby: '2.2' } # https://github.com/ruby/setup-ruby/issues/496 + # https://github.com/ruby/setup-ruby/issues/496 + - { os: ubuntu-22.04, ruby: '2.2' } + # Too old, fails to compile on macos-arm-oss + - { os: macos-arm-oss, ruby: '1.9' } + - { os: macos-arm-oss, ruby: '2.0' } + - { os: macos-arm-oss, ruby: '2.1' } + - { os: macos-arm-oss, ruby: '2.2' } + - { os: macos-arm-oss, ruby: '2.3' } + - { os: macos-arm-oss, ruby: '2.4' } + - { os: macos-arm-oss, ruby: '2.5' } + # Fails to compile on macos-arm-oss, https://github.com/ruby/setup-ruby/pull/494#issuecomment-1758099885 + - { os: macos-arm-oss, ruby: '3.1' } + # No Java available yet on macos-arm-oss images + - { os: macos-arm-oss, ruby: 'jruby' } + - { os: macos-arm-oss, ruby: 'jruby-head' } + # Windows - { os: windows-2019, ruby: '1.9' } - { os: windows-2019, ruby: '3.3' } - { os: windows-2019, ruby: debug } diff --git a/README.md b/README.md index 58e2e56ea..2578674e4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The action works on these [GitHub-hosted runners](https://docs.github.com/en/act | Operating System | Supported | | ---------------- | --------- | | Ubuntu | `ubuntu-20.04`, `ubuntu-22.04` | -| macOS | `macos-11`, `macos-12`, `macos-13` | +| macOS | `macos-11`, `macos-12`, `macos-13`, `macos-13-xlarge` (arm64) | | Windows | `windows-2019`, `windows-2022` | The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder) diff --git a/common.js b/common.js index 6f63f49cf..0ba132033 100644 --- a/common.js +++ b/common.js @@ -168,6 +168,7 @@ const GitHubHostedPlatforms = [ 'macos-11-x64', 'macos-12-x64', 'macos-13-x64', + 'macos-13-arm64', 'windows-2019-x64', 'windows-2022-x64', ] @@ -243,7 +244,7 @@ export function getToolCachePath() { return getRunnerToolCache() } else { // Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE - // so use that path is not isSelfHostedRunner() + // so use that path if not isSelfHostedRunner() return getDefaultToolCachePath() } } diff --git a/dist/index.js b/dist/index.js index 70fc65cf7..c32f1b40a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -528,6 +528,7 @@ const GitHubHostedPlatforms = [ 'macos-11-x64', 'macos-12-x64', 'macos-13-x64', + 'macos-13-arm64', 'windows-2019-x64', 'windows-2022-x64', ] @@ -603,7 +604,7 @@ function getToolCachePath() { return getRunnerToolCache() } else { // Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE - // so use that path is not isSelfHostedRunner() + // so use that path if not isSelfHostedRunner() return getDefaultToolCachePath() } } @@ -65053,10 +65054,14 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { function getDownloadURL(platform, engine, version) { let builderPlatform = platform - if (platform.startsWith('windows-')) { + if (platform.startsWith('windows-') && os.arch() === 'x64') { builderPlatform = 'windows-latest' } else if (platform.startsWith('macos-')) { - builderPlatform = 'macos-latest' + if (os.arch() === 'x64') { + builderPlatform = 'macos-latest' + } else if (os.arch() === 'arm64') { + builderPlatform = 'macos-13-arm64' + } } if (common.isHeadVersion(version)) { diff --git a/ruby-builder.js b/ruby-builder.js index 8e7f46665..b71483aa0 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -101,10 +101,14 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { function getDownloadURL(platform, engine, version) { let builderPlatform = platform - if (platform.startsWith('windows-')) { + if (platform.startsWith('windows-') && os.arch() === 'x64') { builderPlatform = 'windows-latest' } else if (platform.startsWith('macos-')) { - builderPlatform = 'macos-latest' + if (os.arch() === 'x64') { + builderPlatform = 'macos-latest' + } else if (os.arch() === 'arm64') { + builderPlatform = 'macos-13-arm64' + } } if (common.isHeadVersion(version)) {