Skip to content

test: fix wasm test on Windows #3145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 19, 2025
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
15 changes: 12 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ jobs:
npm test

tests:
# lint-python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
needs: [lint-python]
strategy:
fail-fast: false
max-parallel: 11
Expand All @@ -101,14 +99,18 @@ jobs:
- os: macos-13
python: "3.13"
node: 23.x
- os: ubuntu-24.04-arm
- os: ubuntu-24.04-arm
python: "3.13"
node: 23.x
- os: windows-2025
python: "3.13"
node: 23.x
name: ${{ matrix.os }} - ${{ matrix.python }} - ${{ matrix.node }}
runs-on: ${{ matrix.os }}
env:
WASI_VERSION: '25'
WASI_VERSION_FULL: '25.0'
WASI_SDK_PATH: 'wasi-sdk-25.0'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -123,6 +125,13 @@ jobs:
env:
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
- uses: seanmiddleditch/gha-setup-ninja@v6
- name: Install wasi-sdk (Windows)
shell: pwsh
if: runner.os == 'Windows'
run: |
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
New-Item -ItemType Directory -Path ${env:WASI_SDK_PATH}
tar -zxvf wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz -C ${env:WASI_SDK_PATH} --strip 1
- name: Install Dependencies
run: |
npm install
Expand Down
9 changes: 6 additions & 3 deletions test/test-windows-make.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ function getEnv (target) {
env.CC_target = 'emcc'
env.CXX_target = 'em++'
} else if (target === 'wasi') {
if (!process.env.WASI_SDK_PATH) return env
env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))
env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))
env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))
} else if (target === 'wasm') {
if (!process.env.WASI_SDK_PATH) return env
env.AR_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('ar'))
env.CC_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang'))
env.CXX_target = path.resolve(__dirname, '..', process.env.WASI_SDK_PATH, 'bin', executable('clang++'))
Expand All @@ -72,16 +74,17 @@ function quote (path) {
if (path.includes(' ')) {
return `"${path}"`
}
return path
}

describe('windows-cross-compile', function () {
it('build simple node-api addon', async function () {
if (process.platform !== 'win32') {
return this.skip('This test is only for windows')
return this.skip('This test is only for Windows')
}
const env = getEnv('win-clang')
const env = getEnv('wasm')
if (!gracefulFs.existsSync(env.CC_target)) {
return this.skip('Visual Studio Clang is not installed')
return this.skip('CC_target does not exist')
}

// handle bash whitespace
Expand Down
Loading