Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Add support for WASMI #5129

Merged
merged 13 commits into from
Oct 10, 2024
Merged
4 changes: 2 additions & 2 deletions .github/cross-linux-riscv64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN apt-get update && \
# install rust tools
RUN curl --proto "=https" --tlsv1.2 --retry 3 -sSfL https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup -v toolchain install 1.78
RUN rustup -v toolchain install 1.79
# add docker the manual way
COPY install_docker.sh /
RUN /install_docker.sh
Expand Down Expand Up @@ -61,7 +61,7 @@ ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/riscv64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"

RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.78-x86_64-unknown-linux-gnu
RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.79-x86_64-unknown-linux-gnu

#compile libssl-dev for riscv64!
COPY build_openssl.sh /
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.78"
MSRV: "1.79"

jobs:
run_benchmark:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Builds
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.78"
MSRV: "1.79"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cloudcompiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release cloudcompiler.wasm

env:
RUST_BACKTRACE: 1
MSRV: "1.78"
MSRV: "1.79"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'lib/**'

env:
MSRV: "1.78"
MSRV: "1.79"

jobs:
documentation:
Expand Down
74 changes: 73 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
# Rust, but it's not stable on 1.69 yet. By explicitly setting the protocol we
# can override that behaviour
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.78"
MSRV: "1.79"
NEXTEST_PROFILE: "ci"
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
WASI_SDK_VERSION: "22"
Expand Down Expand Up @@ -206,6 +206,54 @@ jobs:
- name: make build-wasmer-jsc
run: make build-wasmer-jsc

test_interpreter_api:
name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }}
runs-on: ${{ matrix.metadata.os }}
strategy:
fail-fast: false
matrix:
build-what: [
{
key: wamr,
build-cmd: 'make test-wamr-api',
name: 'Test API for wamr feature'
},
{
key: wasmi,
build-cmd: 'make test-wasmi-api',
name: 'Test API for wasmi feature'
}
]
metadata: [
{
build: linux-x64,
os: ubuntu-22.04,
},
{
build: macos-arm,
os: macos-14,
},
{
build: windows-x64,
os: windows-2022,
}
]
container: ${{ matrix.metadata.container }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.MSRV }}
- name: Install Nextest
uses: taiki-e/install-action@nextest
- name: Test WAMR API
if: ${{ matrix.build-what.key == 'wamr' }}
run: ${{ matrix.build-what.build-cmd }}

- name: Test wasmi API
if: ${{ matrix.build-what.key == 'wasmi' }}
run: ${{ matrix.build-what.build-cmd }}

test_build_docs_rs:
name: Test build docs rs
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -858,6 +906,30 @@ jobs:
CARGO_TARGET: ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test CLI integration (WAMR)
shell: bash
run: |
export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }}
export WASMER_DIR=`pwd`/package && make test-integration-cli-wamr-ci
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test CLI integration (WASMI)
shell: bash
run: |
export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }}
export WASMER_DIR=`pwd`/package && make test-integration-cli-wasmi-ci
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


# there is another set of integration tests in 'wasmer-integration-tests' repo. Run those
test-wasmer-integration-tests:
Expand Down
114 changes: 113 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version.workspace = true
[dependencies]
wasmer = { version = "=4.3.7", path = "lib/api", default-features = false }
wasmer-compiler = { version = "=4.3.7", path = "lib/compiler", features = [
"compiler",
"compiler",

], optional = true }
wasmer-compiler-cranelift = { version = "=4.3.7", path = "lib/compiler-cranelift", optional = true }
Expand Down Expand Up @@ -105,14 +105,16 @@ hyper = "1"
reqwest = { version = "0.12.0", default-features = false }
enumset = "1.1.0"
memoffset = "0.9.0"
wasmparser = { version = "0.216.0", default-features = false, features = ["validate"]}
wasmparser = { version = "0.216.0", default-features = false, features = [
"validate",
] }
rkyv = { version = "0.7.40", features = ["indexmap", "validation", "strict"] }
memmap2 = { version = "0.6.2" }
toml = { version = "0.5.9", features = ["preserve_order"] }
indexmap = "2"
serde_yaml = "0.9.34"
libc = { version = "^0.2", default-features = false }
gimli = { version = "0.28.1"}
gimli = { version = "0.28.1" }

[build-dependencies]
test-generator = { path = "tests/lib/test-generator" }
Expand All @@ -123,9 +125,9 @@ rustc_version = "0.4"

[dev-dependencies]
wasmer = { version = "=4.3.7", path = "lib/api", features = [
"compiler",
"singlepass",
"sys",
"compiler",
"singlepass",
"sys",
] }
anyhow = "1.0"
criterion = { version = "0.5", default-features = false }
Expand Down Expand Up @@ -163,6 +165,7 @@ default = [
backend = []
jsc = ["wasmer/jsc", "backend", "wat", "wasmer/std"]
wamr = ["wasmer/wamr"]
wasmi = ["wasmer/wasmi"]
engine = ["universal"]
universal = []
cache = ["wasmer-cache"]
Expand Down
Loading
Loading