example_0.13.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: examples 0.13
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. logLevel:
  6. description: 'Log level'
  7. required: true
  8. default: 'info'
  9. push:
  10. branches: [ main ]
  11. pull_request:
  12. branches: [ main ]
  13. jobs:
  14. build:
  15. runs-on: ubuntu-20.04
  16. steps:
  17. - uses: actions/checkout@v2
  18. - name: Install apt-get packages
  19. run: |
  20. sudo ACCEPT_EULA=Y apt-get update
  21. sudo ACCEPT_EULA=Y apt-get upgrade
  22. sudo apt-get install wget git curl software-properties-common build-essential
  23. - name: Install Rust target
  24. run: |
  25. rustup target add wasm32-wasi
  26. - name: Install WasmEdge
  27. run: |
  28. VERSION=0.13.5
  29. 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
  30. # Disable this example due to it relies on wasmedge_http_req, which is a cyclic dependence
  31. # - name: HTTP client example
  32. # run: |
  33. # cd examples/http_client/
  34. # cargo build --target wasm32-wasi --release
  35. # wasmedge target/wasm32-wasi/release/http_client.wasm
  36. - name: HTTP async client example
  37. run: |
  38. cd examples/nonblock_http_client/
  39. cargo build --target wasm32-wasi --release
  40. wasmedge target/wasm32-wasi/release/nonblock_http_client.wasm
  41. - name: HTTP server example
  42. run: |
  43. cd examples/http_server/
  44. cargo build --target wasm32-wasi --release
  45. nohup wasmedge target/wasm32-wasi/release/http_server.wasm &
  46. echo $! > wasmedge.pid
  47. wasmedge_pid=$(cat wasmedge.pid)
  48. sleep 5
  49. echo "fds:"
  50. ls /proc/$wasmedge_pid/fd
  51. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  52. echo "Server response is $resp"
  53. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  54. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  55. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  56. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  57. resp=$(curl -X POST http://127.0.0.1:1234 -d "name=WasmEdge")
  58. echo "after 6 request, fds:"
  59. ls /proc/$wasmedge_pid/fd
  60. kill -9 $wasmedge_pid
  61. rm wasmedge.pid
  62. - name: UDP Socket Example
  63. run: |
  64. cargo build --target wasm32-wasi --example=udp_socket --release
  65. wasmedge target/wasm32-wasi/release/examples/udp_socket.wasm
  66. - name: DNS Example
  67. run: |
  68. cargo build --target wasm32-wasi --example=get_addrinfo --release
  69. wasmedge target/wasm32-wasi/release/examples/get_addrinfo.wasm
  70. - name: ToSocketAddrs Example
  71. run: |
  72. cargo build --target wasm32-wasi --example=socket_addr --release
  73. wasmedge target/wasm32-wasi/release/examples/socket_addr.wasm