Add export_type
attribute to export string enums
#2794
Workflow file for this run
This file contains 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@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-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 -- -D warnings | |
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -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 --no-default-features --target wasm32-unknown-unknown -- -D warnings | |
- 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 | |
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 | |
# Note: we only run the browser tests here, because wasm-bindgen doesn't support threading in Node yet. | |
- run: | | |
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ | |
cargo test --target wasm32-unknown-unknown --test headless -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" | |
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: rustup target add wasm32-unknown-unknown | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- 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.76.0 && rustup default 1.76.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: | | |
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 | |
tar -xz -f binaryen-version_112-x86_64-linux.tar.gz binaryen-version_112/bin/wasm2js | |
echo "$PWD/binaryen-version_112/bin" >> $GITHUB_PATH | |
- 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-lib: | |
name: Check MSRV for libraries | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: crates/msrv/lib | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update --no-self-update 1.57 && rustup default 1.57 | |
- run: cargo build | |
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 }} |