Skip to content

Commit 31bbe50

Browse files
fibonacci1729seun-ja
authored andcommitted
Workflow for bump rust templates sdk dependency (spinframework#3255)
Signed-off-by: Brian Hardock <[email protected]> revert to warning eprint Signed-off-by: Aminu Oluwaseun Joshua <[email protected]> cleanup unused dependencies Signed-off-by: Aminu Oluwaseun Joshua <[email protected]>
1 parent e5c0eea commit 31bbe50

File tree

21 files changed

+140
-98
lines changed

21 files changed

+140
-98
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Bump Spin Rust Templates SDK Dependency
2+
3+
on:
4+
repository_dispatch:
5+
types:
6+
- rust-sdk-release
7+
8+
jobs:
9+
create-pr:
10+
name: Create PR with Spin Rust Templates SDK Dependency Bump
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Bump Rust Templates SDK Dependency
16+
shell: bash
17+
run: ./scripts/bump-rust-template-sdk.sh ${{ github.event.client_payload.version }}
18+
19+
- name: Import GPG key
20+
uses: crazy-max/ghaction-import-gpg@v6
21+
with:
22+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
23+
passphrase: ${{ secrets.PASSPHRASE }}
24+
git_user_signingkey: true
25+
git_commit_gpgsign: true
26+
27+
- name: Create Pull Request
28+
uses: peter-evans/create-pull-request@v7
29+
with:
30+
commit-message: "chore(rust-templates): bump Spin Rust SDK to ${{ github.event.client_payload.version }}"
31+
title: "chore(rust-templates): bump Spin Rust SDK to ${{ github.event.client_payload.version }}"
32+
body: Update the Spin Rust Templates SDK dependency to ${{ github.event.client_payload.version }}
33+
branch: bump-spin-rust-sdk-${{ github.event.client_payload.version }}
34+
base: main
35+
delete-branch: true
36+
committer: spinframeworkbot <[email protected]>
37+
author: spinframeworkbot <[email protected]>
38+
signoff: true
39+
token: ${{ secrets.PAT }}

Cargo.lock

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ spin-oci = { path = "crates/oci" }
6666
spin-plugins = { path = "crates/plugins" }
6767
spin-runtime-factors = { path = "crates/runtime-factors" }
6868
spin-telemetry = { path = "crates/telemetry", features = [
69-
"tracing-log-compat",
69+
"tracing-log-compat",
7070
] }
7171
spin-templates = { path = "crates/templates" }
7272
spin-trigger = { path = "crates/trigger" }
@@ -97,10 +97,10 @@ testing-framework = { path = "tests/testing-framework" }
9797
[build-dependencies]
9898
cargo-target-dep = { git = "https://github.com/fermyon/cargo-target-dep", rev = "482f269eceb7b1a7e8fc618bf8c082dd24979cf1" }
9999
vergen = { version = "^8.2.1", default-features = false, features = [
100-
"build",
101-
"git",
102-
"gitcl",
103-
"cargo",
100+
"build",
101+
"git",
102+
"gitcl",
103+
"cargo",
104104
] }
105105

106106
[features]
@@ -113,10 +113,10 @@ llm-cublas = ["llm", "spin-runtime-factors/llm-cublas"]
113113

114114
[workspace]
115115
members = [
116-
"crates/*",
117-
"tests/conformance-tests",
118-
"tests/runtime-tests",
119-
"tests/testing-framework",
116+
"crates/*",
117+
"tests/conformance-tests",
118+
"tests/runtime-tests",
119+
"tests/testing-framework",
120120
]
121121

122122
[workspace.dependencies]

crates/common/src/env.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
pub mod arg_parser;
1212
pub mod data_dir;
13-
pub mod env;
1413
pub mod paths;
1514
pub mod sha256;
1615
pub mod sloth;

crates/expressions/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ edition = { workspace = true }
88
anyhow = { workspace = true }
99
async-trait = { workspace = true }
1010
futures = { workspace = true }
11+
spin-common = { path = "../common" }
1112
spin-locked-app = { path = "../locked-app" }
1213
thiserror = { workspace = true }
1314

crates/expressions/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mod template;
33

44
use std::{borrow::Cow, collections::HashMap, fmt::Debug};
55

6+
use spin_common::ui::quoted_path;
67
use spin_locked_app::Variable;
78

89
pub use async_trait;
@@ -90,6 +91,18 @@ impl ProviderResolver {
9091
Ok(PreparedResolver { variables })
9192
}
9293

94+
pub async fn pre_runtime_prepare(&self) -> Result<()> {
95+
for name in self.internal.variables.keys() {
96+
if self.resolve_variable(name).await.is_err() {
97+
eprintln!(
98+
"Default value not found for variable: {}",
99+
quoted_path(name)
100+
);
101+
}
102+
}
103+
Ok(())
104+
}
105+
93106
async fn resolve_variable(&self, key: &str) -> Result<String> {
94107
for provider in &self.providers {
95108
if let Some(value) = provider.get(&Key(key)).await.map_err(Error::Provider)? {

crates/factor-variables/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ impl AppState {
8585
let template = Template::new(expr)?;
8686
self.expression_resolver.resolve_template(&template).await
8787
}
88+
89+
pub fn expression_resolver(&self) -> &Arc<ExpressionResolver> {
90+
&self.expression_resolver
91+
}
8892
}
8993

9094
pub struct InstanceState {

crates/factors-test/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = { workspace = true }
66

77
[dependencies]
88
spin-app = { path = "../app" }
9-
spin-common = { path = "../common" }
109
spin-factors = { path = "../factors" }
1110
spin-loader = { path = "../loader" }
1211
spin-telemetry = { path = "../telemetry", features = ["testing"] }

crates/factors-test/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use spin_app::locked::LockedApp;
2-
use spin_common::env::env_key;
32
use spin_factors::{
43
anyhow::{self, Context},
54
wasmtime::{component::Linker, Config, Engine},
@@ -101,8 +100,6 @@ impl<T: RuntimeFactors> TestEnvironment<T> {
101100
pub async fn build_locked_app(manifest: &toml::Table) -> anyhow::Result<LockedApp> {
102101
let toml_str = toml::to_string(manifest).context("failed serializing manifest")?;
103102
let dir = tempfile::tempdir().context("failed creating tempdir")?;
104-
// `foo` variable is set to require. As we're not providing a default value, env is checked.
105-
std::env::set_var(env_key(None, "foo"), "baz");
106103
let path = dir.path().join("spin.toml");
107104
std::fs::write(&path, toml_str).context("failed writing manifest")?;
108105
spin_loader::from_file(&path, FilesMountStrategy::Direct, None).await

0 commit comments

Comments
 (0)