| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- name: 'Show Cache Folder Stats'
- description: 'Display directory-level cache stats for ccache and Bazel'
- runs:
- using: 'composite'
- steps:
- - name: Define cache summary helper
- shell: bash
- working-directory: ${{ github.workspace }}
- run: |
- set -euo pipefail
- cat > /tmp/cache_summary.sh <<'EOF'
- summarize_dir() {
- local path="$1"
- local top_n=${2:-10}
- local sub_n=${3:-5}
- if [ ! -e "$path" ]; then
- echo "Path $path not found"
- return
- fi
- echo "---------------"
- echo "Summary: $path"
- du -sh "$path" || true
- echo "Top ${top_n} entries at top level:"
- du -h --max-depth=1 "$path" 2>/dev/null | sort -hr | head -n "$top_n" || true
- echo "Showing up to ${sub_n} entries one level deeper for the largest top-level items:"
- while read -r line; do
- entry_path=$(echo "$line" | awk '{print $2}')
- [ -z "$entry_path" ] && continue
- if [ "$entry_path" = "$path" ]; then
- continue
- fi
- echo "-> $entry_path :"
- du -h --max-depth=1 "$entry_path" 2>/dev/null | sort -hr | head -n "$sub_n" || true
- done < <(du -h --max-depth=1 "$path" 2>/dev/null | sort -hr | head -n "$top_n")
- echo "---------------"
- }
- EOF
- - name: Show ccache folder Stats
- shell: bash
- working-directory: ${{ github.workspace }}
- run: |
- set -euo pipefail
- source /tmp/cache_summary.sh
- echo "==============="
- echo "=== .ccache ==="
- echo "==============="
- summarize_dir /home/runner/.ccache 10 5 || true
- - name: Show Bazel Cache folder Stats
- shell: bash
- working-directory: ${{ github.workspace }}
- run: |
- set -euo pipefail
- source /tmp/cache_summary.sh
- echo "===================="
- echo "=== .cache/bazel ==="
- echo "===================="
- summarize_dir /home/runner/.cache/bazel 10 5 || true
|