Skip to content

[Lib] Add the implementation of AsFd #3

[Lib] Add the implementation of AsFd

[Lib] Add the implementation of AsFd #3

Workflow file for this run

name: examples 0.13
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 --tf-version=$VERSION --tf-deps-version=$VERSION --tf-tools-version=$VERSION --image-version=$VERSION -p /usr/local
# Disable this example due to it relies on wasmedge_http_req, which is a cyclic dependence
# - name: HTTP client example
# run: |
# cd examples/http_client/
# cargo build --target wasm32-wasi --release
# wasmedge target/wasm32-wasi/release/http_client.wasm
- name: HTTP async client example
run: |
cd examples/nonblock_http_client/
cargo build --target wasm32-wasi --release
wasmedge target/wasm32-wasi/release/nonblock_http_client.wasm
- name: HTTP server example
run: |
cd examples/http_server/
cargo build --target wasm32-wasi --release
nohup wasmedge target/wasm32-wasi/release/http_server.wasm &
echo $! > wasmedge.pid
wasmedge_pid=$(cat wasmedge.pid)
sleep 5
echo "fds:"
ls /proc/$wasmedge_pid/fd
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
echo "Server response is $resp"
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
echo "after 6 request, fds:"
ls /proc/$wasmedge_pid/fd
kill -9 $wasmedge_pid
rm wasmedge.pid
- name: UDP Socket Example
run: |
cargo build --target wasm32-wasi --example=udp_socket --release
wasmedge target/wasm32-wasi/release/examples/udp_socket.wasm
- name: DNS Example
run: |
cargo build --target wasm32-wasi --example=get_addrinfo --release
wasmedge target/wasm32-wasi/release/examples/get_addrinfo.wasm
- name: ToSocketAddrs Example
run: |
cargo build --target wasm32-wasi --example=socket_addr --release
wasmedge target/wasm32-wasi/release/examples/socket_addr.wasm