-
Notifications
You must be signed in to change notification settings - Fork 0
Add Spin framework adapter #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,10 @@ | |
| **/bin/ | ||
| **/pkg/ | ||
|
|
||
| # Spin runtime logs | ||
| .spin/logs/ | ||
| **/.spin/logs/ | ||
|
|
||
| # env | ||
| .env | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ members = [ | |
| "crates/mocktioneer-adapter-axum", | ||
| "crates/mocktioneer-adapter-cloudflare", | ||
| "crates/mocktioneer-adapter-fastly", | ||
| "crates/mocktioneer-adapter-spin", | ||
| ] | ||
| resolver = "2" | ||
|
|
||
|
|
@@ -24,9 +25,11 @@ ed25519-dalek = "2.1" | |
| edgezero-adapter-axum = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-adapter-axum", default-features = false } | ||
| edgezero-adapter-cloudflare = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-adapter-cloudflare", default-features = false } | ||
| edgezero-adapter-fastly = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-adapter-fastly", default-features = false } | ||
| edgezero-adapter-spin = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-adapter-spin", default-features = false } | ||
| edgezero-cli = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-cli" } | ||
| edgezero-core = { git = "https://github.com/stackpop/edgezero.git", branch = "main", package = "edgezero-core" } | ||
| fastly = "0.11.9" | ||
| spin-sdk = { version = "5.2", default-features = false } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ If intentional (e.g., trimming binary size), a one-line comment justifying the choice would help future maintainers avoid "fixing" it back. |
||
| futures = { version = "0.3", features = ["std", "executor"] } | ||
| futures-util = "0.3.31" | ||
| handlebars = "6" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [package] | ||
| name = "mocktioneer-adapter-spin" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| publish = false | ||
|
ChristianPavilonis marked this conversation as resolved.
|
||
| license.workspace = true | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib"] | ||
| path = "src/lib.rs" | ||
|
|
||
| [features] | ||
| default = [] | ||
| spin = ["edgezero-adapter-spin/spin"] | ||
|
|
||
| [dependencies] | ||
| edgezero-adapter-spin = { workspace = true } | ||
|
ChristianPavilonis marked this conversation as resolved.
|
||
| edgezero-core = { workspace = true } # direct dep for Cargo feature unification; same pattern as cloudflare/fastly adapters | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Misleading justification comment. The comment claims "same pattern as cloudflare/fastly adapters," but Either:
Which is intended? |
||
| mocktioneer-core = { workspace = true } | ||
| anyhow = { workspace = true } | ||
|
ChristianPavilonis marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ |
||
|
|
||
| [target.'cfg(target_arch = "wasm32")'.dependencies] | ||
| edgezero-adapter-spin = { workspace = true, features = ["spin"] } | ||
|
ChristianPavilonis marked this conversation as resolved.
|
||
| spin-sdk = { workspace = true } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| spin_manifest_version = 3 | ||
|
|
||
| [application] | ||
| name = "mocktioneer-adapter-spin" | ||
| version = "0.1.0" | ||
|
|
||
| [[trigger.http]] | ||
| route = "/..." | ||
| component = "mocktioneer" | ||
|
|
||
| [component.mocktioneer] | ||
| source = "../../target/wasm32-wasip2/release/mocktioneer_adapter_spin.wasm" | ||
| allowed_outbound_hosts = [] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Tight |
||
| [component.mocktioneer.build] | ||
| command = "cargo build --target wasm32-wasip2 --release -p mocktioneer-adapter-spin" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ♻️ Flag-order drift between two 🌱 Also: the |
||
| watch = ["src/**/*.rs", "Cargo.toml"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //! Spin adapter for Mocktioneer. | ||
| //! | ||
| //! This crate is a `cdylib` targeting `wasm32-wasip2`. All runtime code is | ||
| //! gated behind `#[cfg(target_arch = "wasm32")]` so the crate compiles (but is | ||
| //! empty) on the host target, allowing `cargo fmt`, `cargo clippy`, and | ||
| //! `cargo test` to run across the whole workspace without pulling in WASM-only | ||
| //! dependencies. | ||
| #![cfg_attr(not(target_arch = "wasm32"), allow(dead_code, unused_imports))] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ |
||
|
|
||
| #[cfg(target_arch = "wasm32")] | ||
|
ChristianPavilonis marked this conversation as resolved.
|
||
| use mocktioneer_core::MocktioneerApp; | ||
| #[cfg(target_arch = "wasm32")] | ||
| use spin_sdk::http::{IncomingRequest, IntoResponse}; | ||
| #[cfg(target_arch = "wasm32")] | ||
| use spin_sdk::http_component; | ||
|
|
||
| #[cfg(target_arch = "wasm32")] | ||
| #[http_component] | ||
| async fn handle(req: IncomingRequest) -> anyhow::Result<impl IntoResponse> { | ||
| edgezero_adapter_spin::run_app::<MocktioneerApp>(req).await | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 CI gate feature list properly extended (and CLAUDE.md:164 updated in lockstep).
🌱 Follow-up seed: the workflow installs only
wasm32-wasip1, and the spin wasm is never actually built in CI — onlycargo check --featuresruns on host. That matches the pre-existing pattern for Fastly, but means a breakage in the target-gated blocks ofsrc/lib.rswouldn't be caught. Worth a separate issue to tighten wasm build coverage across all three wasm adapters.