From fbaef136828f75c08f5f5db5f3f289ee30044a4e Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 18 Jan 2025 13:28:08 +0100 Subject: [PATCH] Add support for ubuntu-22.04-arm64 and ubuntu-24.04-arm64 --- .github/workflows/test.yml | 11 ++++++++++- common.js | 2 ++ dist/index.js | 14 +++++++++++++- ruby-builder.js | 12 +++++++++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54dcd992e..49a38f089 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, ubuntu-24.04, macos-13, macos-14, macos-15, windows-2019, windows-2022, windows-2025 ] + os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm, macos-13, macos-14, macos-15, windows-2019, windows-2022, windows-2025 ] 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', ruby-head, jruby, jruby-head, @@ -54,6 +54,15 @@ jobs: - { 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' } # Windows (note: previews are not available on Windows) - { os: windows-2019, ruby: '1.9' } - { os: windows-2022, ruby: '1.9' } diff --git a/common.js b/common.js index b9ff6138d..d6d5b40f8 100644 --- a/common.js +++ b/common.js @@ -165,7 +165,9 @@ export async function hashFile(file) { const GitHubHostedPlatforms = [ 'ubuntu-20.04-x64', 'ubuntu-22.04-x64', + 'ubuntu-22.04-arm64', 'ubuntu-24.04-x64', + 'ubuntu-24.04-arm64', 'windows-2019-x64', 'windows-2022-x64', 'windows-2025-x64', diff --git a/dist/index.js b/dist/index.js index 9348d7f05..0f8eafdd8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -484,7 +484,9 @@ async function hashFile(file) { const GitHubHostedPlatforms = [ 'ubuntu-20.04-x64', 'ubuntu-22.04-x64', + 'ubuntu-22.04-arm64', 'ubuntu-24.04-x64', + 'ubuntu-24.04-arm64', 'windows-2019-x64', 'windows-2022-x64', 'windows-2025-x64', @@ -74085,7 +74087,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { } function getDownloadURL(platform, engine, version) { - let builderPlatform = platform + let builderPlatform = null if (platform.startsWith('windows-') && os.arch() === 'x64') { builderPlatform = 'windows-latest' } else if (platform.startsWith('macos-')) { @@ -74094,6 +74096,16 @@ function getDownloadURL(platform, engine, version) { } else if (os.arch() === 'arm64') { builderPlatform = 'macos-13-arm64' } + } else if (platform.startsWith('ubuntu-')) { + if (os.arch() === 'x64') { + builderPlatform = platform + } else if (os.arch() === 'arm64') { + builderPlatform = `${platform}-arm64` + } + } + + if (builderPlatform === null) { + throw new Error(`Unknown download URL for platform ${platform}`) } if (common.isHeadVersion(version)) { diff --git a/ruby-builder.js b/ruby-builder.js index dcafe620c..985ad2c86 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -91,7 +91,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { } function getDownloadURL(platform, engine, version) { - let builderPlatform = platform + let builderPlatform = null if (platform.startsWith('windows-') && os.arch() === 'x64') { builderPlatform = 'windows-latest' } else if (platform.startsWith('macos-')) { @@ -100,6 +100,16 @@ function getDownloadURL(platform, engine, version) { } else if (os.arch() === 'arm64') { builderPlatform = 'macos-13-arm64' } + } else if (platform.startsWith('ubuntu-')) { + if (os.arch() === 'x64') { + builderPlatform = platform + } else if (os.arch() === 'arm64') { + builderPlatform = `${platform}-arm64` + } + } + + if (builderPlatform === null) { + throw new Error(`Unknown download URL for platform ${platform}`) } if (common.isHeadVersion(version)) {