From 1bbcdad42e61509c1ab0afc9b2e2496fd8dca704 Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Mon, 28 Sep 2026 00:03:51 +0900 Subject: [PATCH] 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 --- .github/workflows/ci.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8945600ee..64e4fde37 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -109,7 +109,6 @@ jobs: fi if ! git diff --quiet "${MERGE_BASE}...HEAD" -- \ - ':Cargo.lock' \ ':rust-toolchain.toml' \ ':.cargo/**' \ ':.github/workflows/ci.yaml' \ @@ -163,6 +162,21 @@ jobs: exit 0 fi + # Added or bumped packages bring new code to every target. Removed + # packages only matter while cfg-gated code still references them. + lock_diff=$(git diff -U0 "${MERGE_BASE}...HEAD" -- Cargo.lock) + if grep -Eq '^\+[^+]' <<< "${lock_diff}"; then + echo "changed=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + while IFS= read -r crate; do + crate=${crate//-/_} + if git grep -qE "(^|[^A-Za-z0-9_])${crate}::|(use|crate) ${crate}([^A-Za-z0-9_]|$)" -- '*.rs'; then + echo "changed=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + done < <(sed -n 's/^-name = "\(.*\)"$/\1/p' <<< "${lock_diff}") + # Platform cfg, or FFI crates that only exist on some targets. 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::'