-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (52 loc) · 2.2 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-example:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/libextism
- 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)
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 http_get --allow-host '*')
echo $TEST
echo $TEST | grep 'user=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!'
TEST=$(extism call zig-out/bin/basic-example.wasm json_input --input '{"name": "Yoda", "age": 900}')
echo $TEST | grep 'Hello, Yoda. You are 900 years old!'
TEST=$(extism call zig-out/bin/basic-example.wasm json_output)
echo $TEST | grep '["first thing","second thing","third thing"]'