Skip to content

Commit 8f4ce76

Browse files
mhmd-azeeznilsliceusdogu
authored
docs: Update README (#17)
* fix build errors * fix: s/little/Little on endian enum * ci: add zig version check * Revert "fix: s/little/Little on endian enum" This reverts commit 119acb0. * add setError * readme until json * feat: add getVarInt and setVarInt to be consistent with go pdk * feat: allow allocation and finding memory block from Plugin * docs: Add the rest of the README * Apply suggestions from code review Co-authored-by: Doğu Us <[email protected]> * fix Host function example * change basic example target name * add examples from readme to basic.zig * fix tests * fix tests * add more tests * only run CI for main * fix tests * fix tests * fix tests --------- Co-authored-by: Steve Manuel <[email protected]> Co-authored-by: Doğu Us <[email protected]>
1 parent 056443d commit 8f4ce76

File tree

7 files changed

+553
-42
lines changed

7 files changed

+553
-42
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: CI
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
37

48
jobs:
59
test-example:
@@ -14,18 +18,43 @@ jobs:
1418

1519
- name: Install Zig
1620
uses: goto-bus-stop/setup-zig@v2
21+
22+
- name: Check Zig Version
23+
run: zig version
1724

1825
- name: Compile example
1926
run: |
2027
zig build basic_example
2128
2229
- name: Test example
2330
run : |
24-
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)
31+
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)
2532
echo $TEST | grep '"count": 4'
2633
echo $TEST | grep '"config": "1"'
2734
echo $TEST | grep '"a": "this is var a"'
2835
29-
TEST=$(extism call zig-out/bin/Basic\ example.wasm make_http_request --allow-host '*')
36+
TEST=$(extism call zig-out/bin/basic-example.wasm http_get --allow-host '*')
3037
echo $TEST
3138
echo $TEST | grep '"userId": 1'
39+
40+
TEST=$(extism call zig-out/bin/basic-example.wasm greet --config user=Benjamin)
41+
echo $TEST
42+
echo $TEST | grep 'Hello, Benjamin!'
43+
44+
TEST=$(extism call zig-out/bin/basic-example.wasm greet 2>&1 || true)
45+
echo $TEST
46+
echo $TEST | grep "Error: This plug-in requires a 'user' key in the config"
47+
48+
TEST=$(extism call zig-out/bin/basic-example.wasm add --input='{"a": 20, "b": 21}')
49+
echo $TEST | grep '{"sum":41}'
50+
51+
TEST=$(extism call zig-out/bin/basic-example.wasm count --loop '3')
52+
echo $TEST | grep '1'
53+
echo $TEST | grep '2'
54+
echo $TEST | grep '3'
55+
56+
TEST=$(extism call zig-out/bin/basic-example.wasm log_stuff --log-level 'debug' 2>&1)
57+
echo $TEST | grep 'An info log!'
58+
echo $TEST | grep 'A debug log!'
59+
echo $TEST | grep 'A warning log!'
60+
echo $TEST | grep 'An error log!'

0 commit comments

Comments
 (0)