Skip to content

Commit

Permalink
Support workspace packages with different names vs. paths
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelburnham committed Mar 20, 2024
1 parent 289306e commit d5ad4fd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/check-downstream-compiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ jobs:
echo "WORKSPACE_PATHS"
echo $WORKSPACE_PATHS
# Create map of (workspace_crate, path) key-value pairs
declare -A workspace_crates
for path in $WORKSPACE_PATHS; do
crate_name=$(grep -A1 "\[package\]" $path/Cargo.toml | sed -n 'n;p' | awk '{ print substr($3, 2, length($3)-2) }')
workspace_crates[$crate_name]=$path
done
# Write the Git patch for each dependency used downstream
# Note: The top-level workspace package if used will be included in `DEP_NAMES`, but not in `workspace_crates`
# Therefore, below will append an empty string to the top-level path and patch it correctly
for crate in $DEP_NAMES; do
result=$(echo "$WORKSPACE_PATHS" | grep -ohs "\w*$crate\w*" | cat)
echo "Result for crate $crate: $result"
if [[ -n $result ]]; then
crate_path=$result
else
crate_path=""
fi
crate_path="${workspace_crates[$crate]}"
echo "$crate = { path = \"../${{ env.UPSTREAM_REPO }}/$crate_path\" }" | tee -a Cargo.toml
done
- name: Check downstream types don't break spectacularly
Expand Down

0 comments on commit d5ad4fd

Please sign in to comment.