CI #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - run: cargo fmt --all -- --check | |
| # Check TOML style by using Taplo. | |
| taplo: | |
| name: Taplo | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: taplo-cli | |
| - run: taplo fmt --check | |
| # Run `cargo clippy` over everything | |
| clippy: | |
| name: Clippy (native) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy,rustfmt | |
| - run: cargo clippy --no-deps --all --all-features -- -D warnings | |
| # Run `cargo clippy` over all Wasm crates | |
| clippy_wasm: | |
| name: Clippy (Wasm) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: clippy,rustfmt | |
| - run: > | |
| cargo clippy --no-deps --all --all-features | |
| --target wasm32-unknown-unknown | |
| --exclude wasm-bindgen-cli* | |
| --exclude wasm-bindgen-*macro* | |
| --exclude wasm-bindgen-webidl | |
| -- -D warnings | |
| # Run `cargo clippy` over crates that support `no_std` | |
| clippy_wasm_no_std: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: "no_std" | |
| - name: "no_std + atomics" | |
| flags: --config "target.wasm32-unknown-unknown.rustflags='-Ctarget-feature=+atomics'" | |
| name: Clippy (Wasm + ${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: clippy | |
| - run: > | |
| cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown | |
| -p wasm-bindgen | |
| -p js-sys | |
| -p web-sys | |
| -p wasm-bindgen-futures | |
| -p wasm-bindgen-test | |
| ${{ matrix.flags }} | |
| -- -D warnings | |
| test_wasm_bindgen: | |
| strategy: | |
| matrix: | |
| runs: | |
| - name: default | |
| run: | | |
| cargo test --target wasm32-unknown-unknown | |
| cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures | |
| - name: serde-serialize | |
| run: cargo test --target wasm32-unknown-unknown --features serde-serialize | |
| - name: 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@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - run: ${{ matrix.runs.run }} | |
| test_wasm_bindgen_custom: | |
| strategy: | |
| matrix: | |
| envs: | |
| - name: mvp | |
| rustflags: -Ctarget-cpu=mvp | |
| - name: atomics | |
| rustflags: -Ctarget-feature=+atomics -Clink-args=--shared-memory -Clink-args=--max-memory=1073741824 -Clink-args=--import-memory -Clink-args=--export=__heap_base -Clink-args=--export=__wasm_init_tls -Clink-args=--export=__tls_size -Clink-args=--export=__tls_align -Clink-args=--export=__tls_base | |
| name: "Run wasm-bindgen crate tests (${{ matrix.envs.name }})" | |
| runs-on: ubuntu-latest | |
| env: | |
| WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rust-src | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - run: cargo test --target wasm32-unknown-unknown -Zbuild-std=std,panic_abort --config="target.wasm32-unknown-unknown.rustflags='${{ matrix.envs.RUSTFLAGS }}'" | |
| test_wasm64: | |
| name: "Run wasm-bindgen crate tests (wasm64)" | |
| runs-on: ubuntu-latest | |
| env: | |
| WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - run: cargo test --target wasm64-unknown-unknown -Zbuild-std=std,panic_abort | |
| test_wasm_bindgen_unwind_legacy_eh: | |
| name: "Run wasm-bindgen crate tests with panic=unwind with legacy eh" | |
| runs-on: ubuntu-latest | |
| env: | |
| WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 | |
| # rust-lang/rust#156061 flipped the wasm panic=unwind default to modern | |
| # (exnref) EH. `-Cllvm-args=-wasm-use-legacy-eh` opts back into legacy | |
| # EH on a plain nightly. | |
| RUSTFLAGS: -Cpanic=unwind -Cllvm-args=-wasm-use-legacy-eh --cfg=legacy_eh | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rust-src | |
| # Legacy EH is the path that buys back Node 20+ support: wasm-bindgen | |
| # polyfills `WebAssembly.JSTag` on the JS side, so the legacy `try`/`catch` | |
| # instructions (supported since Node 18) are sufficient — no host | |
| # `WebAssembly.JSTag` required. Node 18 is excluded because its V8 10.2 | |
| # has unrelated funcref / WASM_INTERNAL_FUNCTION_TYPE bugs that crash the | |
| # wasm-bindgen-test runtime. | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - run: cargo test --target wasm32-unknown-unknown -Zbuild-std --lib --bins --tests | |
| - run: cargo test --target wasm32-unknown-unknown -Zbuild-std --test wasm --features std,wasm-bindgen-futures/std | |
| test_wasm_bindgen_unwind_exnref_eh: | |
| name: "Run wasm-bindgen crate tests with panic=unwind with exnref eh" | |
| runs-on: ubuntu-latest | |
| env: | |
| WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 | |
| # Modern (exnref) EH is the default for panic=unwind on wasm since | |
| # rust-lang/rust#156061. Modern EH requires Node 22.22.3+ on the 22 LTS | |
| # line (or 24.15.0+). | |
| RUSTFLAGS: -Cpanic=unwind | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rust-src | |
| # TODO: drop back to Node 22 LTS once 22.22.3 ships (2026-05-13, modern EH backport). | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '25' | |
| - run: cargo test --target wasm32-unknown-unknown -Zbuild-std --lib --bins --tests | |
| - run: cargo test --target wasm32-unknown-unknown -Zbuild-std --test wasm --features std,wasm-bindgen-futures/std | |
| test_emscripten: | |
| name: Run Emscripten tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-emscripten | |
| - name: Setup Emscripten SDK | |
| uses: mymindstorm/setup-emsdk@v16 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| - name: Run Emscripten headless tests | |
| run: cargo test --test wasm32-emscripten --target wasm32-unknown-emscripten | |
| # 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@v6 | |
| # - run: rustup update --no-self-update stable && rustup default stable | |
| # - run: rustup target add wasm32-unknown-unknown | |
| # - uses: actions/setup-node@v6 | |
| # with: | |
| # node-version: '20' | |
| # - 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@v6 | |
| - uses: actions/setup-node@v6 | |
| 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 $(find crates/cli/tests/reference -maxdepth 1 -name '*.js' ! -name '*target-module*.js') | |
| test_native: | |
| name: Run native tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: wasm32-unknown-unknown,wasm32-wasip1 | |
| components: rust-src | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown,wasm32-wasip1 | |
| # The cli termination tests build with `-Cpanic=unwind` which since | |
| # rust-lang/rust#156061 produces modern (exnref) EH by default. That needs | |
| # Node 22.22.3+ on the 22 LTS line (or 24.15.0+) to validate. | |
| # TODO: drop back to Node 22 LTS once 22.22.3 ships (2026-05-13, modern EH backport). | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24.15' | |
| # `cargo test -p wasm-bindgen-cli` includes the emscripten namespaced | |
| # .d.ts validity test, which type-checks the generated .d.ts with | |
| # `tsc --noEmit --strict`. Install tsc globally so it's on PATH. | |
| - run: npm i -g typescript | |
| - run: cargo test | |
| - run: cargo test -p wasm-bindgen-cli-support | |
| - run: cargo test -p wasm-bindgen-cli | |
| - run: cargo test -p wasm-bindgen-macro-support | |
| - run: cargo test -p wasm-bindgen-futures | |
| - run: cargo test -p wasm-bindgen-shared | |
| - run: cargo test -p wasm-bindgen-test-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: "web-sys (next-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 --cfg=wbg_next_unstable | |
| - name: "js-sys" | |
| run: cargo test -p js-sys --features=unsafe-eval --target wasm32-unknown-unknown | |
| - name: "js-sys (unstable)" | |
| run: cargo test -p js-sys --features=unsafe-eval --target wasm32-unknown-unknown | |
| env: | |
| RUSTFLAGS: --cfg=js_sys_unstable_apis | |
| - name: "js-sys (next-unstable)" | |
| run: cargo test -p js-sys --features=unsafe-eval --target wasm32-unknown-unknown | |
| env: | |
| RUSTFLAGS: --cfg=js_sys_unstable_apis --cfg=wbg_next_unstable | |
| - 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: "webidl-tests (next)" | |
| run: cargo test -p webidl-tests --target wasm32-unknown-unknown | |
| env: | |
| RUSTFLAGS: --cfg=web_sys_unstable_apis --cfg=wbg_next_unstable | |
| WBG_NEXT_UNSTABLE: "1" | |
| - 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 }} | |
| WBG_NEXT_UNSTABLE: ${{ matrix.runs.env.WBG_NEXT_UNSTABLE }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rustfmt | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - run: ${{ matrix.runs.run }} | |
| test_ui: | |
| name: Run UI compile-fail tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@1.88 | |
| - 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@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - 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@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: clippy,rust-src | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f | |
| - run: | | |
| cargo install --path crates/cli --debug | |
| - run: npm install -g pnpm@latest-10 | |
| # 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: pnpm install | |
| working-directory: examples | |
| - run: pnpm run -r build | |
| working-directory: examples | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: examples | |
| path: examples/dist | |
| test_examples: | |
| needs: | |
| - build_examples | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: examples | |
| path: examples/dist | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - run: npm install -g pnpm@latest-10 | |
| - run: pnpm install | |
| working-directory: examples | |
| - run: npm test --ignore-scripts | |
| working-directory: examples | |
| env: | |
| PREBUILT_EXAMPLES: 1 | |
| build_benchmarks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 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@v7 | |
| with: | |
| name: benchmarks | |
| path: benchmarks | |
| dist_linux_x86_64_musl: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 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@v7 | |
| with: | |
| name: dist_linux_x86_64_musl | |
| path: "target/x86_64-unknown-linux-musl/release/wasm*" | |
| dist_linux_aarch64_gnu: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 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@v7 | |
| with: | |
| name: dist_linux_aarch64_gnu | |
| path: "target/aarch64-unknown-linux-gnu/release/wasm*" | |
| dist_linux_aarch64_musl: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-musl | |
| - run: sudo apt update -y && sudo apt install musl-tools -y | |
| - run: | | |
| cargo build --manifest-path crates/cli/Cargo.toml --target aarch64-unknown-linux-musl --features vendored-openssl --release | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist_linux_aarch64_musl | |
| path: "target/aarch64-unknown-linux-musl/release/wasm*" | |
| dist_macos_x86_64: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: 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@v7 | |
| with: | |
| name: dist_macos_x86_64 | |
| path: "target/x86_64-apple-darwin/release/wasm*" | |
| dist_macos_aarch64: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: | | |
| cargo build --manifest-path crates/cli/Cargo.toml --release | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: 10.7 | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist_macos_aarch64 | |
| path: "target/release/wasm*" | |
| dist_windows: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: cargo build --manifest-path crates/cli/Cargo.toml --release | |
| env: | |
| RUSTFLAGS: -Ctarget-feature=+crt-static | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist_windows | |
| path: "target/release/wasm*" | |
| doc_book: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: | | |
| curl -L https://github.com/rust-lang/mdBook/releases/download/v0.5.2/mdbook-v0.5.2-x86_64-unknown-linux-gnu.tar.gz | tar xzf - | |
| echo $PWD >> $GITHUB_PATH | |
| - run: (cd guide && mdbook build) | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: doc_book | |
| path: guide/book/html | |
| doc_api: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@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@v7 | |
| 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.77 | |
| - stable | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - wasm32-unknown-unknown | |
| features: | |
| - --no-default-features | |
| - "" | |
| defaults: | |
| run: | |
| working-directory: crates/msrv/resolver | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| targets: ${{ matrix.target }} | |
| - run: cargo build --target ${{ matrix.target }} ${{ matrix.features }} | |
| msrv-lib: | |
| name: Check MSRV for libraries | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: | |
| - 1.77 | |
| - 1.86 | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - wasm32-unknown-unknown | |
| features: | |
| - --no-default-features | |
| - "" | |
| defaults: | |
| run: | |
| working-directory: crates/msrv/lib | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| targets: ${{ 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@v6 | |
| - uses: dtolnay/rust-toolchain@1.86 | |
| - run: cargo build | |
| deploy: | |
| permissions: | |
| contents: write # to push changes in repo (jamesives/github-pages-deploy-action) | |
| if: github.repository == 'wasm-bindgen/wasm-bindgen' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
| needs: | |
| - doc_api | |
| - doc_book | |
| - dist_linux_x86_64_musl | |
| - dist_linux_aarch64_gnu | |
| - dist_linux_aarch64_musl | |
| - dist_macos_x86_64 | |
| - dist_macos_aarch64 | |
| - dist_windows | |
| - build_examples | |
| - build_benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v8 | |
| 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 aarch64-unknown-linux-musl dist_linux_aarch64_musl | |
| 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@v7 | |
| 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/examples gh-pages/exbuild | |
| mv artifacts/benchmarks gh-pages/benchmarks | |
| tar czf gh-pages.tar.gz gh-pages | |
| - uses: actions/upload-artifact@v7 | |
| 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@v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| draft: true | |
| files: "gh-release/*.tar.gz*" | |
| publish: | |
| environment: | |
| name: publish | |
| deployment: false | |
| permissions: | |
| id-token: write # to use Crates.io trusted publishing | |
| if: github.repository == 'wasm-bindgen/wasm-bindgen' && startsWith(github.ref, 'refs/tags/') | |
| needs: | |
| - deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: rustc publish.rs | |
| - uses: rust-lang/crates-io-auth-action@v1 | |
| id: auth | |
| - run: ./publish publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} |