From 60aa9812a0b2fbea5533be35f16a974de81c17f0 Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Tue, 27 May 2025 17:43:27 -0700 Subject: [PATCH 1/6] First try at a rust workflow --- .github/workflows/rustfmt.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/rustfmt.yml diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 0000000..dee9688 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,24 @@ +name: rustfmt + +on: + pull_request: + paths: + - 'sdk/rust/**' + - 'samples/rust/**' + push: + paths: + - 'sdk/rust/**' + - 'samples/rust/**' + branches: + - main + +jobs: + check: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update toolchain + run: rustup update --no-self-update stable && rustup default stable + - name: Check + run: cargo fmt --all -- --check From cb4991daef6c3131b3ef1d4c6e371bee3f662e34 Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Tue, 27 May 2025 17:46:21 -0700 Subject: [PATCH 2/6] switch trigger to push on private branch --- .github/workflows/rustfmt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index dee9688..7be8ac1 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -10,7 +10,7 @@ on: - 'sdk/rust/**' - 'samples/rust/**' branches: - - main + - user/chendrixson/rust-workflows jobs: check: From 07f7d7c3626a6320b680aed65d3d496c15e6b131 Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Wed, 28 May 2025 16:55:16 -0700 Subject: [PATCH 3/6] Test out basic workflow --- .github/workflows/rustfmt.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index 7be8ac1..0f00bee 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -10,7 +10,8 @@ on: - 'sdk/rust/**' - 'samples/rust/**' branches: - - user/chendrixson/rust-workflows + - main + workflow_dispatch: jobs: check: From d1c5786b487103a58e0ea8b1bee67d1577b05f2e Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Wed, 28 May 2025 17:18:00 -0700 Subject: [PATCH 4/6] Make fmt work in sdk and samples subdirs. Add workspace so I don't need to specify individual samples --- .github/workflows/rustfmt.yml | 8 ++++++-- samples/rust/hello-foundry-local/src/main.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index 0f00bee..ac7b25d 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -1,4 +1,4 @@ -name: rustfmt +name: Rust-fmt on: pull_request: @@ -21,5 +21,9 @@ jobs: uses: actions/checkout@v4 - name: Update toolchain run: rustup update --no-self-update stable && rustup default stable - - name: Check + - name: Check SDK + working-directory: sdk/rust + run: cargo fmt --all -- --check + - name: Check Samples + working-directory: samples run: cargo fmt --all -- --check diff --git a/samples/rust/hello-foundry-local/src/main.rs b/samples/rust/hello-foundry-local/src/main.rs index cb65f44..b93993f 100644 --- a/samples/rust/hello-foundry-local/src/main.rs +++ b/samples/rust/hello-foundry-local/src/main.rs @@ -14,7 +14,7 @@ async fn main() -> Result<()> { // Create a FoundryLocalManager instance using the builder pattern println!("\nInitializing Foundry Local manager..."); let mut manager = FoundryLocalManager::builder() - .bootstrap(true) // Start the service if not running + .bootstrap(true) // Start the service if not running .build() .await?; From 8cf95a4db1c3edfba93bd106832b51735466c6ab Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Wed, 28 May 2025 17:23:27 -0700 Subject: [PATCH 5/6] Forgot samples workspace file --- samples/rust/Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 samples/rust/Cargo.toml diff --git a/samples/rust/Cargo.toml b/samples/rust/Cargo.toml new file mode 100644 index 0000000..97a5f82 --- /dev/null +++ b/samples/rust/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "hello-foundry-local" +] +resolver = "2" From d4e0e9242e8c171c180cc66561ad81f886c46480 Mon Sep 17 00:00:00 2001 From: Cory Hendrixson Date: Thu, 29 May 2025 14:23:06 -0700 Subject: [PATCH 6/6] Get cargo fmt clean --- sdk/rust/src/lib.rs | 3 +-- sdk/rust/tests/test_api.rs | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sdk/rust/src/lib.rs b/sdk/rust/src/lib.rs index f093071..6cec3ea 100644 --- a/sdk/rust/src/lib.rs +++ b/sdk/rust/src/lib.rs @@ -43,10 +43,9 @@ //! } //! ``` - pub mod api; -pub mod models; mod client; +pub mod models; mod service; pub use api::FoundryLocalManager; diff --git a/sdk/rust/tests/test_api.rs b/sdk/rust/tests/test_api.rs index 88773b2..db54d81 100644 --- a/sdk/rust/tests/test_api.rs +++ b/sdk/rust/tests/test_api.rs @@ -11,10 +11,7 @@ trait TestableFoundryLocalManager { impl TestableFoundryLocalManager for FoundryLocalManager { async fn with_test_uri(uri: &str) -> Self { - let mut manager = FoundryLocalManager::builder() - .build() - .await - .unwrap(); + let mut manager = FoundryLocalManager::builder().build().await.unwrap(); manager.set_test_service_uri(uri); manager }