From 719931da0576e7e6f01256c5abe7c62891b3a164 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 29 Nov 2026 22:00:14 +0800 Subject: [PATCH] ci: keep the bridge's rust-cache, saved from master only; log the vcpkg pruning Every platform job waits for generate-bridge, which without rust-cache compiles cargo-expand and flutter_rust_bridge_codegen from source on every run (2 to 3 minutes). Its entry is about 1 GB, one per run rather than one per platform job, so keep it and save it from master only, as ci.yml does. The vcpkg save step now logs how many zips it kept and removed, and warns when the status file is missing, so the first master run shows the pruning working on each platform. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq --- .github/actions/vcpkg-cache-save/action.yml | 10 +++++++--- .github/workflows/bridge.yml | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/actions/vcpkg-cache-save/action.yml b/.github/actions/vcpkg-cache-save/action.yml index 0821a7e04..63843a7c9 100644 --- a/.github/actions/vcpkg-cache-save/action.yml +++ b/.github/actions/vcpkg-cache-save/action.yml @@ -20,9 +20,13 @@ runs: status="$VCPKG_ROOT/installed/vcpkg/status" if [ -s "$status" ]; then keep="$(sed -n 's/^Abi: //p' "$status" | tr -d '\r')" - find "$dir" -name '*.zip' | while read -r z; do - grep -qxF "$(basename "$z" .zip)" <<<"$keep" || rm -f "$z" - done + removed=0 + while read -r z; do + grep -qxF "$(basename "$z" .zip)" <<<"$keep" || { rm -f "$z"; removed=$((removed + 1)); } + done < <(find "$dir" -name '*.zip') + echo "Kept $(find "$dir" -name '*.zip' | wc -l | tr -d ' ') package zip(s), removed $removed." + else + echo "::warning::$status not found: saving every zip, so the entry keeps the old packages." fi fi - if: steps.built.outputs.any == 'true' diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index a19c5682d..6cc1f2c28 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -74,6 +74,13 @@ jobs: targets: ${{ matrix.job.target }} components: "rustfmt" + - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 + if: ${{ inputs.use-cache }} + with: + prefix-key: bridge-${{ matrix.job.os }} + # As in ci.yml: PRs restore master's entry instead of each saving its own. + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Cache Bridge id: cache-bridge if: ${{ inputs.use-cache }}