Skip to content

Commit 69ac221

Browse files
committed
ci: drop workspace outputs from the Windows Cargo cache before saving
Workspace crates rebuild on every run, so their rlibs, fingerprints, build script outputs, and the final binary in rust/target/release are dead weight that every restore has to unpack. In a local release target they are about a quarter of its size. Remove them right before the save; dependency units keep their fingerprints and stay fresh.
1 parent ec1edf3 commit 69ac221

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • .github/actions/build-windows-native-package

‎.github/actions/build-windows-native-package/action.yaml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,24 @@ runs:
7777
path: ccusage-native-win32-${{ inputs.arch }}.tar
7878
if-no-files-found: error
7979

80-
- name: Save Cargo cache
80+
# Workspace crates rebuild on every run (see the restore step), so their
81+
# outputs, about a quarter of rust/target, would only slow every restore.
82+
# Every workspace crate name starts with ccusage and no dependency's does.
83+
- name: Drop workspace outputs from the Cargo cache
84+
id: cargo-cache-prune
8185
if: >-
8286
inputs.save-cargo-cache == 'true'
8387
&& steps.cargo-cache.outputs.cache-hit != 'true'
8488
&& github.ref == 'refs/heads/main'
8589
&& github.event_name != 'pull_request'
8690
&& github.event_name != 'pull_request_target'
91+
shell: bash
92+
run: |
93+
cd rust/target/release
94+
rm -rf ccusage* deps/*ccusage* .fingerprint/ccusage* build/ccusage*
95+
96+
- name: Save Cargo cache
97+
if: steps.cargo-cache-prune.outcome == 'success'
8798
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
8899
with:
89100
path: |

0 commit comments

Comments
 (0)