Skip to content

Commit

Permalink
Merge commit '6be2ef9107e05ff46174f27bd50d56cbf208bb18' into refactor…
Browse files Browse the repository at this point in the history
…/sdk_preview
  • Loading branch information
L-jasmine committed Nov 17, 2023
2 parents 6132ffe + 6be2ef9 commit 6175164
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 79 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
paths-ignore:
- "**/*.md"
- ".github/workflows/standalone.yml"
- ".github/workflows/rust-static-lib.yml"
pull_request:
paths-ignore:
- "**/*.md"
- ".github/workflows/standalone.yml"
- ".github/workflows/rust-static-lib.yml"

jobs:
build_ubuntu:
Expand All @@ -21,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]
container:
image: wasmedge/wasmedge:ubuntu-build-clang

Expand Down Expand Up @@ -90,7 +92,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]
container:
image: fedora:latest

Expand Down Expand Up @@ -166,8 +168,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12]
rust: [1.72, 1.71, 1.70.0]
os: [macos-12, macos-13]
rust: [1.73, 1.72, 1.71]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -222,7 +224,7 @@ jobs:
runs-on: windows-2022
strategy:
matrix:
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]
env:
WASMEDGE_DIR: ${{ github.workspace }}\WasmEdge
WASMEDGE_BUILD_DIR: ${{ github.workspace }}\WasmEdge\build
Expand Down
66 changes: 20 additions & 46 deletions .github/workflows/rust-static-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@ concurrency:

on:
push:
branches:
- master
- "rust/*"
paths:
- ".github/workflows/rust-static-lib.yml"
- "bindings/rust/**"
- "include/api/wasmedge/**"
- "lib/api/**"
paths-ignore:
- "**/*.md"
- ".github/workflows/standalone.yml"
- ".github/workflows/ci-build.yml"
pull_request:
branches:
- master
paths:
- ".github/workflows/rust-static-lib.yml"
- "bindings/rust/**"
- "include/api/wasmedge/**"
- "lib/api/**"
paths-ignore:
- "**/*.md"
- ".github/workflows/standalone.yml"
- ".github/workflows/ci-build.yml"

jobs:
build_ubuntu:
Expand All @@ -30,49 +23,30 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
rust: [1.69, 1.68]
rust: [1.73, 1.72, 1.71]
container:
image: wasmedge/wasmedge:latest
image: wasmedge/wasmedge:ubuntu-build-clang

steps:
- uses: actions/checkout@v3
- name: Checkout WasmEdge Rust SDK
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build WasmEdge with Release mode
- name: Install dependencies
run: |
apt update
apt install -y software-properties-common libboost-all-dev llvm-15-dev liblld-15-dev ninja-build
cmake cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_LINK_LLVM_STATIC=ON -DWASMEDGE_BUILD_SHARED_LIB=OFF -DWASMEDGE_BUILD_STATIC_LIB=ON -DWASMEDGE_LINK_TOOLS_STATIC=ON -DWASMEDGE_BUILD_PLUGINS=OFF .
cmake --build build
- name: Install Rust-nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy

- name: Rustfmt
working-directory: bindings/rust/
run: cargo +nightly fmt --all -- --check

- name: Clippy
working-directory: bindings/rust/
run: |
export WASMEDGE_DIR="$(pwd)/../../"
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
cargo +nightly clippy -V
cargo +nightly clippy --lib --examples --features static -- -D warnings
apt install -y software-properties-common llvm-15-dev liblld-15-dev ninja-build
- name: Install Rust-stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}

- name: Test Rust Bindings
working-directory: bindings/rust/
- name: Test Rust SDK
run: |
cargo test -p wasmedge-sdk --all --examples --features static,aot,wasmedge_process,ffi -- --nocapture --test-threads=1
- name: Test Rust SDK with async feature
run: |
export WASMEDGE_DIR="$(pwd)/../../"
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
cargo +nightly -Z sparse-registry update
cargo test --workspace --features static --locked -- --test-threads=1
cargo test --examples --features static --locked -- --test-threads=1
cargo test -p wasmedge-sdk --all --examples --features static,aot,async,wasmedge_process,ffi -- --nocapture --test-threads=1
12 changes: 7 additions & 5 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ on:
paths-ignore:
- "**/*.md"
- ".github/workflows/ci-build.yml"
- ".github/workflows/rust-static-lib.yml"

pull_request:
paths-ignore:
- "**/*.md"
- ".github/workflows/ci-build.yml"
- ".github/workflows/rust-static-lib.yml"

jobs:
build_ubuntu_2204:
name: Ubuntu
runs-on: ubuntu-22.04
strategy:
matrix:
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]

steps:
- name: Checkout WasmEdge Rust SDK
Expand Down Expand Up @@ -55,7 +57,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]

steps:
- name: Checkout WasmEdge Rust SDK
Expand Down Expand Up @@ -89,8 +91,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12]
rust: [1.72, 1.71, 1.70.0]
os: [macos-12, macos-13]
rust: [1.73, 1.72, 1.71]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -119,7 +121,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.72, 1.71, 1.70.0]
rust: [1.73, 1.72, 1.71]
container:
image: fedora:latest

Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,45 @@

All notable changes to this project will be documented in this file.

## [0.13.2] - 2023-11-15

### 🐛 Bug Fixes

- Fix the static build to link against `zstd` ([#91](https://github.com/orhun/git-cliff/issues/91))

## [0.13.1] - 2023-11-14

- Update the `wat` dep. This update is to fix [#88](https://github.com/WasmEdge/wasmedge-rust-sdk/issues/88).

## [0.13.0] - 2023-11-07

### ⛰️ Features

- New API `PluginManager::nn_preload`. This API is used to initialize the `wasi_nn` plug-in with given preloads ([#74](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/74))

- Implement `FromStr` trait for `NNPreload` struct ([#81](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/81))

### 🚜 Refactor

- [BREAKING] Update the argument types ([#82](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/82)):
- `VmBuilder::with_plugin`
- `VmBuilder::with_plugin_wasi_nn`
- `VmBuilder::with_plugin_wasi_crypto`
- `VmBuilder::with_plugin_wasmedge_process`

- [BREAKING] Update the argument types ([#76](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/76)):
- `Executor::run_func_with_timeout` and `Executor::run_func_async_with_timeout`
- `Vm::run_func_with_timeout` and `Vm::run_func_async_with_timeout`
- `Func::run_with_timeout` and `Func::run_async_with_timeout`

### 🐛 Bug Fixes

- Introduce new C-API `WasmEdge_FunctionInstanceGetData` to fix the memory leak issue caused by host data ([#84](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/84))

### Ci

- Support `macos-13` and remove `macos-11` from the `ci-build` and `standalone` workflows ([#84](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/84))

## [0.12.2] - 2023-09-22

### 🚜 Refactor
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"
name = "wasmedge-sdk"
readme = "README.md"
repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
version = "0.12.3-dev"
version = "0.13.2"

[dependencies]
anyhow = "1.0"
Expand All @@ -17,7 +17,7 @@ num-derive = "0.3"
num-traits = "0.2"
thiserror = "1.0.30"
wasmedge-macro.workspace = true
wasmedge-sys = { path = "crates/wasmedge-sys", version = "0.17", default-features = false }
wasmedge-sys = { path = "crates/wasmedge-sys", version = "0.17.5", default-features = false }
wasmedge-types.workspace = true

[workspace.dependencies]
Expand All @@ -26,7 +26,7 @@ cfg-if = "1.0.0"
parking_lot = "0.12.1"
wasmedge-macro = { path = "crates/wasmedge-macro", version = "0.6" }
wasmedge-types = { path = "crates/wasmedge-types", version = "0.4" }
wat = "=1.0.67"
wat = "1.0"

[target.'cfg(target_os = "linux")'.dependencies]
async-wasi = { workspace = true, optional = true }
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ This crate depends on the WasmEdge C API. In linux/macOS the crate can download

| wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
| :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
| 0.13.2 | 0.13.5 | 0.17.5 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.13.1 | 0.13.5 | 0.17.4 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.13.0 | 0.13.5 | 0.17.3 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
Expand Down Expand Up @@ -58,7 +61,7 @@ The following architectures are supported for automatic downloads:

This crate uses `rust-bindgen` during the build process. If you would like to use an external `rust-bindgen` you can set the `WASMEDGE_RUST_BINDGEN_PATH` environment variable to the `bindgen` executable path. This is particularly useful in systems like Alpine Linux (see [rust-lang/rust-bindgen#2360](https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595869379), [rust-lang/rust-bindgen#2333](https://github.com/rust-lang/rust-bindgen/issues/2333)).

**Notice:** The minimum supported Rust version is 1.70.
**Notice:** The minimum supported Rust version is 1.71.

## API Reference

Expand Down
6 changes: 3 additions & 3 deletions crates/wasmedge-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ links = "wasmedge"
name = "wasmedge-sys"
readme = "README.md"
repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
version = "0.17.3"
version = "0.17.5"

[dependencies]
fiber-for-wasmedge = { version = "8.0.1", optional = true }
fiber-for-wasmedge = { version = "14.0.4", optional = true }
libc = "0.2.94"
paste = "1.0.5"
scoped-tls = "1"
Expand All @@ -32,7 +32,7 @@ async-wasi = { workspace = true, optional = true }
setjmp = "0.1"

[build-dependencies]
bindgen = { version = "0.65", default-features = false, features = ["runtime"] }
bindgen = { version = "0.69", default-features = false, features = ["runtime"] }
cmake = "0.1"
reqwest = { version = "0.11", default-features = false, features = [
"blocking",
Expand Down
22 changes: 11 additions & 11 deletions crates/wasmedge-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use build_standalone::*;

use crate::build_paths::AsPath;

const WASMEDGE_RELEASE_VERSION: &str = "0.13.4";
const WASMEDGE_RELEASE_VERSION: &str = "0.13.5";
const REMOTE_ARCHIVES: phf::Map<&'static str, (&'static str, &'static str)> = phf_map! {
// The key is: {os}/{arch}[/{libc}][/static]
// * The libc abi is only added on linux.
Expand All @@ -18,14 +18,14 @@ const REMOTE_ARCHIVES: phf::Map<&'static str, (&'static str, &'static str)> = ph
// The value is a tuple containing the sha256sum of the archive, and the platform slug as it appears in the archive name:
// * The archive name is WasmEdge-{version}-{slug}.tar.gz

"macos/aarch64" => ("97f92a16c658eb3516f6cece8b9af97a33a349a4617d037b633adb64e5a51d83", "darwin_arm64"),
"macos/x86_64" => ("5a94300d9864b2a4bf828771cc7c1a7aba5e1b9fd10917399213cce35cdd9d24", "darwin_x86_64"),
"linux/aarch64/gnu" => ("a3be7e47b1783cf306833b8e6f84baa1c4f2df1f5c00489963efea8047c67619", "manylinux2014_aarch64"),
"linux/x86_64/gnu" => ("618a68538360c15fca39cafe643b468d3112a09e2a0ef6b1f1f050480451091a", "manylinux2014_x86_64"),
"linux/aarch64/gnu/static" => ("e1f7e0e4af70896938e1feaf1b9b344480705355b1129408eac651f412e96d0b", "debian11_aarch64_static"),
"linux/x86_64/gnu/static" => ("6edc597529f6a8e6d85f16fb154af467c26250e865fd742c9587167a8108d9dc", "debian11_x86_64_static"),
"linux/aarch64/musl/static" => ("ecea83b49f785e616e738b08a3caea644e0e07398c448e9b6f1f199bbede915e", "alpine3.16_aarch64_static"),
"linux/x86_64/musl/static" => ("536e03af5d92c2d0788c40fbad3f8000553fd9c9dd6f0599b541b69c2e39fb96", "alpine3.16_x86_64_static"),
"macos/aarch64" => ("acc93721210294ced0887352f360e42e46dcc05332e6dd78c1452fb3a35d5255", "darwin_arm64"),
"macos/x86_64" => ("b7fdfaf59805951241f47690917b501ddfa06d9b6f7e0262e44e784efe4a7b33", "darwin_x86_64"),
"linux/aarch64/gnu" => ("472de88e0257c539c120b33fdd1805e1e95063121acc2df1d5626e4676b93529", "manylinux2014_aarch64"),
"linux/x86_64/gnu" => ("3686e0226871bf17b62ec57e1c15778c2947834b90af0dfad14f2e0202bf9284", "manylinux2014_x86_64"),
"linux/aarch64/gnu/static" => ("a8a355a7cebf65d4134593e0c2f5af0721798efcd257cf8a18dfd8775c2d0b30", "debian11_aarch64_static"),
"linux/x86_64/gnu/static" => ("57ec3d36ee58488d4bb798f7517fce15be81fb4e113a5e1804bca34600b1ade3", "debian11_x86_64_static"),
"linux/aarch64/musl/static" => ("0670afb18aad8fb54a72829d5c14e68e631a66fd3b468516a15a0826f2c5dd9e", "alpine3.16_aarch64_static"),
"linux/x86_64/musl/static" => ("6ef5be580febb09218caca87f2d73e7c830fb98239ec02a2994617aaed9e7bd9", "alpine3.16_x86_64_static"),
};

lazy_static! {
Expand Down Expand Up @@ -98,7 +98,7 @@ fn main() {
// Tell cargo to tell rustc to link our `wasmedge` library. Cargo will
// automatically know it must look for a `libwasmedge.a` file.
println!("cargo:rustc-link-lib=static=wasmedge");
for dep in ["rt", "dl", "pthread", "m", "stdc++"] {
for dep in ["rt", "dl", "pthread", "m", "zstd", "stdc++"] {
link_lib(dep);
}
} else {
Expand Down Expand Up @@ -136,7 +136,7 @@ fn main() {
.clang_arg(format!("-I{inc_dir}"))
.prepend_enum_name(false)
.dynamic_link_require_all(true)
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("failed to generate bindings")
.write_to_file(out_file)
Expand Down
4 changes: 4 additions & 0 deletions crates/wasmedge-sys/src/ast_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ mod tests {
};
use wasmedge_types::{ExternalInstanceType, Mutability, RefType, ValType};

#[ignore = "need to update `import.wat`"]
#[test]
fn test_module_import() {
let path = std::env::current_dir()
Expand Down Expand Up @@ -557,6 +558,7 @@ mod tests {
}
}

#[ignore = "need to update `import.wat`"]
#[test]
fn test_module_export() {
let path = std::env::current_dir()
Expand Down Expand Up @@ -711,6 +713,7 @@ mod tests {
}
}

#[ignore = "need to update `import.wat`"]
#[test]
fn test_module_send() {
let path = std::env::current_dir()
Expand Down Expand Up @@ -869,6 +872,7 @@ mod tests {
handle.join().unwrap();
}

#[ignore = "need to update `import.wat`"]
#[test]
fn test_module_sync() {
let path = std::env::current_dir()
Expand Down
Loading

0 comments on commit 6175164

Please sign in to comment.