Skip to content

Instantly share code, notes, and snippets.

@loloof64
Created October 9, 2025 14:31
Show Gist options
  • Select an option

  • Save loloof64/be5667f93258ad11c7ac3ac415b62d1b to your computer and use it in GitHub Desktop.

Select an option

Save loloof64/be5667f93258ad11c7ac3ac415b62d1b to your computer and use it in GitHub Desktop.
My work for Manning Live project (Web Assembly and Rust) : module 2 - chapter 3
name: CI
on:
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "info"
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install apt-get packages
run: |
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
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 for wasm
run: |
rustup target add wasm32-wasip1
- name: Install WasmEdge
run: |
VERSION=0.13.0
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- --version $VERSION -p /usr/local
- name: microservice
run: |
cargo build --target wasm32-wasip1 --release
wasmedgec target/wasm32-wasip1/release/sales_tax_rate_lookup.wasm sales_tax_rate_lookup.wasm
nohup wasmedge sales_tax_rate_lookup.wasm &
echo $! > wasmedge.pid
sleep 15
###
resp=$(curl http://localhost:8001/find_rate -X POST -d "78701")
echo "$resp"
if [[ $resp == "0.0825" ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
###
resp=$(curl http://localhost:8001/find_rate -X POST -d "89102")
echo "$resp"
if [[ $resp == "8.375" ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
###
resp=$(curl http://localhost:8001/find_rate -X POST -d "12345")
echo "$resp"
if [[ $resp == "" ]]; then
echo -e "Execution Success!"
else
echo -e "Execution Fail!"
exit 1
fi
###
kill -9 `cat wasmedge.pid`
rm wasmedge.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment