-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The new code should work with both Go and TinyGo. Also move, then main.go to separate folders, that way different IDE-s and tools work with them better.
- Loading branch information
Showing
4 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
uses: actions/setup-go@v3 | ||
with: | ||
cache: true | ||
go-version: '1.21.1' | ||
go-version: '1.21.3' | ||
|
||
- name: Install TinyGo | ||
uses: acifani/[email protected] | ||
|
@@ -31,23 +31,19 @@ jobs: | |
binaryen-version: "116" | ||
|
||
- name: Compile example | ||
working-directory: go-pdk | ||
run: | | ||
pushd go-pdk | ||
ls -a | ||
pushd example | ||
go mod download | ||
popd | ||
ls -a example | ||
make -B example | ||
- name: Test example | ||
working-directory: go-pdk | ||
run: | | ||
cd go-pdk | ||
# --wasi is needed as there is currently some issue compiling Go PDK plugins without wasi | ||
TEST=$(extism call example/example.wasm --wasi --github-token="$GITHUB_TOKEN" --input "this is a test" --set-config='{"thing": "1", "a": "b"}' count_vowels) | ||
TEST=$(extism call example/tiny_countvowels.wasm --wasi --github-token="$GITHUB_TOKEN" --input "this is a test" --set-config='{"thing": "1", "a": "b"}' count_vowels) | ||
echo $TEST | grep '"count": 4' | ||
echo $TEST | grep '"config": "1"' | ||
echo $TEST | grep '"a": "this is var a"' | ||
extism call example/http.wasm --github-token="$GITHUB_TOKEN" --wasi http_get --allow-host "jsonplaceholder.typicode.com" | grep '"userId": 1' | ||
extism call example/tiny_http.wasm --wasi http_get --github-token="$GITHUB_TOKEN" --allow-host "jsonplaceholder.typicode.com" | grep '"userId": 1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
.PHONY: example | ||
example: | ||
tinygo build -o example/example.wasm -target wasi example/main.go | ||
tinygo build -o example/http.wasm -target wasi example/http.go | ||
tinygo build -o example/tiny_countvowels.wasm -target wasi ./example/countvowels | ||
tinygo build -o example/tiny_http.wasm -target wasi ./example/http | ||
|
||
GOOS=wasip1 GOARCH=wasm go build -o example/std_countvowels.wasm ./example/countvowels | ||
GOOS=wasip1 GOARCH=wasm go build -o example/std_http.wasm ./example/http | ||
|
||
test: | ||
extism call example/example.wasm count_vowels --wasi --input "this is a test" --set-config '{"thing": "1234"}' | ||
@echo "" | ||
extism call example/http.wasm http_get --wasi --log-level info --allow-host "jsonplaceholder.typicode.com" | ||
extism call example/tiny_countvowels.wasm count_vowels --wasi --input "this is a test" --set-config '{"thing": "1234"}' | ||
extism call example/tiny_http.wasm http_get --wasi --log-level info --allow-host "jsonplaceholder.typicode.com" | ||
|
||
extism call example/std_countvowels.wasm count_vowels --wasi --input "this is a test" --set-config '{"thing": "1234"}' | ||
extism call example/std_http.wasm http_get --wasi --log-level info --allow-host "jsonplaceholder.typicode.com" |
File renamed without changes.
File renamed without changes.