Skip to content
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
17 changes: 11 additions & 6 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 - Binaryen does not provide binaries for Windows on ARM as of v123
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: '123'

- name: Verify version
run: ./check-version.sh ${{ matrix.tinygo }}
Expand All @@ -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
Expand Down
13 changes: 10 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/binaryen/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const installPath = await extract(version);
Expand Down
11 changes: 9 additions & 2 deletions src/binaryen/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Loading