Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update README #17

Merged
merged 20 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI
on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test-example:
Expand All @@ -14,18 +18,43 @@ jobs:

- name: Install Zig
uses: goto-bus-stop/setup-zig@v2

- name: Check Zig Version
run: zig version

- name: Compile example
run: |
zig build basic_example

- name: Test example
run : |
TEST=$(extism call zig-out/bin/Basic\ example.wasm --input "this is a test" --set-config='{"thing": "1", "a": "b"}' --log-level=debug count_vowels | jq)
TEST=$(extism call zig-out/bin/basic-example.wasm --input "this is a test" --set-config='{"thing": "1", "a": "b"}' --log-level=debug count_vowels | jq)
echo $TEST | grep '"count": 4'
echo $TEST | grep '"config": "1"'
echo $TEST | grep '"a": "this is var a"'

TEST=$(extism call zig-out/bin/Basic\ example.wasm make_http_request --allow-host '*')
TEST=$(extism call zig-out/bin/basic-example.wasm http_get --allow-host '*')
echo $TEST
echo $TEST | grep '"userId": 1'

TEST=$(extism call zig-out/bin/basic-example.wasm greet --config user=Benjamin)
echo $TEST
echo $TEST | grep 'Hello, Benjamin!'

TEST=$(extism call zig-out/bin/basic-example.wasm greet 2>&1 || true)
echo $TEST
echo $TEST | grep "Error: This plug-in requires a 'user' key in the config"

TEST=$(extism call zig-out/bin/basic-example.wasm add --input='{"a": 20, "b": 21}')
echo $TEST | grep '{"sum":41}'

TEST=$(extism call zig-out/bin/basic-example.wasm count --loop '3')
echo $TEST | grep '1'
echo $TEST | grep '2'
echo $TEST | grep '3'

TEST=$(extism call zig-out/bin/basic-example.wasm log_stuff --log-level 'debug' 2>&1)
echo $TEST | grep 'An info log!'
echo $TEST | grep 'A debug log!'
echo $TEST | grep 'A warning log!'
echo $TEST | grep 'An error log!'
Loading
Loading