9393 - run : for i in examples/*/; do cd "$i"; cargo +stable clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings || exit 1; cd ../..; done
9494
9595 test_wasm_bindgen :
96- name : " Run wasm-bindgen crate tests (unix)"
96+ strategy :
97+ matrix :
98+ runs :
99+ - name : " wasm-bindgen"
100+ run : |
101+ cargo test --target wasm32-unknown-unknown
102+ cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
103+ - name : " wasm-bindgen (serde-serialize)"
104+ run : cargo test --target wasm32-unknown-unknown --features serde-serialize
105+ - name : " wasm-bindgen (enable-interning)"
106+ run : cargo test --target wasm32-unknown-unknown --features enable-interning
107+ name : " Run wasm-bindgen crate tests (${{ matrix.runs.name }})"
97108 runs-on : ubuntu-latest
98109 env :
99110 WASM_BINDGEN_SPLIT_LINKED_MODULES : 1
@@ -105,24 +116,7 @@ jobs:
105116 with :
106117 node-version : ' 20'
107118 - uses : ./.github/actions/setup-geckodriver
108- - run : cargo test --target wasm32-unknown-unknown
109- - run : cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
110-
111- test_wasm_bindgen_features :
112- name : " Run wasm-bindgen crate tests with different features"
113- runs-on : ubuntu-latest
114- env :
115- WASM_BINDGEN_SPLIT_LINKED_MODULES : 1
116- steps :
117- - uses : actions/checkout@v4
118- - run : rustup update --no-self-update stable && rustup default stable
119- - run : rustup target add wasm32-unknown-unknown
120- - uses : actions/setup-node@v4
121- with :
122- node-version : ' 20'
123- - uses : ./.github/actions/setup-geckodriver
124- - run : cargo test --target wasm32-unknown-unknown --features serde-serialize
125- - run : cargo test --target wasm32-unknown-unknown --features enable-interning
119+ - run : ${{ matrix.runs.run }}
126120
127121 test_wasm_bindgen_wasm :
128122 name : " Run wasm-bindgen wasm test"
@@ -141,10 +135,21 @@ jobs:
141135 WASM_BINDGEN_NO_DEBUG : 1
142136
143137 test_wasm_bindgen_envs :
144- name : " Run wasm-bindgen crate tests with various environment variables"
138+ strategy :
139+ matrix :
140+ envs :
141+ - name : " externref"
142+ env :
143+ WASM_BINDGEN_EXTERNREF : 1
144+ - name : " multi-value"
145+ env :
146+ WASM_BINDGEN_MULTI_VALUE : 1
147+ name : " Run wasm-bindgen crate tests with ${{ matrix.envs.name }} feature"
145148 runs-on : ubuntu-latest
146149 env :
147150 WASM_BINDGEN_SPLIT_LINKED_MODULES : 1
151+ WASM_BINDGEN_EXTERNREF : ${{ matrix.envs.WASM_BINDGEN_EXTERNREF }}
152+ WASM_BINDGEN_MULTI_VALUE : ${{ matrix.envs.WASM_BINDGEN_MULTI_VALUE }}
148153 steps :
149154 - uses : actions/checkout@v4
150155 - run : rustup update --no-self-update stable && rustup default stable
@@ -153,14 +158,9 @@ jobs:
153158 with :
154159 node-version : ' 20'
155160 - run : cargo test --target wasm32-unknown-unknown
156- env :
157- WASM_BINDGEN_EXTERNREF : 1
158- - run : cargo test --target wasm32-unknown-unknown
159- env :
160- WASM_BINDGEN_MULTI_VALUE : 1
161161
162162 test_threads :
163- name : " Run wasm-bindgen crate tests with multithreading enabled "
163+ name : " Run wasm-bindgen crate tests with multithreading"
164164 runs-on : ubuntu-latest
165165 steps :
166166 - uses : actions/checkout@v4
@@ -215,61 +215,44 @@ jobs:
215215 - run : cargo test -p wasm-bindgen-futures
216216 - run : cargo test -p wasm-bindgen-shared
217217
218- test_web_sys :
219- name : " Run web-sys crate tests"
220- runs-on : ubuntu-latest
221- steps :
222- - uses : actions/checkout@v4
223- - run : rustup update --no-self-update stable && rustup default stable
224- - run : rustup target add wasm32-unknown-unknown
225- - uses : actions/setup-node@v4
226- with :
227- node-version : ' 20'
228- - uses : ./.github/actions/setup-geckodriver
229- - run : cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown
230- - run : cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
231- - run : cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
232- - run : cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window
233-
234- test_web_sys_all_features :
235- name : " Run web-sys crate tests with all features"
236- runs-on : ubuntu-latest
237- steps :
238- - uses : actions/checkout@v4
239- - run : rustup update --no-self-update stable && rustup default stable
240- - run : rustup target add wasm32-unknown-unknown
241- - uses : actions/setup-node@v4
242- with :
243- node-version : ' 20'
244- - uses : ./.github/actions/setup-geckodriver
245- - run : cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
246-
247- test_web_sys_all_features_unstable :
248- name : " Run web-sys crate tests with all features and unstable APIs"
249- runs-on : ubuntu-latest
250- steps :
251- - uses : actions/checkout@v4
252- - run : rustup update --no-self-update stable && rustup default stable
253- - run : rustup target add wasm32-unknown-unknown
254- - uses : actions/setup-node@v4
255- with :
256- node-version : ' 20'
257- - uses : ./.github/actions/setup-geckodriver
258- - run : cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
259- env :
260- RUSTFLAGS : --cfg=web_sys_unstable_apis
261-
262- check_web_sys :
263- name : " Verify that web-sys is compiled correctly"
264- runs-on : ubuntu-latest
265- steps :
266- - uses : actions/checkout@v4
267- - run : rustup update --no-self-update stable && rustup default stable
268- - run : cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml
269- - run : git diff --exit-code
270-
271- test_js_sys :
272- name : " Run js-sys crate tests"
218+ test_with_geckodriver :
219+ strategy :
220+ matrix :
221+ runs :
222+ - name : " web-sys"
223+ run : |
224+ cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown
225+ cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
226+ cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
227+ cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window
228+ - name : " web-sys (all features)"
229+ run : cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
230+ - name : " web-sys (unstable, all features)"
231+ run : cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
232+ env :
233+ RUSTFLAGS : --cfg=web_sys_unstable_apis
234+ - name : " js-sys"
235+ run : cargo test -p js-sys --target wasm32-unknown-unknown
236+ - name : " js-sys (unstable)"
237+ run : cargo test -p js-sys --target wasm32-unknown-unknown
238+ env :
239+ RUSTFLAGS : --cfg=js_sys_unstable_apis
240+ - name : " wasm-bindgen-webidl"
241+ run : cargo test -p wasm-bindgen-webidl
242+ - name : " webidl-tests"
243+ run : cargo test -p webidl-tests --target wasm32-unknown-unknown
244+ env :
245+ WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE : 1
246+ - name : " webidl-tests (unstable)"
247+ run : cargo test -p webidl-tests --target wasm32-unknown-unknown
248+ env :
249+ RUSTFLAGS : --cfg=web_sys_unstable_apis
250+ - name : " typescript-tests"
251+ run : cd crates/typescript-tests && ./run.sh
252+ name : " Run ${{ matrix.runs.name }} tests (with geckodriver)"
253+ env :
254+ RUSTFLAGS : ${{ matrix.runs.env.RUSTFLAGS }}
255+ WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE : ${{ matrix.runs.env.WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE }}
273256 runs-on : ubuntu-latest
274257 steps :
275258 - uses : actions/checkout@v4
@@ -279,40 +262,7 @@ jobs:
279262 with :
280263 node-version : ' 20'
281264 - uses : ./.github/actions/setup-geckodriver
282- - run : cargo test -p js-sys --target wasm32-unknown-unknown
283- - run : cargo test -p js-sys --target wasm32-unknown-unknown
284- env :
285- RUSTFLAGS : --cfg=js_sys_unstable_apis
286-
287- test_webidl :
288- name : " Run wasm-bindgen-webidl crate tests"
289- runs-on : ubuntu-latest
290- steps :
291- - uses : actions/checkout@v4
292- - run : rustup update --no-self-update stable && rustup default stable
293- - run : rustup target add wasm32-unknown-unknown
294- - uses : actions/setup-node@v4
295- with :
296- node-version : ' 20'
297- - run : cargo test -p wasm-bindgen-webidl
298- - run : cargo test -p webidl-tests --target wasm32-unknown-unknown
299- env :
300- WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE : 1
301- - run : cargo test -p webidl-tests --target wasm32-unknown-unknown
302- env :
303- RUSTFLAGS : --cfg=web_sys_unstable_apis
304-
305- test_typescript_output :
306- name : " Test TypeScript output of wasm-bindgen"
307- runs-on : ubuntu-latest
308- steps :
309- - uses : actions/checkout@v4
310- - run : rustup update --no-self-update stable && rustup default stable
311- - run : rustup target add wasm32-unknown-unknown
312- - uses : actions/setup-node@v4
313- with :
314- node-version : ' 20'
315- - run : cd crates/typescript-tests && ./run.sh
265+ - run : ${{ matrix.runs.run }}
316266
317267 test_deno :
318268 name : " Build and test the deno example"
@@ -335,6 +285,15 @@ jobs:
335285 - run : cargo test -p wasm-bindgen-macro
336286 - run : cargo test -p wasm-bindgen-test-macro
337287
288+ build_webidl :
289+ name : " Verify that web-sys is compiled correctly"
290+ runs-on : ubuntu-latest
291+ steps :
292+ - uses : actions/checkout@v4
293+ - run : rustup update --no-self-update stable && rustup default stable
294+ - run : cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml
295+ - run : git diff --exit-code
296+
338297 build_examples :
339298 runs-on : ubuntu-latest
340299 steps :
@@ -349,14 +308,22 @@ jobs:
349308 - run : |
350309 cargo build -p wasm-bindgen-cli
351310 ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen
352- - run : mv _package.json package.json && npm install && rm package.json
311+ # crete a workspace of all examples and install their dependencies at once
312+ # sed is used to convert the literal "\n" to a newline character
353313 - run : |
354- for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet`; do
355- (cd examples/$dir &&
356- (npm run build -- --output-path ../../exbuild/$dir ||
357- (./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir && rm ../../exbuild/$dir/**/.gitignore))
314+ [ -f pnpm-workspace.yaml ] || (echo 'packages:\n - "examples/*"' > pnpm-workspace.yaml && sed -i -e 's/\\n/\n/g' pnpm-workspace.yaml)
315+ - run : |
316+ [ -f package.json ] || (echo '{}' > package.json)
317+ - run : corepack pnpm install -r
318+ - run : |
319+ function build() {
320+ (cd examples/$1 &&
321+ (corepack pnpm run build -- --output-path ../../exbuild/$1 ||
322+ (./build.sh && mkdir -p ../../exbuild/$1 && cp -r ./* ../../exbuild/$1 && rm ../../exbuild/$1/**/.gitignore))
358323 ) || exit 1;
359- done
324+ }
325+ export -f build
326+ ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet | parallel -j4 build
360327 env:
361328 RUSTFLAGS: --cfg=web_sys_unstable_apis
362329 - uses : actions/upload-artifact@v4
@@ -385,20 +352,30 @@ jobs:
385352 test_examples :
386353 needs :
387354 - build_examples
388- - build_nightly
389355 runs-on : ubuntu-latest
390356 steps :
391357 - uses : actions/checkout@v4
392358 - uses : actions/download-artifact@v4
393359 with :
394360 name : examples1
395361 path : exbuild
362+ - run : rustup update --no-self-update stable && rustup default stable
363+ - run : cargo test -p example-tests
364+ env :
365+ EXBUILD : ${{ github.workspace }}/exbuild
366+
367+ test_nightly :
368+ needs :
369+ - build_nightly
370+ runs-on : ubuntu-latest
371+ steps :
372+ - uses : actions/checkout@v4
396373 - uses : actions/download-artifact@v4
397374 with :
398375 name : examples2
399376 path : exbuild
400377 - run : rustup update --no-self-update stable && rustup default stable
401- - run : cargo test -p example-tests
378+ - run : cargo test -p example-tests --no-default-features --features nightly
402379 env :
403380 EXBUILD : ${{ github.workspace }}/exbuild
404381
0 commit comments