ci: Parse Cargo.toml and Cargo.lock with Python script to determine affected packages (#48389)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
1 parent
9ec35ae904
commit
31f8249b38
6 files changed
+108
-16
No files matched your search
@@ -65,17 +65,15 @@ jobs:
|
||||
FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)
|
||||
fi
|
||||
|
||||
# Parse Cargo.lock diff for added/changed crates
|
||||
LOCK_CHANGED_PKGS=""
|
||||
if echo "$CHANGED_FILES" | grep -qP '^Cargo\.lock$'; then
|
||||
echo "Cargo.lock changed, analyzing diff..."
|
||||
LOCK_CHANGED_PKGS=$(git diff "$COMPARE_REV" "${{ github.sha }}" -- Cargo.lock | \
|
||||
grep -oP '^[+-]name = "\K[^"]+' | \
|
||||
sort -u || true)
|
||||
# Parse Cargo.toml and Cargo.lock for changed dependencies
|
||||
CARGO_CHANGED_DEPS=""
|
||||
if echo "$CHANGED_FILES" | grep -qP '^Cargo\.(toml|lock)$'; then
|
||||
echo "Cargo files changed, analyzing..."
|
||||
CARGO_CHANGED_DEPS=$(./script/diff-cargo-deps "$COMPARE_REV" || true)
|
||||
fi
|
||||
|
||||
# Combine all changed packages
|
||||
ALL_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$LOCK_CHANGED_PKGS" | sort -u | grep -v '^$' || true)
|
||||
ALL_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$CARGO_CHANGED_DEPS" | sort -u | grep -v '^$' || true)
|
||||
|
||||
if [ -z "$ALL_CHANGED_PKGS" ]; then
|
||||
echo "No package changes detected, will run all tests"
|
||||
|
||||
Reference in new issue
Block a user