WASI support (#202)
* fix: use different claim for wasi Signed-off-by: Anton Whalley <anton@venshare.com> * fix: remove main hyper Signed-off-by: Anton Whalley <anton@venshare.com> * fix: ignore runtimes docs in wasi test Signed-off-by: Anton Whalley <anton@venshare.com> * fix: reference attributed rust-claim Signed-off-by: Anton Whalley <anton@venshare.com> * fix: use supported claims Signed-off-by: Anthony Whalley <anton@venshare.com> * fix: update ticks Signed-off-by: Anton Whalley <anton@venshare.com> * test: wasi target_os and hyper conditional Signed-off-by: Anton Whalley <anton@venshare.com> * fix: revert toml format and param for target Signed-off-by: Anton Whalley <anton@venshare.com> * fix: remove formatting of cargo file Signed-off-by: Fabrizio Lazzaretti <fabrizio@lazzaretti.me> --------- Signed-off-by: Anton Whalley <anton@venshare.com> Signed-off-by: Anthony Whalley <anton@venshare.com> Signed-off-by: Fabrizio Lazzaretti <fabrizio@lazzaretti.me> Co-authored-by: Fabrizio Lazzaretti <fabrizio@lazzaretti.me>
This commit is contained in:
parent
a59c3f55a0
commit
13c36fdbfe
|
@ -22,15 +22,17 @@ jobs:
|
||||||
- x86_64-unknown-linux-gnu
|
- x86_64-unknown-linux-gnu
|
||||||
- x86_64-unknown-linux-musl
|
- x86_64-unknown-linux-musl
|
||||||
- wasm32-unknown-unknown
|
- wasm32-unknown-unknown
|
||||||
|
- wasm32-wasi
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# setup wasmedge
|
||||||
|
- run: curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -p /usr/local
|
||||||
# Setup musl if needed
|
# Setup musl if needed
|
||||||
- run: sudo apt-get update
|
- run: sudo apt-get update
|
||||||
if: matrix.target == 'x86_64-unknown-linux-musl'
|
if: matrix.target == 'x86_64-unknown-linux-musl'
|
||||||
- run: sudo apt-get install -y musl musl-dev musl-tools cmake
|
- run: sudo apt-get install -y musl musl-dev musl-tools cmake
|
||||||
if: matrix.target == 'x86_64-unknown-linux-musl'
|
if: matrix.target == 'x86_64-unknown-linux-musl'
|
||||||
|
|
||||||
# # Caching stuff
|
# # Caching stuff
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -96,7 +98,22 @@ jobs:
|
||||||
command: build
|
command: build
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
args: --target wasm32-unknown-unknown --features reqwest
|
args: --target wasm32-unknown-unknown --features reqwest
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
name: "Build"
|
||||||
|
if: matrix.target == 'wasm32-wasi'
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
args: --target ${{ matrix.target }} --features "http-binding hyper hyper_wasi"
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
name: "Test"
|
||||||
|
if: matrix.target == 'wasm32-wasi'
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
args: --target ${{ matrix.target }} --features "http-binding hyper hyper_wasi"
|
||||||
|
env:
|
||||||
|
CARGO_TARGET_WASM32_WASI_RUNNER: wasmedge
|
||||||
# Build examples
|
# Build examples
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
name: "Build reqwest-wasm-example"
|
name: "Build reqwest-wasm-example"
|
||||||
|
|
25
Cargo.toml
25
Cargo.toml
|
@ -52,7 +52,6 @@ async-trait = { version = "^0.1.33", optional = true }
|
||||||
bytes = { version = "^1.0", optional = true }
|
bytes = { version = "^1.0", optional = true }
|
||||||
futures = { version = "^0.3", optional = true }
|
futures = { version = "^0.3", optional = true }
|
||||||
http = { version = "0.2", optional = true }
|
http = { version = "0.2", optional = true }
|
||||||
hyper = { version = "^0.14", optional = true }
|
|
||||||
axum-lib = { version = "^0.6", optional = true, package="axum"}
|
axum-lib = { version = "^0.6", optional = true, package="axum"}
|
||||||
http-body = { version = "^0.4", optional = true }
|
http-body = { version = "^0.4", optional = true }
|
||||||
poem-lib = { version = "=1.2.34", optional = true, package = "poem" }
|
poem-lib = { version = "=1.2.34", optional = true, package = "poem" }
|
||||||
|
@ -64,6 +63,12 @@ hostname = "^0.3"
|
||||||
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
||||||
web-sys = { version = "^0.3", features = ["Window", "Location"] }
|
web-sys = { version = "^0.3", features = ["Window", "Location"] }
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "wasi"))'.dependencies]
|
||||||
|
hyper = { version = "^0.14", optional = true }
|
||||||
|
|
||||||
|
[target.'cfg(all(target_arch = "wasm32", target_os = "wasi"))'.dependencies]
|
||||||
|
hyper_wasi = { version = "0.15", features = ["full"], optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rstest = "0.6"
|
rstest = "0.6"
|
||||||
claims = "0.7.1"
|
claims = "0.7.1"
|
||||||
|
@ -72,11 +77,25 @@ serde_yaml = "0.8"
|
||||||
rmp-serde = "1"
|
rmp-serde = "1"
|
||||||
|
|
||||||
# runtime dev-deps
|
# runtime dev-deps
|
||||||
actix-rt = { version = "^2" }
|
|
||||||
url = { version = "^2.1", features = ["serde"] }
|
url = { version = "^2.1", features = ["serde"] }
|
||||||
serde_json = { version = "^1.0" }
|
serde_json = { version = "^1.0" }
|
||||||
chrono = { version = "^0.4", features = ["serde"] }
|
chrono = { version = "^0.4", features = ["serde"] }
|
||||||
mockito = "0.25.1"
|
mockito = "0.25.1"
|
||||||
tokio = { version = "^1.0", features = ["full"] }
|
|
||||||
mime = "0.3"
|
mime = "0.3"
|
||||||
|
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "wasi"))'.dev-dependencies]
|
||||||
|
actix-rt = { version = "^2" }
|
||||||
|
tokio = { version = "^1.0", features = ["full"] }
|
||||||
tower = { version = "0.4", features = ["util"] }
|
tower = { version = "0.4", features = ["util"] }
|
||||||
|
|
||||||
|
[target.'cfg(all(target_arch = "wasm32", target_os = "wasi"))'.dev-dependencies]
|
||||||
|
tokio_wasi = { version = "1", features = [
|
||||||
|
"io-util",
|
||||||
|
"fs",
|
||||||
|
"net",
|
||||||
|
"time",
|
||||||
|
"rt",
|
||||||
|
"macros",
|
||||||
|
] }
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)]
|
||||||
fn test_readme_deps() {
|
fn test_readme_deps() {
|
||||||
version_sync::assert_markdown_deps_updated!("README.md");
|
version_sync::assert_markdown_deps_updated!("README.md");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(target_os = "wasi", ignore)]
|
||||||
fn test_html_root_url() {
|
fn test_html_root_url() {
|
||||||
version_sync::assert_html_root_url_updated!("src/lib.rs");
|
version_sync::assert_html_root_url_updated!("src/lib.rs");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue