Skip to content

Commit ee1d6fd

Browse files
authored
test: fix wasm test on Windows (#3145)
* fix wasm test on windows * test not rely lint python
1 parent b21cf87 commit ee1d6fd

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/tests.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ jobs:
8888
npm test
8989
9090
tests:
91-
# lint-python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
92-
needs: [lint-python]
9391
strategy:
9492
fail-fast: false
9593
max-parallel: 11
@@ -101,14 +99,18 @@ jobs:
10199
- os: macos-13
102100
python: "3.13"
103101
node: 23.x
104-
- os: ubuntu-24.04-arm
102+
- os: ubuntu-24.04-arm
105103
python: "3.13"
106104
node: 23.x
107105
- os: windows-2025
108106
python: "3.13"
109107
node: 23.x
110108
name: ${{ matrix.os }} - ${{ matrix.python }} - ${{ matrix.node }}
111109
runs-on: ${{ matrix.os }}
110+
env:
111+
WASI_VERSION: '25'
112+
WASI_VERSION_FULL: '25.0'
113+
WASI_SDK_PATH: 'wasi-sdk-25.0'
112114
steps:
113115
- name: Checkout Repository
114116
uses: actions/checkout@v4
@@ -123,6 +125,13 @@ jobs:
123125
env:
124126
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
125127
- uses: seanmiddleditch/gha-setup-ninja@v6
128+
- name: Install wasi-sdk (Windows)
129+
shell: pwsh
130+
if: runner.os == 'Windows'
131+
run: |
132+
Start-BitsTransfer -Source https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${env:WASI_VERSION}/wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz
133+
New-Item -ItemType Directory -Path ${env:WASI_SDK_PATH}
134+
tar -zxvf wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz -C ${env:WASI_SDK_PATH} --strip 1
126135
- name: Install Dependencies
127136
run: |
128137
npm install

test/test-windows-make.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ function getEnv (target) {
4646
env.CC_target = 'emcc'
4747
env.CXX_target = 'em++'
4848
} else if (target === 'wasi') {
49+
if (!process.env.WASI_SDK_PATH) return env
4950
env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))
5051
env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))
5152
env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))
5253
} else if (target === 'wasm') {
54+
if (!process.env.WASI_SDK_PATH) return env
5355
env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))
5456
env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))
5557
env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))
@@ -72,16 +74,17 @@ function quote (path) {
7274
if (path.includes(' ')) {
7375
return `"${path}"`
7476
}
77+
return path
7578
}
7679

7780
describe('windows-cross-compile', function () {
7881
it('build simple node-api addon', async function () {
7982
if (process.platform !== 'win32') {
80-
return this.skip('This test is only for windows')
83+
return this.skip('This test is only for Windows')
8184
}
82-
const env = getEnv('win-clang')
85+
const env = getEnv('wasm')
8386
if (!gracefulFs.existsSync(env.CC_target)) {
84-
return this.skip('Visual Studio Clang is not installed')
87+
return this.skip('CC_target does not exist')
8588
}
8689

8790
// handle bash whitespace

0 commit comments

Comments
 (0)