Skip to content

Bump version to 0.6.0-alpha #1666

Bump version to 0.6.0-alpha

Bump version to 0.6.0-alpha #1666

Workflow file for this run

name: examples
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install apt-get packages
run: |
sudo ACCEPT_EULA=Y apt-get update
sudo ACCEPT_EULA=Y apt-get upgrade
sudo apt-get install wget git curl software-properties-common build-essential
- name: Install Rust target
run: |
rustup target add wasm32-wasi
- name: Install WasmEdge
run: |
VERSION=0.13.5
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -e all --version=$VERSION --plugins wasi_nn-tensorflowlite wasi_crypto -p /usr/local
wget https://github.com/WasmEdge/WasmEdge/releases/download/$VERSION/WasmEdge-plugin-wasmedge_rustls-$VERSION-ubuntu20.04_x86_64.tar.gz
sudo chmod +x /usr/local/lib/wasmedge
tar -zxf WasmEdge-plugin-wasmedge_rustls-*-ubuntu20.04_x86_64.tar.gz
sudo mv libwasmedge_rustls.so /usr/local/lib/wasmedge/
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Regular examples
run: |
cargo build --target wasm32-wasi --release
wasmedge --env 'a=1' --env 'b=1' --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/hello.js WasmEdge Runtime
- name: Image examples
run: |
cargo build --target wasm32-wasi --release --features=img
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/image.js
- name: Modules examples
run: |
cargo build --target wasm32-wasi --release
cp example_js/module_demo/modules/* modules/
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/module_demo/demo.js
- name: Network example
run: |
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/wasi_net_echo.js
- name: Http fetch example
run: |
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/wasi_http_fetch.js
- name: Http server example
run: |
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/wasi_http_echo.js &
- name: Https fetch example
run: |
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/wasi_https_fetch.js
- name: ES6 module
run: |
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/es6_module_demo/demo.js
- name: CommonJs with rollup.js
run: |
cargo build --target wasm32-wasi --release
cd example_js/simple_common_js_demo
npm install
npm run build
echo '> wasmedge aot'
cd ../..
wasmedgec target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
echo '> start wasmedge'
time wasmedge --dir .:. wasmedge_quickjs.wasm example_js/simple_common_js_demo/dist/npm_main.mjs
- name: React SSR
run: |
cargo build --target wasm32-wasi --release
cd example_js/react_ssr
npm install
npm run build
cp -r ../../modules .
echo '> start wasmedge'
wasmedge --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm dist/main.js
- name: React Stream SSR
run: |
cargo build --target wasm32-wasi --release
cd example_js/react_ssr_stream
npm install
npm run build
cp -r ../../modules .
echo '> start wasmedge'
nohup wasmedge --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm dist/main.mjs &
sleep 15
resp=$(curl http://localhost:8001)
echo "Server response is $resp"
- name: React18 Stream SSR example
run: |
cargo build --target wasm32-wasi --release
cd example_js/react18_ssr
npm install
npm run build
cp -r ../../modules .
echo '> start wasmedge'
nohup wasmedge --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm dist/main.mjs &
sleep 15
resp=$(curl http://localhost:8002)
echo "$resp"
- name: Create-react-app SSR example
run: |
cargo build --target wasm32-wasi --release
cd example_js/create-react-app-ssr
npm install
npm run build
cp -r ../../modules .
# Use webpack
npm run webpack:build-server
echo '> start wasmedge server transpiled by Webpack'
nohup wasmedge --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm server-build/index.js &
echo $! > wasmedge.pid
sleep 15
resp=$(curl http://localhost:8003)
echo "$resp"
kill -9 `cat wasmedge.pid`
rm wasmedge.pid
# Use rollup.js
npm run rollup:build-server
echo '> start wasmedge server transpiled by rollup'
nohup wasmedge --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm server-build/index.js &
sleep 15
resp=$(curl http://localhost:8003)
echo "$resp"
- name: WASI-NN example (TensorflowLite)
run: |
cargo build --target wasm32-wasi --release --features=wasi_nn
wasmedge --dir .:. target/wasm32-wasi/release/wasmedge_quickjs.wasm example_js/tensorflow_lite_demo/wasi_nn_main.js
- name: Embed JS in Rust
run: |
cd examples/embed_js
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/embed_js.wasm
- name: Embed JS module in Rust
run: |
cd examples/embed_js_module
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/embed_js_module.wasm
- name: Use Rust to implement JS APIs
run: |
cd examples/embed_rust_module
cargo build --target wasm32-wasi --release
wasmedge --dir .:. target/wasm32-wasi/release/embed_rust_module.wasm
- name: Use Rust to extends JS Class
run: |
cargo build --target wasm32-wasi --release --example=js_extend
wasmedge --dir .:. target/wasm32-wasi/release/examples/js_extend.wasm
- name: Node fs module test
timeout-minutes: 60
run: |
cargo test test_fs --target=wasm32-wasi --release
- name: Node crypto module test
#timeout-minutes: 10
run: |
cargo test test_crypto --target=wasm32-wasi --release --features=nodejs_crypto