| 1 |
name: CI |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: [main] |
| 5 |
tags-ignore: [dev] |
| 6 |
pull_request: |
| 7 |
branches: [main] |
| 8 |
defaults: |
| 9 |
run: |
| 10 |
shell: bash |
| 11 |
|
| 12 |
# Cancel any in-flight jobs for the same PR/branch so there's only one active |
| 13 |
# at a time |
| 14 |
concurrency: |
| 15 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 16 |
cancel-in-progress: true |
| 17 |
|
| 18 |
permissions: |
| 19 |
contents: read # to fetch code (actions/checkout) |
| 20 |
|
| 21 |
jobs: |
| 22 |
# Check Code style quickly by running `rustfmt` over all code |
| 23 |
rustfmt: |
| 24 |
name: Rustfmt |
| 25 |
runs-on: ubuntu-latest |
| 26 |
steps: |
| 27 |
- uses: actions/checkout@v4 |
| 28 |
- run: rustup update --no-self-update stable && rustup default stable |
| 29 |
- run: rustup component add rustfmt |
| 30 |
- run: cargo fmt --all -- --check |
| 31 |
|
| 32 |
# Run `cargo check` over everything |
| 33 |
check: |
| 34 |
name: Check |
| 35 |
runs-on: ubuntu-latest |
| 36 |
steps: |
| 37 |
- uses: actions/checkout@v4 |
| 38 |
- run: rustup update --no-self-update stable && rustup default stable |
| 39 |
- run: cargo check --all |
| 40 |
|
| 41 |
# Run `cargo clippy` over everything |
| 42 |
clippy: |
| 43 |
name: Clippy |
| 44 |
runs-on: ubuntu-latest |
| 45 |
steps: |
| 46 |
- uses: actions/checkout@v4 |
| 47 |
- run: rustup update --no-self-update stable && rustup default stable |
| 48 |
- run: rustup target add wasm32-unknown-unknown |
| 49 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings |
| 50 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli -- -D warnings |
| 51 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli-support -- -D warnings |
| 52 |
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings |
| 53 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings |
| 54 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings |
| 55 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings |
| 56 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings |
| 57 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings |
| 58 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings |
| 59 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings |
| 60 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings |
| 61 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings |
| 62 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings |
| 63 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings |
| 64 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings |
| 65 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-interpreter -- -D warnings |
| 66 |
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings |
| 67 |
- run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings |
| 68 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings |
| 69 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings |
| 70 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings |
| 71 |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings |
| 72 |
- 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 |
| 73 |
|
| 74 |
test_wasm_bindgen: |
| 75 |
name: "Run wasm-bindgen crate tests (unix)" |
| 76 |
runs-on: ubuntu-latest |
| 77 |
env: |
| 78 |
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 |
| 79 |
steps: |
| 80 |
- uses: actions/checkout@v4 |
| 81 |
- run: rustup update --no-self-update stable && rustup default stable |
| 82 |
- run: rustup target add wasm32-unknown-unknown |
| 83 |
- uses: actions/setup-node@v4 |
| 84 |
with: |
| 85 |
node-version: '20' |
| 86 |
- uses: ./.github/actions/setup-geckodriver |
| 87 |
- run: cargo test --target wasm32-unknown-unknown |
| 88 |
- run: cargo test --target wasm32-unknown-unknown --features serde-serialize |
| 89 |
- run: cargo test --target wasm32-unknown-unknown --features enable-interning |
| 90 |
- run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures |
| 91 |
- run: cargo test --target wasm32-unknown-unknown --test wasm |
| 92 |
env: |
| 93 |
WASM_BINDGEN_NO_DEBUG: 1 |
| 94 |
- run: cargo test --target wasm32-unknown-unknown |
| 95 |
env: |
| 96 |
WASM_BINDGEN_EXTERNREF: 1 |
| 97 |
- run: cargo test --target wasm32-unknown-unknown |
| 98 |
env: |
| 99 |
WASM_BINDGEN_MULTI_VALUE: 1 |
| 100 |
|
| 101 |
test_threads: |
| 102 |
name: "Run wasm-bindgen crate tests with multithreading enabled" |
| 103 |
runs-on: ubuntu-latest |
| 104 |
steps: |
| 105 |
- uses: actions/checkout@v4 |
| 106 |
- run: rustup default nightly-2024-02-06 |
| 107 |
- run: rustup target add wasm32-unknown-unknown |
| 108 |
- run: rustup component add rust-src |
| 109 |
# Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. |
| 110 |
- run: | |
| 111 |
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ |
| 112 |
cargo test --target wasm32-unknown-unknown --test headless -Z build-std=std,panic_abort |
| 113 |
|
| 114 |
# I don't know why this is failing so comment this out for now, but ideally |
| 115 |
# this would be figured out at some point and solved. |
| 116 |
# test_wasm_bindgen_windows: |
| 117 |
# name: "Run wasm-bindgen crate tests (Windows)" |
| 118 |
# runs-on: windows-latest |
| 119 |
# steps: |
| 120 |
# - uses: actions/checkout@v4 |
| 121 |
# - run: rustup update --no-self-update stable && rustup default stable |
| 122 |
# - run: rustup target add wasm32-unknown-unknown |
| 123 |
# - uses: actions/setup-node@v4 |
| 124 |
# with: |
| 125 |
# node-version: '20' |
| 126 |
# - uses: ./.github/actions/setup-geckodriver |
| 127 |
# - run: cargo test --target wasm32-unknown-unknown |
| 128 |
# env: |
| 129 |
# RUST_LOG: wasm_bindgen_test_runner |
| 130 |
# GECKODRIVER_ARGS: --log trace |
| 131 |
# - run: cargo test --target wasm32-unknown-unknown -p js-sys |
| 132 |
# - run: cargo test --target wasm32-unknown-unknown -p webidl-tests |
| 133 |
# env: |
| 134 |
# WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 |
| 135 |
# - run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features "Node Window Document" |
| 136 |
|
| 137 |
test_native: |
| 138 |
name: Run native tests |
| 139 |
runs-on: ubuntu-latest |
| 140 |
steps: |
| 141 |
- uses: actions/checkout@v4 |
| 142 |
- run: rustup update --no-self-update stable && rustup default stable |
| 143 |
- run: rustup target add wasm32-unknown-unknown |
| 144 |
- uses: actions/setup-node@v4 |
| 145 |
with: |
| 146 |
node-version: '20' |
| 147 |
- run: cargo test |
| 148 |
- run: cargo test -p wasm-bindgen-cli-support |
| 149 |
- run: cargo test -p wasm-bindgen-cli |
| 150 |
- run: cargo test -p wasm-bindgen-externref-xform |
| 151 |
- run: cargo test -p wasm-bindgen-macro-support |
| 152 |
- run: cargo test -p wasm-bindgen-multi-value-xform |
| 153 |
- run: cargo test -p wasm-bindgen-wasm-interpreter |
| 154 |
- run: cargo test -p wasm-bindgen-futures |
| 155 |
- run: cargo test -p wasm-bindgen-shared |
| 156 |
|
| 157 |
test_web_sys: |
| 158 |
name: "Run web-sys crate tests" |
| 159 |
runs-on: ubuntu-latest |
| 160 |
steps: |
| 161 |
- uses: actions/checkout@v4 |
| 162 |
- run: rustup update --no-self-update stable && rustup default stable |
| 163 |
- run: rustup target add wasm32-unknown-unknown |
| 164 |
- uses: actions/setup-node@v4 |
| 165 |
with: |
| 166 |
node-version: '20' |
| 167 |
- uses: ./.github/actions/setup-geckodriver |
| 168 |
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown |
| 169 |
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node |
| 170 |
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element |
| 171 |
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window |
| 172 |
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features |
| 173 |
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features |
| 174 |
env: |
| 175 |
RUSTFLAGS: --cfg=web_sys_unstable_apis |
| 176 |
|
| 177 |
check_web_sys: |
| 178 |
name: "Verify that web-sys is compiled correctly" |
| 179 |
runs-on: ubuntu-latest |
| 180 |
steps: |
| 181 |
- uses: actions/checkout@v4 |
| 182 |
- run: rustup update --no-self-update stable && rustup default stable |
| 183 |
- run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml |
| 184 |
- run: git diff --exit-code |
| 185 |
|
| 186 |
test_js_sys: |
| 187 |
name: "Run js-sys crate tests" |
| 188 |
runs-on: ubuntu-latest |
| 189 |
steps: |
| 190 |
- uses: actions/checkout@v4 |
| 191 |
- run: rustup update --no-self-update stable && rustup default stable |
| 192 |
- run: rustup target add wasm32-unknown-unknown |
| 193 |
- uses: actions/setup-node@v4 |
| 194 |
with: |
| 195 |
node-version: '20' |
| 196 |
- uses: ./.github/actions/setup-geckodriver |
| 197 |
- run: cargo test -p js-sys --target wasm32-unknown-unknown |
| 198 |
- run: cargo test -p js-sys --target wasm32-unknown-unknown |
| 199 |
env: |
| 200 |
RUSTFLAGS: --cfg=js_sys_unstable_apis |
| 201 |
|
| 202 |
test_webidl: |
| 203 |
name: "Run wasm-bindgen-webidl crate tests" |
| 204 |
runs-on: ubuntu-latest |
| 205 |
steps: |
| 206 |
- uses: actions/checkout@v4 |
| 207 |
- run: rustup update --no-self-update stable && rustup default stable |
| 208 |
- run: rustup target add wasm32-unknown-unknown |
| 209 |
- uses: actions/setup-node@v4 |
| 210 |
with: |
| 211 |
node-version: '20' |
| 212 |
- run: cargo test -p wasm-bindgen-webidl |
| 213 |
- run: cargo test -p webidl-tests --target wasm32-unknown-unknown |
| 214 |
env: |
| 215 |
WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 |
| 216 |
- run: cargo test -p webidl-tests --target wasm32-unknown-unknown |
| 217 |
env: |
| 218 |
RUSTFLAGS: --cfg=web_sys_unstable_apis |
| 219 |
|
| 220 |
test_typescript_output: |
| 221 |
name: "Test TypeScript output of wasm-bindgen" |
| 222 |
runs-on: ubuntu-latest |
| 223 |
steps: |
| 224 |
- uses: actions/checkout@v4 |
| 225 |
- run: rustup update --no-self-update stable && rustup default stable |
| 226 |
- run: rustup target add wasm32-unknown-unknown |
| 227 |
- uses: actions/setup-node@v4 |
| 228 |
with: |
| 229 |
node-version: '20' |
| 230 |
- run: cd crates/typescript-tests && ./run.sh |
| 231 |
|
| 232 |
test_deno: |
| 233 |
name: "Build and test the deno example" |
| 234 |
runs-on: ubuntu-latest |
| 235 |
steps: |
| 236 |
- uses: actions/checkout@v4 |
| 237 |
- run: rustup update --no-self-update stable && rustup default stable |
| 238 |
- run: rustup target add wasm32-unknown-unknown |
| 239 |
- uses: denoland/setup-deno@v1 |
| 240 |
with: |
| 241 |
deno-version: v1.x |
| 242 |
- run: cd examples/deno && ./build.sh && deno run --allow-read test.ts |
| 243 |
|
| 244 |
test_ui: |
| 245 |
name: Run UI compile-fail tests |
| 246 |
runs-on: ubuntu-latest |
| 247 |
steps: |
| 248 |
- uses: actions/checkout@v4 |
| 249 |
- run: rustup update --no-self-update 1.76.0 && rustup default 1.76.0 |
| 250 |
- run: cargo test -p wasm-bindgen-macro |
| 251 |
- run: cargo test -p wasm-bindgen-test-macro |
| 252 |
|
| 253 |
build_examples: |
| 254 |
runs-on: ubuntu-latest |
| 255 |
steps: |
| 256 |
- uses: actions/checkout@v4 |
| 257 |
- run: rustup update --no-self-update stable && rustup default stable |
| 258 |
- run: rustup target add wasm32-unknown-unknown |
| 259 |
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f |
| 260 |
- run: | |
| 261 |
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-linux.tar.gz -sSf > binaryen-version_112-x86_64-linux.tar.gz |
| 262 |
tar -xz -f binaryen-version_112-x86_64-linux.tar.gz binaryen-version_112/bin/wasm2js |
| 263 |
echo "$PWD/binaryen-version_112/bin" >> $GITHUB_PATH |
| 264 |
- run: | |
| 265 |
cargo build -p wasm-bindgen-cli |
| 266 |
ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen |
| 267 |
- run: mv _package.json package.json && npm install && rm package.json |
| 268 |
- run: | |
| 269 |
for dir in `ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet`; do |
| 270 |
(cd examples/$dir && |
| 271 |
(npm run build -- --output-path ../../exbuild/$dir || |
| 272 |
(./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir && rm ../../exbuild/$dir/**/.gitignore)) |
| 273 |
) || exit 1; |
| 274 |
done |
| 275 |
env: |
| 276 |
RUSTFLAGS: --cfg=web_sys_unstable_apis |
| 277 |
- uses: actions/upload-artifact@v4 |
| 278 |
with: |
| 279 |
name: examples1 |
| 280 |
path: exbuild |
| 281 |
|
| 282 |
build_nightly: |
| 283 |
runs-on: ubuntu-latest |
| 284 |
steps: |
| 285 |
- uses: actions/checkout@v4 |
| 286 |
- run: rustup default nightly-2024-02-06 |
| 287 |
- run: rustup target add wasm32-unknown-unknown |
| 288 |
- run: rustup component add rust-src |
| 289 |
- run: | |
| 290 |
for dir in raytrace-parallel wasm-audio-worklet; do |
| 291 |
(cd examples/$dir && |
| 292 |
./build.sh && mkdir -p ../../exbuild/$dir && cp -r ./* ../../exbuild/$dir |
| 293 |
) || exit 1; |
| 294 |
done |
| 295 |
- uses: actions/upload-artifact@v4 |
| 296 |
with: |
| 297 |
name: examples2 |
| 298 |
path: exbuild |
| 299 |
|
| 300 |
test_examples: |
| 301 |
needs: |
| 302 |
- build_examples |
| 303 |
- build_nightly |
| 304 |
runs-on: ubuntu-latest |
| 305 |
steps: |
| 306 |
- uses: actions/checkout@v4 |
| 307 |
- uses: actions/download-artifact@v4 |
| 308 |
with: |
| 309 |
name: examples1 |
| 310 |
path: exbuild |
| 311 |
- uses: actions/download-artifact@v4 |
| 312 |
with: |
| 313 |
name: examples2 |
| 314 |
path: exbuild |
| 315 |
- run: rustup update --no-self-update stable && rustup default stable |
| 316 |
- run: cargo test -p example-tests |
| 317 |
env: |
| 318 |
EXBUILD: ${{ github.workspace }}/exbuild |
| 319 |
|
| 320 |
build_benchmarks: |
| 321 |
runs-on: ubuntu-latest |
| 322 |
steps: |
| 323 |
- uses: actions/checkout@v4 |
| 324 |
- run: rustup update --no-self-update stable && rustup default stable |
| 325 |
- run: rustup target add wasm32-unknown-unknown |
| 326 |
- run: cargo build --manifest-path benchmarks/Cargo.toml --release --target wasm32-unknown-unknown |
| 327 |
- run: cargo run -p wasm-bindgen-cli -- target/wasm32-unknown-unknown/release/wasm_bindgen_benchmark.wasm --out-dir benchmarks/pkg --target web |
| 328 |
- uses: actions/upload-artifact@v4 |
| 329 |
with: |
| 330 |
name: benchmarks |
| 331 |
path: benchmarks |
| 332 |
|
| 333 |
dist_linux_x86_64_musl: |
| 334 |
runs-on: ubuntu-latest |
| 335 |
steps: |
| 336 |
- uses: actions/checkout@v4 |
| 337 |
- run: rustup update --no-self-update stable && rustup default stable |
| 338 |
- run: rustup target add x86_64-unknown-linux-musl |
| 339 |
- run: sudo apt update -y && sudo apt install musl-tools -y |
| 340 |
- run: | |
| 341 |
cargo build --manifest-path crates/cli/Cargo.toml --target x86_64-unknown-linux-musl --features vendored-openssl --release |
| 342 |
strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen |
| 343 |
strip -g target/x86_64-unknown-linux-musl/release/wasm-bindgen-test-runner |
| 344 |
strip -g target/x86_64-unknown-linux-musl/release/wasm2es6js |
| 345 |
- uses: actions/upload-artifact@v4 |
| 346 |
with: |
| 347 |
name: dist_linux_x86_64_musl |
| 348 |
path: "target/x86_64-unknown-linux-musl/release/wasm*" |
| 349 |
|
| 350 |
dist_linux_aarch64_gnu: |
| 351 |
runs-on: ubuntu-latest |
| 352 |
steps: |
| 353 |
- uses: actions/checkout@v4 |
| 354 |
- run: rustup update --no-self-update stable && rustup default stable |
| 355 |
- run: rustup target add aarch64-unknown-linux-gnu |
| 356 |
- run: sudo apt update -y && sudo apt install gcc-aarch64-linux-gnu -y |
| 357 |
- run: | |
| 358 |
cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-gnu --features vendored-openssl --release |
| 359 |
env: |
| 360 |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc |
| 361 |
- uses: actions/upload-artifact@v4 |
| 362 |
with: |
| 363 |
name: dist_linux_aarch64_gnu |
| 364 |
path: "target/aarch64-unknown-linux-gnu/release/wasm*" |
| 365 |
|
| 366 |
dist_macos_x86_64: |
| 367 |
runs-on: macos-latest |
| 368 |
steps: |
| 369 |
- uses: actions/checkout@v4 |
| 370 |
- run: rustup update --no-self-update stable && rustup default stable |
| 371 |
- run: cargo build --manifest-path crates/cli/Cargo.toml --release |
| 372 |
env: |
| 373 |
MACOSX_DEPLOYMENT_TARGET: 10.7 |
| 374 |
- uses: actions/upload-artifact@v4 |
| 375 |
with: |
| 376 |
name: dist_macos_x86_64 |
| 377 |
path: "target/release/wasm*" |
| 378 |
|
| 379 |
dist_macos_aarch64: |
| 380 |
runs-on: macos-latest |
| 381 |
steps: |
| 382 |
- uses: actions/checkout@v4 |
| 383 |
- run: rustup update --no-self-update stable && rustup default stable |
| 384 |
- run: rustup target add aarch64-apple-darwin |
| 385 |
- run: | |
| 386 |
cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-apple-darwin --release |
| 387 |
env: |
| 388 |
MACOSX_DEPLOYMENT_TARGET: 10.7 |
| 389 |
- uses: actions/upload-artifact@v4 |
| 390 |
with: |
| 391 |
name: dist_macos_aarch64 |
| 392 |
path: "target/aarch64-apple-darwin/release/wasm*" |
| 393 |
|
| 394 |
dist_windows: |
| 395 |
runs-on: windows-latest |
| 396 |
steps: |
| 397 |
- uses: actions/checkout@v4 |
| 398 |
- run: rustup update --no-self-update stable && rustup default stable |
| 399 |
- run: cargo build --manifest-path crates/cli/Cargo.toml --release |
| 400 |
env: |
| 401 |
RUSTFLAGS: -Ctarget-feature=+crt-static |
| 402 |
- uses: actions/upload-artifact@v4 |
| 403 |
with: |
| 404 |
name: dist_windows |
| 405 |
path: "target/release/wasm*" |
| 406 |
|
| 407 |
doc_book: |
| 408 |
runs-on: ubuntu-latest |
| 409 |
steps: |
| 410 |
- uses: actions/checkout@v4 |
| 411 |
- run: | |
| 412 |
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 - |
| 413 |
echo $PWD >> $GITHUB_PATH |
| 414 |
- run: (cd guide && mdbook build) |
| 415 |
- uses: actions/upload-artifact@v4 |
| 416 |
with: |
| 417 |
name: doc_book |
| 418 |
path: guide/book/html |
| 419 |
|
| 420 |
doc_api: |
| 421 |
runs-on: ubuntu-latest |
| 422 |
steps: |
| 423 |
- uses: actions/checkout@v4 |
| 424 |
- run: rustup update --no-self-update nightly && rustup default nightly |
| 425 |
- run: cargo doc --no-deps --features 'serde-serialize' |
| 426 |
- run: cargo doc --no-deps --manifest-path crates/js-sys/Cargo.toml |
| 427 |
- run: cargo doc --no-deps --manifest-path crates/web-sys/Cargo.toml --all-features |
| 428 |
env: |
| 429 |
RUSTDOCFLAGS: --cfg=web_sys_unstable_apis |
| 430 |
- run: cargo doc --no-deps --manifest-path crates/futures/Cargo.toml |
| 431 |
- run: tar czvf docs.tar.gz target/doc |
| 432 |
- uses: actions/upload-artifact@v4 |
| 433 |
with: |
| 434 |
name: doc_api |
| 435 |
path: docs.tar.gz |
| 436 |
|
| 437 |
|
| 438 |
deploy: |
| 439 |
permissions: |
| 440 |
contents: write # to push changes in repo (jamesives/github-pages-deploy-action) |
| 441 |
|
| 442 |
needs: |
| 443 |
- doc_api |
| 444 |
- doc_book |
| 445 |
- dist_linux_x86_64_musl |
| 446 |
- dist_linux_aarch64_gnu |
| 447 |
- dist_macos_x86_64 |
| 448 |
- dist_macos_aarch64 |
| 449 |
- dist_windows |
| 450 |
- build_examples |
| 451 |
- build_nightly |
| 452 |
- build_benchmarks |
| 453 |
runs-on: ubuntu-latest |
| 454 |
steps: |
| 455 |
- uses: actions/checkout@v4 |
| 456 |
with: |
| 457 |
fetch-depth: 0 |
| 458 |
- uses: actions/download-artifact@v4 |
| 459 |
with: |
| 460 |
path: artifacts |
| 461 |
- run: find artifacts |
| 462 |
- run: | |
| 463 |
set -ex |
| 464 |
mkdir -p gh-release |
| 465 |
tag=`git describe --tags` |
| 466 |
mk() { |
| 467 |
target=$1 |
| 468 |
src=$2 |
| 469 |
name=wasm-bindgen-$tag-$target |
| 470 |
mkdir -p tmp/$name |
| 471 |
rm -f artifacts/$src/*.d |
| 472 |
rm -f artifacts/$src/*.pdb |
| 473 |
cp README.md \ |
| 474 |
LICENSE-MIT \ |
| 475 |
LICENSE-APACHE \ |
| 476 |
artifacts/$src/wasm* \ |
| 477 |
tmp/$name/ |
| 478 |
chmod +x tmp/$name/wasm* |
| 479 |
tar czvf gh-release/$name.tar.gz -C tmp $name |
| 480 |
sha256sum gh-release/$name.tar.gz > gh-release/$name.tar.gz.sha256sum |
| 481 |
} |
| 482 |
mk x86_64-unknown-linux-musl dist_linux_x86_64_musl |
| 483 |
mk aarch64-unknown-linux-gnu dist_linux_aarch64_gnu |
| 484 |
mk x86_64-apple-darwin dist_macos_x86_64 |
| 485 |
mk aarch64-apple-darwin dist_macos_aarch64 |
| 486 |
mk x86_64-pc-windows-msvc dist_windows |
| 487 |
- uses: actions/upload-artifact@v4 |
| 488 |
with: |
| 489 |
name: gh-release |
| 490 |
path: gh-release |
| 491 |
- run: | |
| 492 |
mv artifacts/doc_book gh-pages |
| 493 |
tar xf artifacts/doc_api/docs.tar.gz |
| 494 |
mv target/doc gh-pages/api |
| 495 |
mv artifacts/examples1 gh-pages/exbuild |
| 496 |
mv artifacts/examples2/* gh-pages/exbuild |
| 497 |
mv artifacts/benchmarks gh-pages/benchmarks |
| 498 |
tar czf gh-pages.tar.gz gh-pages |
| 499 |
- uses: actions/upload-artifact@v4 |
| 500 |
with: |
| 501 |
name: gh-pages |
| 502 |
path: gh-pages.tar.gz |
| 503 |
- uses: JamesIves/github-pages-deploy-action@v4 |
| 504 |
with: |
| 505 |
branch: gh-pages |
| 506 |
folder: gh-pages |
| 507 |
single-commit: true |
| 508 |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 509 |
- uses: softprops/action-gh-release@v1 |
| 510 |
if: startsWith(github.ref, 'refs/tags/') |
| 511 |
with: |
| 512 |
files: "gh-release/*.tar.gz*" |
| 513 |
- uses: dtolnay/rust-toolchain@stable |
| 514 |
if: startsWith(github.ref, 'refs/tags/') |
| 515 |
- run: rustc publish.rs |
| 516 |
if: startsWith(github.ref, 'refs/tags/') |
| 517 |
- run: ./publish publish |
| 518 |
if: startsWith(github.ref, 'refs/tags/') |
| 519 |
env: |
| 520 |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_PUBLISH_TOKEN }} |