diff --git a/.github/actions/spin-ci-dependencies/action.yml b/.github/actions/spin-ci-dependencies/action.yml index 28fe5200b3..5e8839c1a9 100644 --- a/.github/actions/spin-ci-dependencies/action.yml +++ b/.github/actions/spin-ci-dependencies/action.yml @@ -8,7 +8,7 @@ inputs: type: bool rust-version: description: 'Rust version to setup' - default: '1.91' + default: '1.93' required: false type: string diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b527c384d..fe83f726df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ concurrency: env: CARGO_TERM_COLOR: always - RUST_VERSION: '1.91' + RUST_VERSION: '1.93' jobs: dependency-review: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6cd49daa2..5d3785cfe8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} env: - RUST_VERSION: '1.91' + RUST_VERSION: '1.93' jobs: build-and-sign: diff --git a/templates/http-go/content/go.mod b/templates/http-go/content/go.mod index 310e04acdd..700d44027c 100644 --- a/templates/http-go/content/go.mod +++ b/templates/http-go/content/go.mod @@ -1,7 +1,15 @@ module github.com/{{project-name | snake_case}} -go 1.22 +go 1.25.5 -require github.com/spinframework/spin-go-sdk/v2 v2.2.1 +require github.com/spinframework/spin-go-sdk/v3 v3.0.0 -require github.com/julienschmidt/httprouter v1.3.0 // indirect +require ( + github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 // indirect + github.com/bytecodealliance/componentize-go v0.3.1 // indirect + github.com/gofrs/flock v0.13.0 // indirect + go.bytecodealliance.org/pkg v0.2.1 // indirect + golang.org/x/sys v0.37.0 // indirect +) + +tool github.com/bytecodealliance/componentize-go diff --git a/templates/http-go/content/main.go b/templates/http-go/content/main.go index ec62db7c30..e0fa51b644 100644 --- a/templates/http-go/content/main.go +++ b/templates/http-go/content/main.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - spinhttp "github.com/spinframework/spin-go-sdk/v2/http" + spinhttp "github.com/spinframework/spin-go-sdk/v3/http" ) func init() { diff --git a/templates/http-go/content/spin.toml b/templates/http-go/content/spin.toml index fe25efb3fc..7143b5d127 100644 --- a/templates/http-go/content/spin.toml +++ b/templates/http-go/content/spin.toml @@ -16,5 +16,5 @@ component = "{{project-name | kebab_case}}" source = "main.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "tinygo build -target=wasip1 -buildmode=c-shared -no-debug -o main.wasm ." +command = "go tool componentize-go build" watch = ["**/*.go", "go.mod"] diff --git a/templates/http-go/metadata/snippets/component.txt b/templates/http-go/metadata/snippets/component.txt index 54e38762d9..24e18bab3d 100644 --- a/templates/http-go/metadata/snippets/component.txt +++ b/templates/http-go/metadata/snippets/component.txt @@ -6,6 +6,6 @@ component = "{{project-name | kebab_case}}" source = "{{ output-path }}/main.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." +command = "go tool componentize-go build" workdir = "{{ output-path }}" watch = ["**/*.go", "go.mod"] diff --git a/templates/http-go/metadata/spin-template.toml b/templates/http-go/metadata/spin-template.toml index 05ef439b72..2eb8bd296d 100644 --- a/templates/http-go/metadata/spin-template.toml +++ b/templates/http-go/metadata/spin-template.toml @@ -1,6 +1,6 @@ manifest_version = "1" id = "http-go" -description = "HTTP request handler using (Tiny)Go" +description = "HTTP request handler using Go" tags = ["http", "go"] [add_component] diff --git a/templates/http-rust/content/Cargo.toml.tmpl b/templates/http-rust/content/Cargo.toml.tmpl index 7fde1afe90..fa5311838a 100644 --- a/templates/http-rust/content/Cargo.toml.tmpl +++ b/templates/http-rust/content/Cargo.toml.tmpl @@ -3,7 +3,7 @@ name = "{{project-name | kebab_case}}" authors = ["{{authors}}"] description = "{{project-description}}" version = "0.1.0" -rust-version = "1.78" +rust-version = "1.93" edition = "2021" [lib] @@ -11,6 +11,6 @@ crate-type = ["cdylib"] [dependencies] anyhow = "1" -spin-sdk = "5.2.0" +spin-sdk = { git = "https://github.com/spinframework/spin-rust-sdk" } [workspace] diff --git a/templates/http-rust/content/src/lib.rs b/templates/http-rust/content/src/lib.rs index ee6fc18cb9..9559a26fc1 100644 --- a/templates/http-rust/content/src/lib.rs +++ b/templates/http-rust/content/src/lib.rs @@ -1,13 +1,12 @@ use spin_sdk::http::{IntoResponse, Request, Response}; -use spin_sdk::http_component; +use spin_sdk::http_service; /// A simple Spin HTTP component. -#[http_component] -fn handle_{{project-name | snake_case}}(req: Request) -> anyhow::Result { - println!("Handling request to {:?}", req.header("spin-full-url")); +#[http_service] +async fn handle_{{project-name | snake_case}}(req: Request) -> anyhow::Result { + println!("Handling request to {:?}", req.headers().get("spin-full-url")); Ok(Response::builder() .status(200) .header("content-type", "text/plain") - .body("Hello World!") - .build()) + .body("Hello World!".to_string())?) } diff --git a/templates/redis-go/content/go.mod b/templates/redis-go/content/go.mod index 4f318cbbb5..700d44027c 100644 --- a/templates/redis-go/content/go.mod +++ b/templates/redis-go/content/go.mod @@ -1,5 +1,15 @@ module github.com/{{project-name | snake_case}} -go 1.22 +go 1.25.5 -require github.com/spinframework/spin-go-sdk/v2 v2.2.1 +require github.com/spinframework/spin-go-sdk/v3 v3.0.0 + +require ( + github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 // indirect + github.com/bytecodealliance/componentize-go v0.3.1 // indirect + github.com/gofrs/flock v0.13.0 // indirect + go.bytecodealliance.org/pkg v0.2.1 // indirect + golang.org/x/sys v0.37.0 // indirect +) + +tool github.com/bytecodealliance/componentize-go diff --git a/templates/redis-go/content/main.go b/templates/redis-go/content/main.go index 50ed538a14..3049916023 100644 --- a/templates/redis-go/content/main.go +++ b/templates/redis-go/content/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/spinframework/spin-go-sdk/v2/redis" + "github.com/spinframework/spin-go-sdk/v3/redis" ) func init() { diff --git a/templates/redis-go/content/spin.toml b/templates/redis-go/content/spin.toml index d885829905..64a9308ff6 100644 --- a/templates/redis-go/content/spin.toml +++ b/templates/redis-go/content/spin.toml @@ -19,4 +19,4 @@ component = "{{project-name | kebab_case}}" source = "main.wasm" allowed_outbound_hosts = [] [component.{{project-name | kebab_case}}.build] -command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ." +command = "go tool componentize-go --world spin:up/redis-trigger@4.0.0 build" diff --git a/templates/redis-go/metadata/spin-template.toml b/templates/redis-go/metadata/spin-template.toml index 09b5be754d..50e9ed9c87 100644 --- a/templates/redis-go/metadata/spin-template.toml +++ b/templates/redis-go/metadata/spin-template.toml @@ -1,6 +1,6 @@ manifest_version = "1" id = "redis-go" -description = "Redis message handler using (Tiny)Go" +description = "Redis message handler using Go" tags = ["redis", "go"] [parameters] diff --git a/templates/redis-rust/content/Cargo.toml.tmpl b/templates/redis-rust/content/Cargo.toml.tmpl index 6e4bdad57b..aa35ea6d43 100644 --- a/templates/redis-rust/content/Cargo.toml.tmpl +++ b/templates/redis-rust/content/Cargo.toml.tmpl @@ -3,7 +3,7 @@ name = "{{project-name | kebab_case}}" authors = ["{{authors}}"] description = "{{project-description}}" version = "0.1.0" -rust-version = "1.78" +rust-version = "1.93" edition = "2021" [lib] @@ -12,9 +12,7 @@ crate-type = [ "cdylib" ] [dependencies] # Useful crate to handle errors. anyhow = "1" -# Crate to simplify working with bytes. -bytes = "1" # The Spin SDK. -spin-sdk = "5.2.0" +spin-sdk = { git = "https://github.com/spinframework/spin-rust-sdk" } [workspace] diff --git a/templates/redis-rust/content/src/lib.rs b/templates/redis-rust/content/src/lib.rs index 3b399b4314..aefe457b2f 100644 --- a/templates/redis-rust/content/src/lib.rs +++ b/templates/redis-rust/content/src/lib.rs @@ -1,11 +1,10 @@ use anyhow::Result; -use bytes::Bytes; -use spin_sdk::redis_component; +use spin_sdk::redis_subscriber; use std::str::from_utf8; /// A simple Spin Redis component. -#[redis_component] -fn on_message(message: Bytes) -> Result<()> { +#[redis_subscriber] +async fn on_message(message: Vec) -> Result<()> { println!("{}", from_utf8(&message)?); // Implement me ... Ok(())