Visitar URL original
ci: skip cross-target check for Cargo.lock removals (#8866) · RustPython/RustPython@1bbcdad · GitHub
Skip to content

Commit 1bbcdad

Browse files
authored
ci: skip cross-target check for Cargo.lock removals (#8866)
A Cargo.lock change no longer forces the cross-target cargo check by itself. The check runs when the lock diff adds lines, or when a removed package is still referenced from Rust sources. Assisted-by: Claude Code:claude-opus-5-5
1 parent 31963fa commit 1bbcdad

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ jobs:
109109
fi
110110
111111
if ! git diff --quiet "${MERGE_BASE}...HEAD" -- \
112-
':Cargo.lock' \
113112
':rust-toolchain.toml' \
114113
':.cargo/**' \
115114
':.github/workflows/ci.yaml' \
@@ -163,6 +162,21 @@ jobs:
163162
exit 0
164163
fi
165164
165+
# Added or bumped packages bring new code to every target. Removed
166+
# packages only matter while cfg-gated code still references them.
167+
lock_diff=$(git diff -U0 "${MERGE_BASE}...HEAD" -- Cargo.lock)
168+
if grep -Eq '^\+[^+]' <<< "${lock_diff}"; then
169+
echo "changed=true" >> "$GITHUB_OUTPUT"
170+
exit 0
171+
fi
172+
while IFS= read -r crate; do
173+
crate=${crate//-/_}
174+
if git grep -qE "(^|[^A-Za-z0-9_])${crate}::|(use|crate) ${crate}([^A-Za-z0-9_]|$)" -- '*.rs'; then
175+
echo "changed=true" >> "$GITHUB_OUTPUT"
176+
exit 0
177+
fi
178+
done < <(sed -n 's/^-name = "\(.*\)"$/\1/p' <<< "${lock_diff}")
179+
166180
# Platform cfg, or FFI crates that only exist on some targets.
167181
platform_re='target_os|target_arch|target_family|target_env|target_vendor|target_pointer_width|target_endian|cfg\(windows\)|cfg\(unix\)|cfg\(wasi|not\(windows|not\(unix|\[target\.|\blibc::|\bnix::|windows_sys|winapi::|rustix::|std::os::'
168182

0 commit comments

Comments
 (0)