diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20421d2..42befb4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,22 +16,22 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.23' - name: Setup TinyGo uses: acifani/setup-tinygo@v2 with: - tinygo-version: '0.28.0' + tinygo-version: '0.35.0' - name: Setup Spin uses: fermyon/actions/spin/setup@v1 with: - version: "v2.6.0" + version: "v3.1.2" - name: Setup Wasmtime uses: bytecodealliance/actions/wasmtime/setup@v1 with: - version: "13.0.1" + version: "28.0.0" - name: Run unit tests run: make test diff --git a/Makefile b/Makefile index 5061a86..b26772b 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ VERSION = 2.3.0-pre0 # Test # ---------------------------------------------------------------------- .PHONY: test -test: test - tinygo test -target=wasi -gc=leaking -v ./http - tinygo test -target=wasi -gc=leaking -v ./redis +test: + tinygo test -target=wasip1 -gc=leaking -buildmode=c-shared -v ./http + tinygo test -target=wasip1 -gc=leaking -buildmode=c-shared -v ./redis .PHONY: test-integration test-integration: diff --git a/examples/http-outbound/README.md b/examples/http-outbound/README.md index 14880b3..974491a 100644 --- a/examples/http-outbound/README.md +++ b/examples/http-outbound/README.md @@ -16,9 +16,9 @@ Building this as a WebAssembly module can be done using the `tinygo` compiler: ```shell $ spin build -Building component outbound-http-to-same-app with `tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go` +Building component outbound-http-to-same-app with `tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm .` Working directory: "./outbound-http-to-same-app" -Building component tinygo-hello with `tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go` +Building component tinygo-hello with `tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm .` Working directory: "./tinygo-hello" Finished building all Spin components ``` diff --git a/examples/http-outbound/spin.toml b/examples/http-outbound/spin.toml index 143156a..3b5f585 100644 --- a/examples/http-outbound/spin.toml +++ b/examples/http-outbound/spin.toml @@ -22,7 +22,7 @@ allowed_outbound_hosts = [ ] [component.hello.build] workdir = "hello" -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." [component.http-to-same-app] source = "http-to-same-app/main.wasm" @@ -30,4 +30,4 @@ source = "http-to-same-app/main.wasm" allowed_outbound_hosts = ["http://self"] [component.http-to-same-app.build] workdir = "http-to-same-app" -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/http-router/spin.toml b/examples/http-router/spin.toml index dbbb4f3..9963005 100644 --- a/examples/http-router/spin.toml +++ b/examples/http-router/spin.toml @@ -13,4 +13,4 @@ component = "hello" [component.hello] source = "main.wasm" [component.hello.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/http/spin.toml b/examples/http/spin.toml index 3b975d4..72a0d5d 100644 --- a/examples/http/spin.toml +++ b/examples/http/spin.toml @@ -13,4 +13,4 @@ component = "hello" [component.hello] source = "main.wasm" [component.hello.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/key-value/spin.toml b/examples/key-value/spin.toml index 722f0c3..3bda7ec 100644 --- a/examples/key-value/spin.toml +++ b/examples/key-value/spin.toml @@ -13,4 +13,4 @@ component = "key-value" source = "main.wasm" key_value_stores = ["default"] [component.key-value.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/llm/spin.toml b/examples/llm/spin.toml index 6cdcd42..218c2df 100644 --- a/examples/llm/spin.toml +++ b/examples/llm/spin.toml @@ -15,5 +15,5 @@ source = "main.wasm" allowed_outbound_hosts = [] ai_models = ["llama2-chat", "all-minilm-l6-v2"] [component.llm.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." watch = ["**/*.go", "go.mod"] diff --git a/examples/mysql-outbound/spin.toml b/examples/mysql-outbound/spin.toml index 3a023e8..dcb15df 100644 --- a/examples/mysql-outbound/spin.toml +++ b/examples/mysql-outbound/spin.toml @@ -15,5 +15,5 @@ environment = { DB_URL = "mysql://spin:spin@127.0.0.1/spin_dev" } source = "main.wasm" allowed_outbound_hosts = ["mysql://127.0.0.1"] [component.mysql.build] -command = "tinygo build -target=wasi -gc=leaking -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." watch = ["**/*.go", "go.mod"] diff --git a/examples/pg-outbound/spin.toml b/examples/pg-outbound/spin.toml index 60ec0a3..ca8739b 100644 --- a/examples/pg-outbound/spin.toml +++ b/examples/pg-outbound/spin.toml @@ -15,5 +15,5 @@ environment = { DB_URL = "host=localhost user=postgres dbname=spin_dev" } source = "main.wasm" allowed_outbound_hosts = ["postgres://localhost"] [component.pg-outbound.build] -command = "tinygo build -target=wasi -gc=leaking -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." watch = ["**/*.go", "go.mod"] diff --git a/examples/redis-outbound/spin.toml b/examples/redis-outbound/spin.toml index 8a44341..8040054 100644 --- a/examples/redis-outbound/spin.toml +++ b/examples/redis-outbound/spin.toml @@ -14,4 +14,4 @@ source = "main.wasm" environment = { REDIS_ADDRESS = "redis://127.0.0.1:6379", REDIS_CHANNEL = "messages" } allowed_outbound_hosts = ["redis://127.0.0.1"] [component.outbound-redis.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/redis/spin.toml b/examples/redis/spin.toml index d46a3b5..2c1458f 100644 --- a/examples/redis/spin.toml +++ b/examples/redis/spin.toml @@ -16,4 +16,4 @@ component = "echo-message" [component.echo-message] source = "main.wasm" [component.echo-message.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/examples/sqlite/spin.toml b/examples/sqlite/spin.toml index 5bdee1d..205483c 100644 --- a/examples/sqlite/spin.toml +++ b/examples/sqlite/spin.toml @@ -15,5 +15,5 @@ source = "main.wasm" allowed_outbound_hosts = [] sqlite_databases = ["default"] [component.sqlite.build] -command = "tinygo build -target=wasi -gc=leaking -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." watch = ["**/*.go", "go.mod"] diff --git a/examples/variables/spin.toml b/examples/variables/spin.toml index a765601..5f5c91e 100644 --- a/examples/variables/spin.toml +++ b/examples/variables/spin.toml @@ -18,4 +18,4 @@ source = "main.wasm" [component.variables.variables] message = "I'm a {{object}}" [component.variables.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." diff --git a/http/testdata/http-tinygo/Makefile b/http/testdata/http-tinygo/Makefile index 3e71525..b905087 100644 --- a/http/testdata/http-tinygo/Makefile +++ b/http/testdata/http-tinygo/Makefile @@ -1,3 +1,3 @@ .PHONY: build build: - tinygo build -target=wasi -gc=leaking -o main.wasm main.go + tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm . diff --git a/http/testdata/http-tinygo/spin.toml b/http/testdata/http-tinygo/spin.toml index 10f42ca..f132116 100644 --- a/http/testdata/http-tinygo/spin.toml +++ b/http/testdata/http-tinygo/spin.toml @@ -1,14 +1,18 @@ -spin_version = "1" +spin_manifest_version = 2 + +[application] +name = "spin-http-tinygo-test" +version = "0.1.0" authors = ["Fermyon Engineering "] description = "A simple Spin application written in (Tiny)Go." -name = "spin-http-tinygo-test" -trigger = { type = "http" } -version = "1.0.0" -[[component]] -id = "http-tinygo-test" -source = "main.wasm" -[component.trigger] +[[trigger.http]] route = "/hello/..." -[component.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +component = "http-test" + +[component.http-test] +source = "main.wasm" +allowed_outbound_hosts = [] +[component.http-test.build] +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." +watch = ["**/*.go", "go.mod"] diff --git a/http/testdata/spin-roundtrip/Makefile b/http/testdata/spin-roundtrip/Makefile index 3e71525..b905087 100644 --- a/http/testdata/spin-roundtrip/Makefile +++ b/http/testdata/spin-roundtrip/Makefile @@ -1,3 +1,3 @@ .PHONY: build build: - tinygo build -target=wasi -gc=leaking -o main.wasm main.go + tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm . diff --git a/http/testdata/spin-roundtrip/spin.toml b/http/testdata/spin-roundtrip/spin.toml index 4613d21..66b3880 100644 --- a/http/testdata/spin-roundtrip/spin.toml +++ b/http/testdata/spin-roundtrip/spin.toml @@ -1,15 +1,18 @@ -spin_version = "1" +spin_manifest_version = 2 + +[application] +name = "spin-roundtrip-test" +version = "0.1.0" authors = ["Fermyon Engineering "] description = "A simple Spin application written in (Tiny)Go." -name = "spin-roundtrip-test" -trigger = { type = "http" } -version = "1.0.0" -[[component]] -id = "http-roundtrip-test" +[[trigger.http]] +route = "/hello/..." +component = "http-roundtrip-test" + +[component.http-roundtrip-test] source = "main.wasm" allowed_outbound_hosts = ["https://example.com"] -[component.trigger] -route = "/hello/..." -[component.build] -command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go" +[component.http-roundtrip-test.build] +command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." +watch = ["**/*.go", "go.mod"]