Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ jobs:
with:
openssl-windows: "${{ matrix.os == 'windows-latest' }}"

- name: build release (canary)
if: github.ref == 'refs/heads/main'
shell: bash
run: cargo build --features experimental-wasm-features --release ${{ matrix.config.extraArgs }}

- name: build release
if: github.ref != 'refs/heads/main'
shell: bash
run: cargo build --release ${{ matrix.config.extraArgs }}

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ llm-metal = ["llm", "spin-runtime-factors/llm-metal"]
llm-cublas = ["llm", "spin-runtime-factors/llm-cublas"]
# This enables the collection and emission CPU time elapsed per component execution.
cpu-time-metrics = ["spin-factors-executor/cpu-time-metrics"]
experimental-wasm-features = ["spin-trigger/experimental-wasm-features"]

[workspace]
members = [
Expand Down
2 changes: 2 additions & 0 deletions crates/trigger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ rust-version.workspace = true
# `ComponentLoader::enable_loading_aot_compiled_components`
# documentation for more information about the safety risks.
unsafe-aot-compilation = []
# Enables configuring unstable Wasm features.
experimental-wasm-features = []

[dependencies]
anyhow = { workspace = true }
Expand Down
32 changes: 32 additions & 0 deletions crates/trigger/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use std::path::PathBuf;
use std::{future::Future, sync::Arc};

use anyhow::{Context, Result};
#[cfg(feature = "experimental-wasm-features")]
use clap::ValueEnum;
use clap::{Args, IntoApp, Parser};
use spin_app::App;
use spin_common::sloth;
Expand Down Expand Up @@ -111,6 +113,10 @@ pub struct FactorsTriggerCommand<T: Trigger<B::Factors>, B: RuntimeFactorsBuilde
)]
pub runtime_config_file: Option<PathBuf>,

#[cfg(feature = "experimental-wasm-features")]
#[clap(long, value_enum)]
pub experimental_wasm_feature: Vec<ExperimentalWasmFeature>,

/// Set the application state directory path. This is used in the default
/// locations for logs, key value stores, etc.
///
Expand All @@ -133,6 +139,15 @@ pub struct FactorsTriggerCommand<T: Trigger<B::Factors>, B: RuntimeFactorsBuilde
pub launch_metadata_only: bool,
}

#[cfg(feature = "experimental-wasm-features")]
#[derive(Clone, Debug, ValueEnum)]
pub enum ExperimentalWasmFeature {
Gc,
ReferenceTypes,
Exceptions,
FunctionReferences,
}

/// Configuration options that are common to all triggers.
#[derive(Debug, Default)]
pub struct FactorsConfig {
Expand Down Expand Up @@ -212,6 +227,23 @@ impl<T: Trigger<B::Factors>, B: RuntimeFactorsBuilder> FactorsTriggerCommand<T,
config.disable_pooling();
}

#[cfg(feature = "experimental-wasm-features")]
{
let wasmtime_config = config.wasmtime_config();
for wasm_feature in self.experimental_wasm_feature {
match wasm_feature {
ExperimentalWasmFeature::Gc => wasmtime_config.wasm_gc(true),
ExperimentalWasmFeature::ReferenceTypes => {
wasmtime_config.wasm_reference_types(true)
}
ExperimentalWasmFeature::Exceptions => wasmtime_config.wasm_exceptions(true),
ExperimentalWasmFeature::FunctionReferences => {
wasmtime_config.wasm_function_references(true)
}
};
}
}

let state_dir = match &self.state_dir {
// Make sure `--state-dir=""` unsets the state dir
Some(s) if s.is_empty() => UserProvidedPath::Unset,
Expand Down