Skip to content

Fix patch logic to include workspace root Cargo.toml#1646

Merged
leighmcculloch merged 2 commits intomainfrom
rs-soroban-sdk-fix-soroban-examples-patch
Dec 16, 2025
Merged

Fix patch logic to include workspace root Cargo.toml#1646
leighmcculloch merged 2 commits intomainfrom
rs-soroban-sdk-fix-soroban-examples-patch

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch commented Dec 16, 2025

What

Update the soroban examples test workflow to patch both local Cargo.toml files and the workspace root Cargo.toml.

Why

The previous logic only patched local Cargo.toml files found by find, missing the workspace root Cargo.toml which may be located outside the search path.

Related:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub workflow that tests soroban-examples to ensure that both local and workspace root Cargo.toml files are patched with local SDK dependencies. The previous implementation only patched files found by find, which missed the workspace root Cargo.toml when it was outside the search path.

Key changes:

  • Explicitly includes the workspace root Cargo.toml by using cargo metadata to determine its location
  • Uses deduplication via sort -u to avoid patching the same file twice
  • Maintains backward compatibility by continuing to patch all local Cargo.toml files found via find
Comments suppressed due to low confidence (1)

.github/workflows/test-with-soroban-examples.yml:90

  • The variable $file should be quoted to handle file paths that might contain spaces or special characters. Without quotes, paths with spaces will be split into multiple arguments, causing the script to fail.
          echo Patching "$file" ...
          dir=$(dirname "$file")
          for crate in $crates; do
            rel_path=$(realpath --relative-to="$dir" ${{ github.workspace }}/rs-soroban-sdk/$crate)
            sed -i 's|'"$crate"' = "\([^"]*\)"|'"$crate"' = { path = "'"$rel_path"'" }|g' "$file"

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@leighmcculloch leighmcculloch marked this pull request as ready for review December 16, 2025 04:42
@leighmcculloch leighmcculloch added this pull request to the merge queue Dec 16, 2025
Merged via the queue into main with commit f9b7c76 Dec 16, 2025
95 checks passed
@leighmcculloch leighmcculloch deleted the rs-soroban-sdk-fix-soroban-examples-patch branch December 16, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants