Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/spin-ci-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
type: bool
rust-version:
description: 'Rust version to setup'
default: '1.91'
default: '1.93'
required: false
type: string

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: '1.91'
RUST_VERSION: '1.93'

jobs:
dependency-review:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
RUST_VERSION: '1.91'
RUST_VERSION: '1.93'

jobs:
build-and-sign:
Expand Down
14 changes: 11 additions & 3 deletions templates/http-go/content/go.mod
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion templates/http-go/content/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion templates/http-go/content/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion templates/http-go/metadata/snippets/component.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion templates/http-go/metadata/spin-template.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
4 changes: 2 additions & 2 deletions templates/http-rust/content/Cargo.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ 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]
crate-type = ["cdylib"]

[dependencies]
anyhow = "1"
spin-sdk = "5.2.0"
spin-sdk = { git = "https://github.com/spinframework/spin-rust-sdk" }

[workspace]
11 changes: 5 additions & 6 deletions templates/http-rust/content/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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<impl IntoResponse> {
println!("Handling request to {:?}", req.header("spin-full-url"));
#[http_service]
async fn handle_{{project-name | snake_case}}(req: Request) -> anyhow::Result<impl IntoResponse> {
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())?)
}
14 changes: 12 additions & 2 deletions templates/redis-go/content/go.mod
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion templates/redis-go/content/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion templates/redis-go/content/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion templates/redis-go/metadata/spin-template.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
6 changes: 2 additions & 4 deletions templates/redis-rust/content/Cargo.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
7 changes: 3 additions & 4 deletions templates/redis-rust/content/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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<u8>) -> Result<()> {
println!("{}", from_utf8(&message)?);
// Implement me ...
Ok(())
Expand Down
Loading