Files
harfbuzz/.github/actions/save-compiler-cache/action.yml
Behdad Esfahbod 4fd912a3c8 [ci] Avoid saving unchanged compiler-cache snapshots
Restore compiler caches through a shared setup action and save them
explicitly only when compilation reports cache misses. Keep existing
restore prefixes and make cache-save failures nonfatal. Before saving
ccache, prune entries that were not used during the job.

This avoids duplicate snapshots on fully cached runs and removes
unrelated restored objects from changed snapshots. Key the MSVC
installed prefix by its dependency build inputs rather than unrelated
workflow edits; dependency options remain in the hashed helper project.

Validation: actual ccache 4.9.1 cold/warm and pruning checks; sccache
statistics and failure-path checks; nine workflow setup/save pairs;
actionlint, git diff --check, and meson test -C build
(302 passed, one skipped). Remote uploads remain for CI.

Assisted-by: OpenAI Codex
2026-11-11 19:48:07 -06:00

43 lines
1.3 KiB
YAML

name: Save compiler cache
description: Save compiler caches only when compilation added entries
inputs:
key:
description: Cache key returned by the setup action
required: true
variant:
description: Compiler cache implementation returned by the setup action
required: true
start:
description: Start time returned by the setup action
required: true
runs:
using: composite
steps:
- name: Prepare compiler cache
id: prepare
shell: bash
continue-on-error: true
env:
COMPILER_CACHE_KEY: ${{ inputs.key }}
COMPILER_CACHE_VARIANT: ${{ inputs.variant }}
COMPILER_CACHE_START: ${{ inputs.start }}
run: |
if [ "$RUNNER_OS" = Windows ]; then
compiler_cache_python=python
else
compiler_cache_python=python3
fi
"$compiler_cache_python" "$GITHUB_WORKSPACE/.ci/save-compiler-cache.py" \
--key "$COMPILER_CACHE_KEY" \
--variant "$COMPILER_CACHE_VARIANT" \
--start "$COMPILER_CACHE_START"
- name: Upload compiler cache
if: steps.prepare.outputs.save == 'true'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
continue-on-error: true
with:
path: ${{ steps.prepare.outputs.path }}
key: ${{ steps.prepare.outputs.key }}