-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
700 lines (659 loc) · 26.6 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
name: CI
on:
push:
branches: [main]
tags-ignore: [dev]
pull_request:
branches: [main]
workflow_dispatch:
defaults:
run:
shell: bash
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
# Check Code style quickly by running `rustfmt` over all code
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
# Check TOML style by using Taplo.
taplo:
name: Taplo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: taplo-cli
- run: taplo fmt --check
# Run `cargo check` over everything
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo check --all
- run: cargo check --no-default-features
# Run `cargo clippy` over everything
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli-support -- -D warnings
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-interpreter -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings
- run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings
# Run `cargo clippy` over web-sys and js-sys crates
clippy_web_sys:
name: Clippy (web-sys)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys --all-targets -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys --all-targets -- -D warnings
# Run `cargo clippy` over crates that support `no_std`
clippy_no_std:
name: Clippy `no_std`
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings
# Run `cargo clippy` over crates that support `no_std` with `target_feature = "atomics"` support.
clippy_no_std_atomics:
name: Clippy `no_std` with `atomics`
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory
steps:
- uses: actions/checkout@v4
- run: rustup default nightly-2024-07-06
- run: rustup target add wasm32-unknown-unknown
- run: rustup component add clippy rust-src
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen -Zbuild-std=core,alloc -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p js-sys -Zbuild-std=core,alloc -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p web-sys -Zbuild-std=core,alloc -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -Zbuild-std=core,alloc -- -D warnings
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -p wasm-bindgen-test -Zbuild-std=core,alloc -- -D warnings
# Run `cargo clippy` over the project
clippy_project:
name: Clippy (project)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings
- 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
test_wasm_bindgen:
strategy:
matrix:
runs:
- name: "wasm-bindgen"
run: |
cargo test --target wasm32-unknown-unknown
cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
- name: "wasm-bindgen (serde-serialize)"
run: cargo test --target wasm32-unknown-unknown --features serde-serialize
- name: "wasm-bindgen (enable-interning)"
run: cargo test --target wasm32-unknown-unknown --features enable-interning
name: "Run wasm-bindgen crate tests (${{ matrix.runs.name }})"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: ${{ matrix.runs.run }}
test_wasm_bindgen_wasm:
name: "Run wasm-bindgen wasm test"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: cargo test --target wasm32-unknown-unknown --test wasm
env:
WASM_BINDGEN_NO_DEBUG: 1
test_wasm_bindgen_envs:
strategy:
matrix:
envs:
- name: "externref"
env:
WASM_BINDGEN_EXTERNREF: 1
- name: "multi-value"
env:
WASM_BINDGEN_MULTI_VALUE: 1
name: "Run wasm-bindgen crate tests with ${{ matrix.envs.name }} feature"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
WASM_BINDGEN_EXTERNREF: ${{ matrix.envs.WASM_BINDGEN_EXTERNREF }}
WASM_BINDGEN_MULTI_VALUE: ${{ matrix.envs.WASM_BINDGEN_MULTI_VALUE }}
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: cargo test --target wasm32-unknown-unknown
test_threads:
name: "Run wasm-bindgen crate tests with multithreading"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup default nightly-2024-07-06
- run: rustup target add wasm32-unknown-unknown
- run: rustup component add rust-src
- run: |
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
cargo test --target wasm32-unknown-unknown -Z build-std=std,panic_abort
# I don't know why this is failing so comment this out for now, but ideally
# this would be figured out at some point and solved.
# test_wasm_bindgen_windows:
# name: "Run wasm-bindgen crate tests (Windows)"
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
# - run: rustup update --no-self-update stable && rustup default stable
# - run: rustup target add wasm32-unknown-unknown
# - uses: actions/setup-node@v4
# with:
# node-version: '20'
# - uses: ./.github/actions/setup-geckodriver
# - run: cargo test --target wasm32-unknown-unknown
# env:
# RUST_LOG: wasm_bindgen_test_runner
# GECKODRIVER_ARGS: --log trace
# - run: cargo test --target wasm32-unknown-unknown -p js-sys
# - run: cargo test --target wasm32-unknown-unknown -p webidl-tests
# env:
# WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1
# - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features "Node Window Document"
# This checks that the output of the CLI is actually valid JavaScript and TypeScript
test_cli_reference_typescript:
name: Run CLI reference TypeScript check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm i -g typescript
- run: npm i --save @types/node @types/deno
- name: Check TypeScript output
run: tsc --noEmit --skipLibCheck --lib esnext,dom $(echo crates/cli/tests/reference/*.d.ts)
- name: Check JavaScript output
run: tsc --noEmit --skipLibCheck --lib esnext,dom --module esnext --allowJs $(echo crates/cli/tests/reference/*.js)
test_native:
name: Run native tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo test
- run: cargo test -p wasm-bindgen-cli-support
- run: cargo test -p wasm-bindgen-cli
- run: cargo test -p wasm-bindgen-externref-xform
- run: cargo test -p wasm-bindgen-macro-support
- run: cargo test -p wasm-bindgen-multi-value-xform
- run: cargo test -p wasm-bindgen-wasm-interpreter
- run: cargo test -p wasm-bindgen-futures
- run: cargo test -p wasm-bindgen-shared
test_with_geckodriver:
strategy:
matrix:
runs:
- name: "web-sys"
run: |
cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown
cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window
- name: "web-sys (all features)"
run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
- name: "web-sys (unstable, all features)"
run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
- name: "js-sys"
run: cargo test -p js-sys --target wasm32-unknown-unknown
- name: "js-sys (unstable)"
run: cargo test -p js-sys --target wasm32-unknown-unknown
env:
RUSTFLAGS: --cfg=js_sys_unstable_apis
- name: "wasm-bindgen-webidl"
run: cargo test -p wasm-bindgen-webidl
- name: "webidl-tests"
run: cargo test -p webidl-tests --target wasm32-unknown-unknown
env:
WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1
- name: "webidl-tests (unstable)"
run: cargo test -p webidl-tests --target wasm32-unknown-unknown
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
- name: "typescript-tests"
run: cd crates/typescript-tests && ./run.sh
name: "Run ${{ matrix.runs.name }} tests (with geckodriver)"
env:
RUSTFLAGS: ${{ matrix.runs.env.RUSTFLAGS }}
WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: ${{ matrix.runs.env.WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: ${{ matrix.runs.run }}
test_deno:
name: "Build and test the deno example"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
- run: cd examples/deno && ./build.sh && deno run --allow-read test.ts
test_ui:
name: Run UI compile-fail tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update 1.78.0 && rustup default 1.78.0
- run: cargo test -p wasm-bindgen-macro
- run: cargo test -p wasm-bindgen-test-macro
build_webidl:
name: "Verify that web-sys is compiled correctly"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml
- run: git diff --exit-code
build_examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
- run: |
cargo build -p wasm-bindgen-cli
ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen
# crete a workspace of all examples and install their dependencies at once
# sed is used to convert the literal "\n" to a newline character
- run: |
[ -f pnpm-workspace.yaml ] || (echo 'packages:\n - "examples/*"' > pnpm-workspace.yaml && sed -i -e 's/\\n/\n/g' pnpm-workspace.yaml)
- run: |
[ -f package.json ] || (echo '{}' > package.json)
- run: corepack pnpm install -r
- run: |
function build() {
(cd examples/$1 &&
(corepack pnpm run build -- --output-path ../../exbuild/$1 ||
(./build.sh && mkdir -p ../../exbuild/$1 && cp -r ./* ../../exbuild/$1 && rm ../../exbuild/$1/**/.gitignore))
) || exit 1;
}
export -f build
ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet | parallel -j4 build
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
- uses: actions/upload-artifact@v4
with:
name: examples1
path: exbuild
build_nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly-2024-07-06
- run: rustup target add wasm32-unknown-unknown
- run: rustup component add rust-src
- run: |
for dir in raytrace-parallel wasm-audio-worklet; do
(cd examples/$dir &&
./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir
) || exit 1;
done
- uses: actions/upload-artifact@v4
with:
name: examples2
path: exbuild
test_examples:
needs:
- build_examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: examples1
path: exbuild
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo test -p example-tests
env:
EXBUILD: ${{ github.workspace }}/exbuild
test_nightly:
needs:
- build_nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: examples2
path: exbuild
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo test -p example-tests --no-default-features --features nightly
env:
EXBUILD: ${{ github.workspace }}/exbuild
build_benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown
- run: cargo run -p wasm-bindgen-cli -- target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm --out-dir benchmarks/pkg --target web
- uses: actions/upload-artifact@v4
with:
name: benchmarks
path: benchmarks
dist_linux_x86_64_musl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add x86_64-unknown-linux-musl
- run: sudo apt update -y && sudo apt install musl-tools -y
- run: |
cargo build --manifest-path crates/cli/Cargo.toml --target x86_64-unknown-linux-musl --features vendored-openssl --release
strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen
strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen-test-runner
strip -g target/x86_64-unknown-linux-musl/release/wasm2es6js
- uses: actions/upload-artifact@v4
with:
name: dist_linux_x86_64_musl
path: "target/x86_64-unknown-linux-musl/release/wasm*"
dist_linux_aarch64_gnu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add aarch64-unknown-linux-gnu
- run: sudo apt update -y && sudo apt install gcc-aarch64-linux-gnu -y
- run: |
cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-gnu --features vendored-openssl --release
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- uses: actions/upload-artifact@v4
with:
name: dist_linux_aarch64_gnu
path: "target/aarch64-unknown-linux-gnu/release/wasm*"
dist_macos_x86_64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add x86_64-apple-darwin
- run: cargo build --manifest-path crates/cli/Cargo.toml --target x86_64-apple-darwin --release
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
- uses: actions/upload-artifact@v4
with:
name: dist_macos_x86_64
path: "target/x86_64-apple-darwin/release/wasm*"
dist_macos_aarch64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: |
cargo build --manifest-path crates/cli/Cargo.toml --release
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
- uses: actions/upload-artifact@v4
with:
name: dist_macos_aarch64
path: "target/release/wasm*"
dist_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo build --manifest-path crates/cli/Cargo.toml --release
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
- uses: actions/upload-artifact@v4
with:
name: dist_windows
path: "target/release/wasm*"
doc_book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
echo $PWD >> $GITHUB_PATH
- run: (cd guide && mdbook build)
- uses: actions/upload-artifact@v4
with:
name: doc_book
path: guide/book/html
doc_api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update nightly && rustup default nightly
- run: cargo doc --no-deps --features 'serde-serialize'
- run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml
- run: cargo doc --no-deps --manifest-path crates/web-sys/Cargo.toml --all-features
env:
RUSTDOCFLAGS: --cfg=web_sys_unstable_apis
- run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml --all-features
env:
RUSTDOCFLAGS: --cfg=docsrs
- run: tar czvf docs.tar.gz target/doc
- uses: actions/upload-artifact@v4
with:
name: doc_api
path: docs.tar.gz
msrv-resolver:
name: Check feature resolver version 1 compatibility
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- 1.57
- stable
target:
- x86_64-unknown-linux-gnu
- wasm32-unknown-unknown
features:
- --no-default-features
- --no-default-features --features std
- --no-default-features --features msrv
- ""
defaults:
run:
working-directory: crates/msrv/resolver
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }}
- if: matrix.rust == '1.57'
run: |
cargo update -p bumpalo --precise 3.12.0
cargo update -p log --precise 0.4.18
- run: cargo build --target ${{ matrix.target }} ${{ matrix.features }}
msrv-lib:
name: Check MSRV for libraries
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- wasm32-unknown-unknown
features:
- --no-default-features
- --no-default-features --features std
- --no-default-features --features msrv
- ""
defaults:
run:
working-directory: crates/msrv/lib
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update 1.57 && rustup default 1.57 && rustup target add ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }} ${{ matrix.features }}
msrv-cli:
name: Check MSRV for CLI tools
runs-on: ubuntu-latest
defaults:
run:
working-directory: crates/msrv/cli
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update 1.76 && rustup default 1.76
- run: cargo build
deploy:
permissions:
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
if: github.repository == 'rustwasm/wasm-bindgen'
needs:
- doc_api
- doc_book
- dist_linux_x86_64_musl
- dist_linux_aarch64_gnu
- dist_macos_x86_64
- dist_macos_aarch64
- dist_windows
- build_examples
- build_nightly
- build_benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
path: artifacts
- run: find artifacts
- run: |
set -ex
mkdir -p gh-release
tag=`git describe --tags`
mk() {
target=$1
src=$2
name=wasm-bindgen-$tag-$target
mkdir -p tmp/$name
rm -f artifacts/$src/*.d
rm -f artifacts/$src/*.pdb
cp README.md \
LICENSE-MIT \
LICENSE-APACHE \
artifacts/$src/wasm* \
tmp/$name/
chmod +x tmp/$name/wasm*
tar czvf gh-release/$name.tar.gz -C tmp $name
sha256sum gh-release/$name.tar.gz > gh-release/$name.tar.gz.sha256sum
}
mk x86_64-unknown-linux-musl dist_linux_x86_64_musl
mk aarch64-unknown-linux-gnu dist_linux_aarch64_gnu
mk x86_64-apple-darwin dist_macos_x86_64
mk aarch64-apple-darwin dist_macos_aarch64
mk x86_64-pc-windows-msvc dist_windows
- uses: actions/upload-artifact@v4
with:
name: gh-release
path: gh-release
- run: |
mv artifacts/doc_book gh-pages
tar xf artifacts/doc_api/docs.tar.gz
mv target/doc gh-pages/api
mv artifacts/examples1 gh-pages/exbuild
mv artifacts/examples2/* gh-pages/exbuild
mv artifacts/benchmarks gh-pages/benchmarks
tar czf gh-pages.tar.gz gh-pages
- uses: actions/upload-artifact@v4
with:
name: gh-pages
path: gh-pages.tar.gz
- uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: gh-pages
single-commit: true
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "gh-release/*.tar.gz*"
- uses: dtolnay/rust-toolchain@stable
if: startsWith(github.ref, 'refs/tags/')
- run: rustc publish.rs
if: startsWith(github.ref, 'refs/tags/')
- run: ./publish publish
if: startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_PUBLISH_TOKEN }}