Skip to content

Commit b2de090

Browse files
authored
fix: update cross-platform workflow for ARM64 support and refine unit test matrix (#15)
1 parent dcd040a commit b2de090

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.github/workflows/cross-platform.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [ubuntu-latest, macos-latest, windows-latest]
20-
version: ['23', '24', '25', 'latest']
19+
# SDK 23 introduced ARM64 on Linux and macOS (which also changed the URL format to its current form).
20+
# SDK 26 introduced Windows on ARM64.
21+
# arm64-linux, arm64-macos, arm64-windows, x86_64-linux, x86_64-macos, x86_64-windows
22+
os: [ubuntu-24.04-arm, macos-latest, windows-11-arm, ubuntu-latest, macos-15-intel, windows-latest]
23+
version: ['26', 'latest']
2124
steps:
2225
- name: Checkout
2326
uses: actions/checkout@v4

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [ubuntu-latest, macos-latest, windows-latest]
19+
os: [ubuntu-latest]
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4

install.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def calculate_version_and_tag(version: str):
5252
('30.0', 'wasi-sdk-30')
5353
>>> calculate_version_and_tag('30.10')
5454
('30.10', 'wasi-sdk-30.10')
55+
>>> latest = calculate_version_and_tag('latest')
56+
>>> float(latest[0]) > 0
57+
True
58+
>>> latest[1].startswith('wasi-sdk-')
59+
True
60+
>>> float(latest[1].removeprefix('wasi-sdk-')) > 0
61+
True
5562
"""
5663
if version == 'latest':
5764
tag = retrieve_latest_tag()
@@ -74,14 +81,22 @@ def calculate_artifact_url(version: str, tag: str, arch: str, os_name: str):
7481
'https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz'
7582
>>> calculate_artifact_url('25.1', 'wasi-sdk-25.1', 'arm64', 'Darwin')
7683
'https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25.1/wasi-sdk-25.1-arm64-macos.tar.gz'
84+
>>> calculate_artifact_url('30.0', 'wasi-sdk-30', 'aarch64', 'Linux')
85+
'https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-arm64-linux.tar.gz'
7786
"""
7887
base = 'https://github.com/WebAssembly/wasi-sdk/releases/download'
79-
if os_name == 'Darwin':
80-
os_name = 'macos'
81-
else:
82-
os_name = os_name.lower()
83-
if arch.lower() == 'amd64':
84-
arch = 'x86_64'
88+
match os_name.lower():
89+
case 'darwin':
90+
os_name = 'macos'
91+
case rest:
92+
os_name = rest
93+
match arch.lower():
94+
case 'amd64':
95+
arch = 'x86_64'
96+
case 'aarch64':
97+
arch = 'arm64'
98+
case rest:
99+
arch = rest
85100
return f'{base}/{tag}/wasi-sdk-{version}-{arch}-{os_name}.tar.gz'
86101

87102

@@ -205,7 +220,7 @@ def main(version: str, install_dir: str, add_to_path: bool):
205220
logging.getLogger().name = os.path.basename(__file__)
206221

207222
if args.test_only:
208-
failures, _ = doctest.testmod()
223+
failures, _ = doctest.testmod(verbose=args.verbose)
209224
if failures:
210225
sys.exit(1)
211226
else:

0 commit comments

Comments
 (0)