From f14a6bdaa1da57190e76080a0173b356e44db9ba Mon Sep 17 00:00:00 2001 From: Alessandro Cifani Date: Tue, 3 Jun 2025 12:55:40 +0200 Subject: [PATCH 1/2] fix: bynarien arch detection bynarien uses `aarch64` instead of `arm64` for linux dists # Conflicts: # dist/index.js --- .github/workflows/validate.yml | 17 +++++++++++------ dist/index.js | 13 ++++++++++--- src/binaryen/install.ts | 2 +- src/binaryen/sys.ts | 11 +++++++++-- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8cd9edc..b8d438f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -12,19 +12,24 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - tinygo: ['0.33.0', '0.34.0', '0.35.0'] + os: + - macos-latest + - ubuntu-latest + - ubuntu-24.04-arm + - windows-latest + - windows-11-arm + tinygo: ['0.36.0', '0.37.0'] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.23' + go-version: '1.24' - name: setup-tinygo ${{ matrix.tinygo }} uses: ./ with: tinygo-version: ${{ matrix.tinygo }} - binaryen-version: '121' + binaryen-version: '122' - name: Verify version run: ./check-version.sh ${{ matrix.tinygo }} @@ -43,12 +48,12 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.23' + go-version: '1.24' - name: setup-tinygo uses: ./ with: - tinygo-version: '0.35.0' + tinygo-version: '0.37.0' install-binaryen: 'false' - name: Binaryen not installed diff --git a/dist/index.js b/dist/index.js index 57ccf5f..7c9cb79 100644 --- a/dist/index.js +++ b/dist/index.js @@ -51,8 +51,8 @@ const path_1 = __importDefault(__nccwpck_require__(928)); const utils_1 = __nccwpck_require__(277); const sys_1 = __nccwpck_require__(774); const toolName = 'binaryen'; -const arch = (0, sys_1.getArch)(); const platform = (0, sys_1.getPlatform)(); +const arch = (0, sys_1.getArch)(platform); async function installBinaryen(version) { const installPath = await extract(version); return addToPath(installPath, version); @@ -118,9 +118,16 @@ function getPlatform() { const platform = os_1.default.platform(); return platformMap[platform] ?? platform; } -function getArch() { +function getArch(platform) { const arch = os_1.default.arch(); - return arch === 'x64' ? 'x86_64' : arch; + switch (arch) { + case 'arm64': + return platform === 'linux' ? 'aarch64' : 'arm64'; + case 'x64': + return 'x86_64'; + default: + return arch; + } } diff --git a/src/binaryen/install.ts b/src/binaryen/install.ts index e949333..112f84b 100644 --- a/src/binaryen/install.ts +++ b/src/binaryen/install.ts @@ -6,8 +6,8 @@ import { printCommand } from '../utils'; import { getArch, getPlatform } from './sys'; const toolName = 'binaryen'; -const arch = getArch(); const platform = getPlatform(); +const arch = getArch(platform); export async function installBinaryen(version: string): Promise { const installPath = await extract(version); diff --git a/src/binaryen/sys.ts b/src/binaryen/sys.ts index 25625be..893a99b 100644 --- a/src/binaryen/sys.ts +++ b/src/binaryen/sys.ts @@ -10,7 +10,14 @@ export function getPlatform(): string { return platformMap[platform] ?? platform; } -export function getArch(): string { +export function getArch(platform: string): string { const arch = os.arch(); - return arch === 'x64' ? 'x86_64' : arch; + switch (arch) { + case 'arm64': + return platform === 'linux' ? 'aarch64' : 'arm64'; + case 'x64': + return 'x86_64'; + default: + return arch; + } } From c886e158a6dea50bf22d757c6888520d693dc7d5 Mon Sep 17 00:00:00 2001 From: Alessandro Cifani Date: Tue, 3 Jun 2025 14:09:38 +0200 Subject: [PATCH 2/2] ci: disable windows-11-arm --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b8d438f..c3bff85 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,7 +17,7 @@ jobs: - ubuntu-latest - ubuntu-24.04-arm - windows-latest - - windows-11-arm + # - windows-11-arm - Binaryen does not provide binaries for Windows on ARM as of v123 tinygo: ['0.36.0', '0.37.0'] steps: - uses: actions/checkout@v4 @@ -29,7 +29,7 @@ jobs: uses: ./ with: tinygo-version: ${{ matrix.tinygo }} - binaryen-version: '122' + binaryen-version: '123' - name: Verify version run: ./check-version.sh ${{ matrix.tinygo }}