mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
wasm: support the wasm32-unknown-emscripten target (#8281)
This commit is contained in:
@@ -19,6 +19,8 @@ env:
|
||||
rust_nightly: nightly-2025-10-12
|
||||
# Pin a specific miri version
|
||||
rust_miri_nightly: nightly-2026-06-29
|
||||
rust_emscripten_nightly: nightly-2026-08-17
|
||||
emsdk_version: '6.0.8'
|
||||
rust_clippy: '1.88'
|
||||
# When updating this, also update:
|
||||
# - README.md
|
||||
@@ -1193,6 +1195,59 @@ jobs:
|
||||
RUSTFLAGS: --cfg tokio_unstable
|
||||
CARGO_TARGET_WASM32_WASIP2_RUNNER: wasmtime run -Sinherit-network
|
||||
|
||||
wasm32-unknown-emscripten:
|
||||
name: test tokio for wasm32-unknown-emscripten
|
||||
needs: basics
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Install Rust ${{ env.rust_stable }}
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: ${{ env.rust_stable }}
|
||||
targets: wasm32-unknown-emscripten
|
||||
|
||||
- name: Install Emscripten
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
with:
|
||||
version: ${{ env.emsdk_version }}
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 26
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Install cargo-hack
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-hack
|
||||
|
||||
- name: Check tokio feature matrix for emscripten
|
||||
run: cargo hack check -p tokio --each-feature --exclude-features full,net,process,signal,rt-multi-thread,io-uring,taskdump,schedule-latency --target wasm32-unknown-emscripten
|
||||
working-directory: tokio
|
||||
|
||||
- name: Test tokio for emscripten
|
||||
run: cargo test -p tokio --target wasm32-unknown-emscripten --features "rt,time,sync,macros,fs,io-util,io-std,test-util" --tests
|
||||
working-directory: tokio
|
||||
env:
|
||||
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER: node
|
||||
RUSTFLAGS: "-Dwarnings -Clink-args=-sALLOW_MEMORY_GROWTH=1 -Clink-args=-sEXIT_RUNTIME=1 -Clink-args=-sSTACK_SIZE=1048576"
|
||||
|
||||
- name: Install Rust ${{ env.rust_emscripten_nightly }}
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: ${{ env.rust_emscripten_nightly }}
|
||||
targets: wasm32-unknown-emscripten
|
||||
components: rust-src
|
||||
|
||||
- name: Test tokio multi-thread runtime for emscripten (pthreads)
|
||||
run: cargo +${{ env.rust_emscripten_nightly }} test -Zbuild-std=std,panic_abort -p tokio --target wasm32-unknown-emscripten --features "rt,rt-multi-thread,time,sync,macros" --test rt_multi_thread_emscripten
|
||||
working-directory: tokio
|
||||
env:
|
||||
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER: node
|
||||
RUSTFLAGS: "-Dwarnings -Ctarget-feature=+atomics,+bulk-memory,+mutable-globals -Clink-args=-pthread -Clink-args=-sPTHREAD_POOL_SIZE=8 -Clink-args=-sINITIAL_MEMORY=134217728 -Clink-args=-sEXIT_RUNTIME=1 -Clink-args=-sSTACK_SIZE=1048576"
|
||||
|
||||
check-external-types:
|
||||
name: check-external-types (${{ matrix.os }})
|
||||
needs: basics
|
||||
|
||||
Reference in New Issue
Block a user