extism-pdk 1.4.1

Extism Plug-in Development Kit (PDK) for Rust
Documentation
name: CI
on: [pull_request, workflow_dispatch]

jobs:
  test-example:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust:
          - stable
    steps:
      - uses: actions/checkout@v3
      - uses: ./.github/actions/libextism

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          override: true

      - name: Install wasm32 target
        run: rustup target add wasm32-unknown-unknown

      - name: Build plugins
        run: make -B plugins

      - name: Test call command
        run: |
          TEST=$(extism call test/code.wasm count_vowels --input "this is a test" --set-config='{"thing": "1", "a": "b"}')
          echo $TEST | grep '"count":4'

          TEST=$(extism call test/http.wasm http_get --allow-host '*' --input '{"url": "https://jsonplaceholder.typicode.com/todos/1"}')
          echo $TEST | grep '"userId": 1'

          TEST=$(extism call test/host_function.wasm count_vowels --link extism:host/user=test/host_function_host.wasm --input "this is a test" --set-config='{"thing": "1", "a": "b"}')
          echo $TEST | grep '"count":40'