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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
This commit is contained in:
rustdeskandClaude Opus 5.5 committed 2026-11-29 22:00:14 +08:00
1 parent d6bfcb8547
commit 719931da05
2 files changed
+14 -3

No files matched your search

+7 -3
View File
@@ -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'
+7
View File
@@ -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 }}