Skip to content

Commit 5b06209

Browse files
simplify patching to target workspace root only
1 parent 31e16bc commit 5b06209

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

.github/workflows/test-with-openzeppelin-stellar-contracts.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,19 @@ jobs:
6060
6161
- uses: stellar/actions/rust-cache@main
6262

63-
- name: Patch SDK versions
63+
- name: Patch workspace dependencies
6464
run: |
65-
# TODO: Update this patch logic to use `cargo add` once this issue is resolved: https://github.com/rust-lang/cargo/issues/16101
66-
crates=$(cd ${{ github.workspace }}/rs-soroban-sdk && cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.publish != []) | .name')
67-
find . -name Cargo.toml | while read file; do
68-
echo Patching "$file" ...
69-
dir=$(dirname "$file")
70-
for crate in $crates; do
71-
rel_path=$(realpath --relative-to="$dir" ${{ github.workspace }}/rs-soroban-sdk/$crate)
72-
sed -i 's|'"$crate"' = "\([^"]*\)"|'"$crate"' = { path = "'"$rel_path"'" }|g' "$file"
73-
sed -i 's|'"$crate"' = { \(.*\)version = "[^"]*"\(.*\)|'"$crate"' = { \1path = "'"$rel_path"'" \2|g' "$file"
74-
sed -i 's|'"$crate"' = { workspace = true }|'"$crate"' = { path = "'"$rel_path"'" }|g' "$file"
75-
sed -i 's|'"$crate"' = { workspace = true, \(.*\) }|'"$crate"' = { path = "'"$rel_path"'" , \1 }|g' "$file"
76-
done
65+
cd stellar-contracts
66+
crates=$(cd ../rs-soroban-sdk && cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.publish != []) | .name')
67+
for crate in $crates; do
68+
rel_path=$(realpath --relative-to="." ../rs-soroban-sdk/$crate)
69+
sed -i 's|'"$crate"' = "\([^"]*\)"|'"$crate"' = { path = "'"$rel_path"'" }|g' Cargo.toml
70+
sed -i 's|'"$crate"' = { \(.*\)version = "[^"]*"\(.*\)|'"$crate"' = { \1path = "'"$rel_path"'" \2|g' Cargo.toml
7771
done
7872
7973
- name: Diff
80-
run: git diff
74+
run: |
75+
git diff --exit-code && exit 1
8176
8277
- name: Build contract
8378
env:

0 commit comments

Comments
 (0)