Skip to content

Commit ea7a9bc

Browse files
authored
Merge pull request #293 from Dstack-TEE/nostd-check
Add no_std check for rust-sdk-types
2 parents 9b28b0d + 1f56c90 commit ea7a9bc

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

.github/workflows/sdk.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
components: clippy, rustfmt
2424
# This additional target is needed for wasm32 compatibility check.
25-
targets: wasm32-unknown-unknown
25+
targets: wasm32-unknown-unknown, thumbv6m-none-eabi
2626

2727
- name: SDK tests
2828
run: cd sdk && ./run-tests.sh
@@ -32,4 +32,7 @@ jobs:
3232
run: cargo check --target=wasm32-unknown-unknown -p dstack-sdk-types
3333

3434
- name: Verify no_std compatibility
35-
run: cargo test -p dstack-sdk-types --test no_std_test --no-default-features
35+
run: |
36+
cargo test -p dstack-sdk-types --test no_std_test --no-default-features
37+
cargo check -p no_std_check --target thumbv6m-none-eabi
38+

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ members = [
4343
"serde-duration",
4444
"dstack-mr",
4545
"dstack-mr/cli",
46+
"no_std_check",
4647
]
4748
resolver = "2"
4849

4950
[workspace.dependencies]
5051
# Internal dependencies
5152
ra-rpc = { path = "ra-rpc", default-features = false }
5253
ra-tls = { path = "ra-tls" }
53-
dstack-sdk-types = { path = "sdk/rust/types" }
54+
dstack-sdk-types = { path = "sdk/rust/types", default-features = false }
5455
dstack-gateway-rpc = { path = "gateway/rpc" }
5556
dstack-kms-rpc = { path = "kms/rpc" }
5657
dstack-guest-agent-rpc = { path = "guest-agent/rpc" }
@@ -95,7 +96,7 @@ sd-notify = "0.4.5"
9596
jemallocator = "0.5.4"
9697

9798
# Serialization/Parsing
98-
borsh = { version = "1.5.7", features = ["derive"] }
99+
borsh = { version = "1.5.7", default-features = false, features = ["derive"] }
99100
bon = { version = "3.4.0", default-features = false }
100101
base64 = "0.22.1"
101102
hex = { version = "0.4.3", default-features = false }

no_std_check/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "no_std_check"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
dstack-sdk-types = { workspace = true, features = ["borsh"] }

no_std_check/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![no_std]
2+
3+
// Import the types we want to test
4+
use dstack_sdk_types as _;

sdk/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ alloy = { workspace = true, features = ["signers", "signer-local"] }
1111
anyhow.workspace = true
1212
dstack-sdk-types.workspace = true
1313
bon.workspace = true
14-
hex.workspace = true
14+
hex = { workspace = true, features = ["std"] }
1515
http.workspace = true
1616
http-client-unix-domain-socket = "0.1.1"
1717
reqwest = { workspace = true, features = ["json"] }

sdk/rust/types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ std = [
3131
"serde/std",
3232
"serde_json/std",
3333
"sha2/std",
34+
"borsh?/std"
3435
]

0 commit comments

Comments
 (0)