Forráskód Böngészése

fix: indent shell scripts in cache action composite steps

Add 8-space indentation to all shell script content under 'run: |' blocks
in .github/actions/cache-save/action.yml and .github/actions/cache-stats/action.yml
to fix GitHub Actions YAML parsing errors.
TheWildJames 2 hónapja
szülő
commit
9f8c284923
2 módosított fájl, 390 hozzáadás és 391 törlés
  1. 231 231
      .github/actions/cache-save/action.yml
  2. 159 160
      .github/actions/cache-stats/action.yml

+ 231 - 231
.github/actions/cache-save/action.yml

@@ -41,85 +41,85 @@ runs:
         GH_TOKEN: ${{ inputs.github_token }}
         TARGET_REPO: "${{ github.repository }}"
       run: |
-set -euo pipefail
+        set -euo pipefail
 
-# Archive, Split, and Upload Cache
-echo "🔍 DEBUG: cache-save action started"
-echo "🔍 DEBUG: inputs.cache_path=${{ inputs.cache_path }}"
-echo "🔍 DEBUG: inputs.cache_key=${{ inputs.cache_key }}"
-echo "🔍 DEBUG: inputs.cache_bucket=${{ inputs.cache_bucket }}"
-echo "🔍 DEBUG: inputs.compression_level=${{ inputs.compression_level }}"
-echo "🔍 DEBUG: inputs.working_dir=${{ inputs.working_dir }}"
-echo "🔍 DEBUG: inputs.debug=${{ inputs.debug }}"
-echo "🔍 DEBUG: GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
-echo "🔍 DEBUG: TARGET_REPO=$TARGET_REPO"
+        # Archive, Split, and Upload Cache
+        echo "🔍 DEBUG: cache-save action started"
+        echo "🔍 DEBUG: inputs.cache_path=${{ inputs.cache_path }}"
+        echo "🔍 DEBUG: inputs.cache_key=${{ inputs.cache_key }}"
+        echo "🔍 DEBUG: inputs.cache_bucket=${{ inputs.cache_bucket }}"
+        echo "🔍 DEBUG: inputs.compression_level=${{ inputs.compression_level }}"
+        echo "🔍 DEBUG: inputs.working_dir=${{ inputs.working_dir }}"
+        echo "🔍 DEBUG: inputs.debug=${{ inputs.debug }}"
+        echo "🔍 DEBUG: GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
+        echo "🔍 DEBUG: TARGET_REPO=$TARGET_REPO"
 
-if [ "${{ inputs.working_dir }}" != "" ]; then
-  echo "🔍 DEBUG: Changing to working_dir: ${{ inputs.working_dir }}"
-  cd "${{ inputs.working_dir }}"
-  echo "🔍 DEBUG: Current directory after change: $(pwd)"
-else
-  echo "🔍 DEBUG: No working_dir specified, using GITHUB_WORKSPACE"
-fi
-git config user.name "github-actions[bot]"
-git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
-echo "🔍 DEBUG: Git config set for github-actions[bot]"
+        if [ "${{ inputs.working_dir }}" != "" ]; then
+          echo "🔍 DEBUG: Changing to working_dir: ${{ inputs.working_dir }}"
+          cd "${{ inputs.working_dir }}"
+          echo "🔍 DEBUG: Current directory after change: $(pwd)"
+        else
+          echo "🔍 DEBUG: No working_dir specified, using GITHUB_WORKSPACE"
+        fi
+        git config user.name "github-actions[bot]"
+        git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+        echo "🔍 DEBUG: Git config set for github-actions[bot]"
+
+        TAG_NAME="${{ inputs.cache_bucket }}"
+        BASE_FILENAME="cache-${{ inputs.cache_key }}"
 
-TAG_NAME="${{ inputs.cache_bucket }}"
-BASE_FILENAME="cache-${{ inputs.cache_key }}"
+        if [ "${{ inputs.compression_level }}" -eq 0 ]; then
+          FILENAME="$BASE_FILENAME.tar"
+        else
+          FILENAME="$BASE_FILENAME.tzst"
+        fi
 
-if [ "${{ inputs.compression_level }}" -eq 0 ]; then
-  FILENAME="$BASE_FILENAME.tar"
-else
-  FILENAME="$BASE_FILENAME.tzst"
-fi
+        echo "🔍 DEBUG: TAG_NAME=$TAG_NAME"
+        echo "🔍 DEBUG: BASE_FILENAME=$BASE_FILENAME"
+        echo "🔍 DEBUG: FILENAME=$FILENAME"
+        echo "🔍 DEBUG: compression_level=${{ inputs.compression_level }}"
 
-echo "🔍 DEBUG: TAG_NAME=$TAG_NAME"
-echo "🔍 DEBUG: BASE_FILENAME=$BASE_FILENAME"
-echo "🔍 DEBUG: FILENAME=$FILENAME"
-echo "🔍 DEBUG: compression_level=${{ inputs.compression_level }}"
+        echo "::group:: Checking Release State"
+        echo "🔍 DEBUG: Checking if git tag '$TAG_NAME' exists"
 
-echo "::group:: Checking Release State"
-echo "🔍 DEBUG: Checking if git tag '$TAG_NAME' exists"
+        git fetch --tags --force
+        echo "🔍 DEBUG: Git tags fetched successfully"
+
+        if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
+          echo "🔍 DEBUG: Tag '$TAG_NAME' not found, creating new release"
+          echo "Tag '$TAG_NAME' not found. Creating backdated release..."
+          GIT_COMMITTER_DATE="2015-01-01T12:00:00" git tag -a "$TAG_NAME" -m "General Cache Storage"
+          echo "🔍 DEBUG: Git tag created, attempting push"
+          if git push origin "$TAG_NAME" --force; then
+            echo "🔍 DEBUG: Push successful, creating GitHub release"
+            gh release create "$TAG_NAME" --title "General Cache" --notes "Automated storage for build assets" --repo "$TARGET_REPO" || true
+          else
+            echo "🔍 DEBUG: Push failed (may be parallel job conflict)"
+            echo "Push failed, tag might have been created by a parallel job. Continuing..."
+          fi
+        else
+          echo "🔍 DEBUG: Tag '$TAG_NAME' already exists"
+          echo "Release '$TAG_NAME' already exists. Ready for upload."
+        fi
+        echo "::endgroup::"
+        echo "🔍 DEBUG: Release state check complete"
 
-git fetch --tags --force
-echo "🔍 DEBUG: Git tags fetched successfully"
+        echo "::group:: Archiving Path"
+        echo "🔍 DEBUG: Archiving process started"
+        echo "Target: ${{ inputs.cache_path }}"
+        echo "🔍 DEBUG: Checking if target path exists"
 
-if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
-  echo "🔍 DEBUG: Tag '$TAG_NAME' not found, creating new release"
-  echo "Tag '$TAG_NAME' not found. Creating backdated release..."
-  GIT_COMMITTER_DATE="2015-01-01T12:00:00" git tag -a "$TAG_NAME" -m "General Cache Storage"
-  echo "🔍 DEBUG: Git tag created, attempting push"
-  if git push origin "$TAG_NAME" --force; then
-    echo "🔍 DEBUG: Push successful, creating GitHub release"
-    gh release create "$TAG_NAME" --title "General Cache" --notes "Automated storage for build assets" --repo "$TARGET_REPO" || true
-  else
-    echo "🔍 DEBUG: Push failed (may be parallel job conflict)"
-    echo "Push failed, tag might have been created by a parallel job. Continuing..."
-  fi
-else
-  echo "🔍 DEBUG: Tag '$TAG_NAME' already exists"
-  echo "Release '$TAG_NAME' already exists. Ready for upload."
-fi
-echo "::endgroup::"
-echo "🔍 DEBUG: Release state check complete"
-        
-echo "::group:: Archiving Path"
-echo "🔍 DEBUG: Archiving process started"
-echo "Target: ${{ inputs.cache_path }}"
-echo "🔍 DEBUG: Checking if target path exists"
+        if [ ! -d "${{ inputs.cache_path }}" ] && [ ! -f "${{ inputs.cache_path }}" ]; then
+          echo "🔍 DEBUG: Target path does not exist"
+          echo "⚠️ Target path not found. Skipping cache save."
+          echo "::endgroup::"
+        else
+          echo "🔍 DEBUG: Target path exists, proceeding with archive"
+          DIR_NAME=$(dirname "${{ inputs.cache_path }}")
+          BASE_NAME=$(basename "${{ inputs.cache_path }}")
+          echo "🔍 DEBUG: DIR_NAME=$DIR_NAME"
+          echo "🔍 DEBUG: BASE_NAME=$BASE_NAME"
 
-if [ ! -d "${{ inputs.cache_path }}" ] && [ ! -f "${{ inputs.cache_path }}" ]; then
-  echo "🔍 DEBUG: Target path does not exist"
-  echo "⚠️ Target path not found. Skipping cache save."
-  echo "::endgroup::"
-else
-  echo "🔍 DEBUG: Target path exists, proceeding with archive"
-  DIR_NAME=$(dirname "${{ inputs.cache_path }}")
-  BASE_NAME=$(basename "${{ inputs.cache_path }}")
-  echo "🔍 DEBUG: DIR_NAME=$DIR_NAME"
-  echo "🔍 DEBUG: BASE_NAME=$BASE_NAME"
-          
           if [ "${{ inputs.debug }}" = "true" ]; then
             if [ "${{ inputs.compression_level }}" -eq 0 ]; then
               tar --posix -h -cvf "$FILENAME" -C "$DIR_NAME" "$BASE_NAME"
@@ -133,168 +133,168 @@ else
               tar --posix -h -I "zstd -T0 -${{ inputs.compression_level }}" -cvf "$FILENAME" -C "$DIR_NAME" "$BASE_NAME" > /dev/null 2>&1
             fi
           fi
-          
+
           FILE_SIZE=$(stat -c%s "$FILENAME")
           echo "Archive created: $FILENAME ($FILE_SIZE bytes)"
           echo "::endgroup::"
-          
-  echo "::group:: Uploading Assets"
-  echo "🔍 DEBUG: Upload process started"
-  MAX_SIZE=2000000000 # ~1.86GB
-  echo "🔍 DEBUG: MAX_SIZE=$MAX_SIZE bytes ($(( MAX_SIZE / 1024 / 1024 )) MB)"
-  
-  upload_with_retry() {
-    local file=$1
-    local max_attempts=3
-    local timeout_duration="10m"
-    echo "🔍 DEBUG: upload_with_retry() called for file=$file"
-  
-    for ((i=1; i<=max_attempts; i++)); do
-      echo "  Attempt $i for $file..."
-      echo "🔍 DEBUG: Upload attempt $i for $file"
-      
-      if [ "${{ inputs.debug }}" = "true" ]; then
-        echo "🔍 DEBUG: Running gh release upload in debug mode"
-        if timeout "$timeout_duration" gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO"; then
-          echo "  Successfully uploaded $file"
-          echo "🔍 DEBUG: Upload successful for $file"
-          return 0
-        fi
-      else
-        echo "🔍 DEBUG: Running gh release upload in silent mode"
-        if timeout "$timeout_duration" gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
-          echo "  Successfully uploaded $file"
-          echo "🔍 DEBUG: Upload successful for $file"
-          return 0
+
+          echo "::group:: Uploading Assets"
+          echo "🔍 DEBUG: Upload process started"
+          MAX_SIZE=2000000000 # ~1.86GB
+          echo "🔍 DEBUG: MAX_SIZE=$MAX_SIZE bytes ($(( MAX_SIZE / 1024 / 1024 )) MB)"
+
+          upload_with_retry() {
+            local file=$1
+            local max_attempts=3
+            local timeout_duration="10m"
+            echo "🔍 DEBUG: upload_with_retry() called for file=$file"
+
+            for ((i=1; i<=max_attempts; i++)); do
+              echo "  Attempt $i for $file..."
+              echo "🔍 DEBUG: Upload attempt $i for $file"
+
+              if [ "${{ inputs.debug }}" = "true" ]; then
+                echo "🔍 DEBUG: Running gh release upload in debug mode"
+                if timeout "$timeout_duration" gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO"; then
+                  echo "  Successfully uploaded $file"
+                  echo "🔍 DEBUG: Upload successful for $file"
+                  return 0
+                fi
+              else
+                echo "🔍 DEBUG: Running gh release upload in silent mode"
+                if timeout "$timeout_duration" gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
+                  echo "  Successfully uploaded $file"
+                  echo "🔍 DEBUG: Upload successful for $file"
+                  return 0
+                fi
+              fi
+
+              echo "  ⚠ Attempt $i failed or timed out after $timeout_duration. Retrying..."
+              echo "🔍 DEBUG: Upload attempt $i failed, timeout=$timeout_duration"
+              if [ "$i" -lt "$max_attempts" ]; then
+                echo "🔍 DEBUG: Sleeping 5 seconds before retry"
+                sleep 5
+              fi
+            done
+            echo "🔍 DEBUG: All $max_attempts attempts exhausted for $file"
+            return 1
+          }
+
+          # Fetch existing assets to clean up stale entries
+          echo "🔍 DEBUG: Fetching existing assets for cleanup"
+          ASSETS_URL="https://github.com/${TARGET_REPO}/releases/expanded_assets/$TAG_NAME"
+          echo "🔍 DEBUG: ASSETS_URL=$ASSETS_URL"
+          HTTP_RESPONSE=$(curl -sL -A "Mozilla/5.0" -w "%{http_code}" "$ASSETS_URL" -o assets.html || echo "404")
+          echo "🔍 DEBUG: HTTP_RESPONSE=$HTTP_RESPONSE"
+          if [ "$HTTP_RESPONSE" -eq 200 ]; then
+            ALL_ASSETS=$(grep -oP "download/$TAG_NAME/\K[^\"' ]+" assets.html | sort || echo "")
+            echo "🔍 DEBUG: Parsed ALL_ASSETS, count=$(echo "$ALL_ASSETS" | wc -l)"
+          else
+            ALL_ASSETS=""
+            echo "🔍 DEBUG: Failed to fetch assets, ALL_ASSETS is empty"
+          fi
+          rm -f assets.html
+          echo "🔍 DEBUG: assets.html removed"
+
+          chunk_size="1500M"
+          split_required=false
+          echo "🔍 DEBUG: Evaluating split requirement"
+          echo "🔍 DEBUG: FILE_SIZE=$FILE_SIZE, MAX_SIZE=$MAX_SIZE"
+
+          if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
+            split_required=true
+            echo "🔍 DEBUG: Split required (FILE_SIZE > MAX_SIZE)"
+          else
+            echo "🔍 DEBUG: No split required (FILE_SIZE <= MAX_SIZE)"
+          fi
+
+          if [ "$split_required" = "true" ]; then
+            echo "⚠ Splitting into ${chunk_size} chunks..."
+            echo "🔍 DEBUG: Executing split command with chunk_size=1500M"
+            split -b "$chunk_size" -a 2 "$FILENAME" "${FILENAME}.part"
+
+            NEW_PARTS=(${FILENAME}.part*)
+            NEW_PARTS_COUNT=${#NEW_PARTS[@]}
+            echo "🔍 DEBUG: Split complete, NEW_PARTS_COUNT=$NEW_PARTS_COUNT"
+
+            # Remove old single-file asset if switching to split parts
+            if echo "$ALL_ASSETS" | grep -xF "${FILENAME}" >/dev/null 2>&1; then
+              echo "🔍 DEBUG: Found old single-file asset, removing it"
+              echo "Removing old single asset to make way for split parts: ${FILENAME}"
+              gh release delete-asset "$TAG_NAME" "${FILENAME}" --repo "$TARGET_REPO" -y || true
+            else
+              echo "🔍 DEBUG: No old single-file asset to remove"
+            fi
+
+            # Clean up excess trailing parts from previous builds
+            OLD_PARTS=$(echo "$ALL_ASSETS" | grep -F "${FILENAME}.part" || echo "")
+            echo "🔍 DEBUG: OLD_PARTS count=$(echo "$OLD_PARTS" | grep -c . || echo 0)"
+            if [ -n "$OLD_PARTS" ]; then
+              OLD_PARTS_COUNT=$(echo "$OLD_PARTS" | wc -l)
+              echo "🔍 DEBUG: OLD_PARTS_COUNT=$OLD_PARTS_COUNT, NEW_PARTS_COUNT=$NEW_PARTS_COUNT"
+              if [ "$OLD_PARTS_COUNT" -gt "$NEW_PARTS_COUNT" ]; then
+                echo "Old build had $OLD_PARTS_COUNT parts, new has $NEW_PARTS_COUNT. Cleaning up excess parts..."
+                EXT_PARTS=$(echo "$OLD_PARTS" | awk -v skip="$NEW_PARTS_COUNT" 'NR>skip')
+                for asset in $EXT_PARTS; do
+                  echo "🔍 DEBUG: Removing old part: $asset"
+                  echo "Removing leftover trailing part: $asset"
+                  gh release delete-asset "$TAG_NAME" "$asset" --repo "$TARGET_REPO" -y || true
+                done
+              else
+                echo "🔍 DEBUG: No excess parts to clean up"
+              fi
+            fi
+
+            for part in "${FILENAME}".part*; do
+              echo "🔍 DEBUG: Uploading part: $part"
+              echo "Uploading $part..."
+              if ! upload_with_retry "$part"; then
+                echo "::error::Failed to upload part $part after multiple attempts."
+                echo "🔍 DEBUG: CRITICAL - Upload failed for $part"
+                exit 1
+              fi
+              echo "🔍 DEBUG: Successfully uploaded $part, removing local copy"
+              rm -f "$part"
+            done
+            echo "🔍 DEBUG: All parts uploaded, removing original archive"
+            rm -rf "$FILENAME"
+          else
+            # Remove old split parts if new build fits in a single file
+            echo "🔍 DEBUG: Checking for old split parts to clean up"
+            OLD_PARTS=$(echo "$ALL_ASSETS" | grep -F "${FILENAME}.part" || echo "")
+            if [ -n "$OLD_PARTS" ]; then
+              echo "New build shrunk to single file. Cleaning up old split parts for ${FILENAME}..."
+              echo "🔍 DEBUG: Found old split parts, removing them"
+              while read -r asset; do
+                [ -z "$asset" ] && continue
+                echo "🔍 DEBUG: Removing ghost split part: $asset"
+                echo "Removing ghost split part: $asset"
+                gh release delete-asset "$TAG_NAME" "$asset" --repo "$TARGET_REPO" -y || true
+              done <<< "$OLD_PARTS"
+            else
+              echo "🔍 DEBUG: No old split parts to clean up"
+            fi
+
+            echo "🔍 DEBUG: Uploading single file: $FILENAME"
+            echo "Uploading $FILENAME..."
+            if ! upload_with_retry "$FILENAME"; then
+              echo "::error::Failed to upload $FILENAME after multiple attempts."
+              echo "🔍 DEBUG: CRITICAL - Upload failed for $FILENAME"
+              exit 1
+            fi
+            echo "🔍 DEBUG: Successfully uploaded $FILENAME, removing local copy"
+            rm -f "$FILENAME"
+          fi
+          # Cleanup any leftover archive artifacts (single-file or split parts)
+          echo "🔍 DEBUG: Final cleanup phase"
+          if [ "${{ inputs.debug }}" = "true" ]; then
+            echo "Cleaning archive artifacts: ${BASE_FILENAME}*"
+            echo "🔍 DEBUG: Listing files matching ${BASE_FILENAME}*"
+            ls -la "${BASE_FILENAME}"* 2>/dev/null || true
+          fi
+          rm -f "${BASE_FILENAME}"* || true
+          echo "🔍 DEBUG: Cleanup complete"
+
+          echo "::endgroup::"
+          echo "🔍 DEBUG: cache-save action finished successfully"
         fi
-      fi
-      
-      echo "  ⚠ Attempt $i failed or timed out after $timeout_duration. Retrying..."
-      echo "🔍 DEBUG: Upload attempt $i failed, timeout=$timeout_duration"
-      if [ "$i" -lt "$max_attempts" ]; then
-        echo "🔍 DEBUG: Sleeping 5 seconds before retry"
-        sleep 5
-      fi
-    done
-    echo "🔍 DEBUG: All $max_attempts attempts exhausted for $file"
-    return 1
-  }
-          
-  # Fetch existing assets to clean up stale entries
-  echo "🔍 DEBUG: Fetching existing assets for cleanup"
-  ASSETS_URL="https://github.com/${TARGET_REPO}/releases/expanded_assets/$TAG_NAME"
-  echo "🔍 DEBUG: ASSETS_URL=$ASSETS_URL"
-  HTTP_RESPONSE=$(curl -sL -A "Mozilla/5.0" -w "%{http_code}" "$ASSETS_URL" -o assets.html || echo "404")
-  echo "🔍 DEBUG: HTTP_RESPONSE=$HTTP_RESPONSE"
-  if [ "$HTTP_RESPONSE" -eq 200 ]; then
-    ALL_ASSETS=$(grep -oP "download/$TAG_NAME/\K[^\"' ]+" assets.html | sort || echo "")
-    echo "🔍 DEBUG: Parsed ALL_ASSETS, count=$(echo "$ALL_ASSETS" | wc -l)"
-  else
-    ALL_ASSETS=""
-    echo "🔍 DEBUG: Failed to fetch assets, ALL_ASSETS is empty"
-  fi
-  rm -f assets.html
-  echo "🔍 DEBUG: assets.html removed"
-          
-  chunk_size="1500M"
-  split_required=false
-  echo "🔍 DEBUG: Evaluating split requirement"
-  echo "🔍 DEBUG: FILE_SIZE=$FILE_SIZE, MAX_SIZE=$MAX_SIZE"
-  
-  if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
-    split_required=true
-    echo "🔍 DEBUG: Split required (FILE_SIZE > MAX_SIZE)"
-  else
-    echo "🔍 DEBUG: No split required (FILE_SIZE <= MAX_SIZE)"
-  fi
-  
-  if [ "$split_required" = "true" ]; then
-    echo "⚠ Splitting into ${chunk_size} chunks..."
-    echo "🔍 DEBUG: Executing split command with chunk_size=1500M"
-    split -b "$chunk_size" -a 2 "$FILENAME" "${FILENAME}.part"
-    
-    NEW_PARTS=(${FILENAME}.part*)
-    NEW_PARTS_COUNT=${#NEW_PARTS[@]}
-    echo "🔍 DEBUG: Split complete, NEW_PARTS_COUNT=$NEW_PARTS_COUNT"
-            
-  # Remove old single-file asset if switching to split parts
-  if echo "$ALL_ASSETS" | grep -xF "${FILENAME}" >/dev/null 2>&1; then
-    echo "🔍 DEBUG: Found old single-file asset, removing it"
-    echo "Removing old single asset to make way for split parts: ${FILENAME}"
-    gh release delete-asset "$TAG_NAME" "${FILENAME}" --repo "$TARGET_REPO" -y || true
-  else
-    echo "🔍 DEBUG: No old single-file asset to remove"
-  fi
-  
-  # Clean up excess trailing parts from previous builds
-  OLD_PARTS=$(echo "$ALL_ASSETS" | grep -F "${FILENAME}.part" || echo "")
-  echo "🔍 DEBUG: OLD_PARTS count=$(echo "$OLD_PARTS" | grep -c . || echo 0)"
-  if [ -n "$OLD_PARTS" ]; then
-    OLD_PARTS_COUNT=$(echo "$OLD_PARTS" | wc -l)
-    echo "🔍 DEBUG: OLD_PARTS_COUNT=$OLD_PARTS_COUNT, NEW_PARTS_COUNT=$NEW_PARTS_COUNT"
-    if [ "$OLD_PARTS_COUNT" -gt "$NEW_PARTS_COUNT" ]; then
-      echo "Old build had $OLD_PARTS_COUNT parts, new has $NEW_PARTS_COUNT. Cleaning up excess parts..."
-      EXT_PARTS=$(echo "$OLD_PARTS" | awk -v skip="$NEW_PARTS_COUNT" 'NR>skip')
-      for asset in $EXT_PARTS; do
-        echo "🔍 DEBUG: Removing old part: $asset"
-        echo "Removing leftover trailing part: $asset"
-        gh release delete-asset "$TAG_NAME" "$asset" --repo "$TARGET_REPO" -y || true
-      done
-    else
-      echo "🔍 DEBUG: No excess parts to clean up"
-    fi
-  fi
-  
-  for part in "${FILENAME}".part*; do
-    echo "🔍 DEBUG: Uploading part: $part"
-    echo "Uploading $part..."
-    if ! upload_with_retry "$part"; then
-      echo "::error::Failed to upload part $part after multiple attempts."
-      echo "🔍 DEBUG: CRITICAL - Upload failed for $part"
-      exit 1
-    fi
-    echo "🔍 DEBUG: Successfully uploaded $part, removing local copy"
-    rm -f "$part"
-  done
-  echo "🔍 DEBUG: All parts uploaded, removing original archive"
-  rm -rf "$FILENAME"
-  else
-    # Remove old split parts if new build fits in a single file
-    echo "🔍 DEBUG: Checking for old split parts to clean up"
-    OLD_PARTS=$(echo "$ALL_ASSETS" | grep -F "${FILENAME}.part" || echo "")
-    if [ -n "$OLD_PARTS" ]; then
-      echo "New build shrunk to single file. Cleaning up old split parts for ${FILENAME}..."
-      echo "🔍 DEBUG: Found old split parts, removing them"
-      while read -r asset; do
-        [ -z "$asset" ] && continue
-        echo "🔍 DEBUG: Removing ghost split part: $asset"
-        echo "Removing ghost split part: $asset"
-        gh release delete-asset "$TAG_NAME" "$asset" --repo "$TARGET_REPO" -y || true
-      done <<< "$OLD_PARTS"
-    else
-      echo "🔍 DEBUG: No old split parts to clean up"
-    fi
-    
-    echo "🔍 DEBUG: Uploading single file: $FILENAME"
-    echo "Uploading $FILENAME..."
-    if ! upload_with_retry "$FILENAME"; then
-      echo "::error::Failed to upload $FILENAME after multiple attempts."
-      echo "🔍 DEBUG: CRITICAL - Upload failed for $FILENAME"
-      exit 1
-    fi
-    echo "🔍 DEBUG: Successfully uploaded $FILENAME, removing local copy"
-    rm -f "$FILENAME"
-  fi
-  # Cleanup any leftover archive artifacts (single-file or split parts)
-  echo "🔍 DEBUG: Final cleanup phase"
-  if [ "${{ inputs.debug }}" = "true" ]; then
-    echo "Cleaning archive artifacts: ${BASE_FILENAME}*"
-    echo "🔍 DEBUG: Listing files matching ${BASE_FILENAME}*"
-    ls -la "${BASE_FILENAME}"* 2>/dev/null || true
-  fi
-  rm -f "${BASE_FILENAME}"* || true
-  echo "🔍 DEBUG: Cleanup complete"
-  
-  echo "::endgroup::"
-  echo "🔍 DEBUG: cache-save action finished successfully"
-        fi

+ 159 - 160
.github/actions/cache-stats/action.yml

@@ -14,12 +14,12 @@ runs:
       shell: bash
       working-directory: ${{ github.workspace }}
       run: |
-set -euo pipefail
-echo "🔍 DEBUG: cache-stats action started"
-echo "🔍 DEBUG: inputs.clear_stats=${{ inputs.clear_stats }}"
-echo "🔍 DEBUG: github.workspace=${{ github.workspace }}"
+        set -euo pipefail
+        echo "🔍 DEBUG: cache-stats action started"
+        echo "🔍 DEBUG: inputs.clear_stats=${{ inputs.clear_stats }}"
+        echo "🔍 DEBUG: github.workspace=${{ github.workspace }}"
 
-cat > /tmp/cache_summary.sh <<'EOF'
+        cat > /tmp/cache_summary.sh <<'EOF'
         summarize_dir() {
           local path="$1"
           local top_n=${2:-10}
@@ -51,175 +51,174 @@ cat > /tmp/cache_summary.sh <<'EOF'
       shell: bash
       working-directory: ${{ github.workspace }}
       run: |
-set -euo pipefail
-echo "===================="
-echo "=== ccache stats ==="
-echo "===================="
-echo "🔍 DEBUG: Starting ccache stats collection"
-
-if ! command -v ccache >/dev/null 2>&1; then
-  echo "🔍 DEBUG: ccache command not found"
-  echo "⚠️  ccache not installed, skipping ccache stats"
-  echo "===================="
-  exit 0
-fi
-echo "🔍 DEBUG: ccache command found at: $(which ccache)"
-
-# Get ccache version
-CCACHE_VERSION=$(ccache --version | head -1)
-echo "🔍 DEBUG: ccache version: $CCACHE_VERSION"
-
-# Check ccache directory
-echo "🔍 DEBUG: Checking ccache directory: /home/runner/.ccache"
-if [ -d /home/runner/.ccache ]; then
-  echo "🔍 DEBUG: ccache directory exists"
-  echo "🔍 DEBUG: ccache directory size: $(du -sh /home/runner/.ccache 2>/dev/null | cut -f1)"
-  echo "🔍 DEBUG: ccache directory file count: $(find /home/runner/.ccache -type f 2>/dev/null | wc -l)"
-else
-  echo "🔍 DEBUG: ccache directory does NOT exist"
-fi
-
-echo "🔍 DEBUG: Running ccache -s (statistics)"
-ccache -s || true
-echo "🔍 DEBUG: ccache -s completed"
-echo "====================="
-echo "=== ccache config ==="
-echo "====================="
-echo "🔍 DEBUG: Running ccache -p (config)"
-ccache -p || true
-echo "🔍 DEBUG: ccache -p completed"
-echo "====================="
-
-echo "🔍 DEBUG: Running ccache -s for stats parsing"
-STATS="$(ccache -s)"
-echo "🔍 DEBUG: Raw ccache stats captured"
+        set -euo pipefail
+        echo "===================="
+        echo "=== ccache stats ==="
+        echo "===================="
+        echo "🔍 DEBUG: Starting ccache stats collection"
+
+        if ! command -v ccache >/dev/null 2>&1; then
+          echo "🔍 DEBUG: ccache command not found"
+          echo "⚠️  ccache not installed, skipping ccache stats"
+          echo "===================="
+          exit 0
+        fi
+        echo "🔍 DEBUG: ccache command found at: $(which ccache)"
+
+        # Get ccache version
+        CCACHE_VERSION=$(ccache --version | head -1)
+        echo "🔍 DEBUG: ccache version: $CCACHE_VERSION"
+
+        # Check ccache directory
+        echo "🔍 DEBUG: Checking ccache directory: /home/runner/.ccache"
+        if [ -d /home/runner/.ccache ]; then
+          echo "🔍 DEBUG: ccache directory exists"
+          echo "🔍 DEBUG: ccache directory size: $(du -sh /home/runner/.ccache 2>/dev/null | cut -f1)"
+          echo "🔍 DEBUG: ccache directory file count: $(find /home/runner/.ccache -type f 2>/dev/null | wc -l)"
+        else
+          echo "🔍 DEBUG: ccache directory does NOT exist"
+        fi
+
+        echo "🔍 DEBUG: Running ccache -s (statistics)"
+        ccache -s || true
+        echo "🔍 DEBUG: ccache -s completed"
+        echo "====================="
+        echo "=== ccache config ==="
+        echo "====================="
+        echo "🔍 DEBUG: Running ccache -p (config)"
+        ccache -p || true
+        echo "🔍 DEBUG: ccache -p completed"
+        echo "====================="
+
+        echo "🔍 DEBUG: Running ccache -s for stats parsing"
+        STATS="$(ccache -s)"
+        echo "🔍 DEBUG: Raw ccache stats captured"
         
-echo "🔍 DEBUG: Parsing ccache statistics"
-echo "🔍 DEBUG: Raw STATS (first 10 lines):"
-echo "$STATS" | head -n 10
-
-CACHEABLE=$(echo "$STATS" | awk '/Cacheable calls:/ {
-  match($0, /[0-9]+/);
-  print substr($0, RSTART, RLENGTH)
-}' | head -n1)
-echo "🔍 DEBUG: CACHEABLE=$CACHEABLE"
-
-HITS=$(echo "$STATS" | awk '/^[[:space:]]*Hits:/ {
-  match($0, /[0-9]+/);
-  print substr($0, RSTART, RLENGTH)
-}' | head -n1)
-echo "🔍 DEBUG: HITS=$HITS"
-
-DIRECT=$(echo "$STATS" | awk '/Direct:/ {
-  match($0, /[0-9]+/);
-  print substr($0, RSTART, RLENGTH)
-}' | head -n1)
-echo "🔍 DEBUG: DIRECT=$DIRECT"
+        echo "🔍 DEBUG: Parsing ccache statistics"
+        echo "🔍 DEBUG: Raw STATS (first 10 lines):"
+        echo "$STATS" | head -n 10
+
+        CACHEABLE=$(echo "$STATS" | awk '/Cacheable calls:/ {
+          match($0, /[0-9]+/);
+          print substr($0, RSTART, RLENGTH)
+        }' | head -n1)
+        echo "🔍 DEBUG: CACHEABLE=$CACHEABLE"
+
+        HITS=$(echo "$STATS" | awk '/^[[:space:]]*Hits:/ {
+          match($0, /[0-9]+/);
+          print substr($0, RSTART, RLENGTH)
+        }' | head -n1)
+        echo "🔍 DEBUG: HITS=$HITS"
+
+        DIRECT=$(echo "$STATS" | awk '/Direct:/ {
+          match($0, /[0-9]+/);
+          print substr($0, RSTART, RLENGTH)
+        }' | head -n1)
+        echo "🔍 DEBUG: DIRECT=$DIRECT"
         
-echo "🔍 DEBUG: Calculating hit rates"
-echo "🔍 DEBUG: CACHEABLE=${CACHEABLE:-0}, HITS=${HITS:-0}, DIRECT=${DIRECT:-0}"
-if [ "${CACHEABLE:-0}" -gt 0 ]; then
-  HIT_RATE=$(awk -v h="${HITS:-0}" -v c="$CACHEABLE" 'BEGIN{printf "%.1f", (h/c)*100}')
-  DIRECT_RATE=$(awk -v d="${DIRECT:-0}" -v c="$CACHEABLE" 'BEGIN{printf "%.1f", (d/c)*100}')
-  echo "🔍 DEBUG: Calculated HIT_RATE=$HIT_RATE%, DIRECT_RATE=$DIRECT_RATE%"
-else
-  HIT_RATE="0.0"
-  DIRECT_RATE="0.0"
-  echo "🔍 DEBUG: CACHEABLE is 0, setting rates to 0.0%"
-fi
-
-echo "hit_rate=${HIT_RATE}%"
-echo "direct_rate=${DIRECT_RATE}%"
-echo "🔍 DEBUG: Hit rates output complete"
-
-echo "🔍 DEBUG: clear_stats check: ${{ inputs.clear_stats }}"
-if [ "${{ inputs.clear_stats }}" = "true" ]; then
-  echo "🔍 DEBUG: Clearing ccache stats (ccache -z)"
-  echo "=== ccache reset ==="
-  echo "====================="
-  ccache -z || true
-  echo "🔍 DEBUG: ccache -z completed"
-  echo "====================="
-  
-  # Touch all files to prevent LRU eviction of freshly restored cache
-  echo "🔍 DEBUG: Checking if ccache directory needs atime update"
-  if [ -d /home/runner/.ccache ] && find /home/runner/.ccache -type f -print -quit 2>/dev/null | grep -q .; then
-    echo "🔍 DEBUG: ccache directory has files, updating atime"
-    echo "Updating ccache atime to prevent cache eviction..."
-    echo "🔍 DEBUG: Executing find touch command for ccache files"
-    find /home/runner/.ccache -type f -exec touch -t $(date -d "1 day ago" +%Y%m%d%H%M) {} +
-    echo "✅ ccache atime updated"
-    echo "🔍 DEBUG: ccache atime update completed"
-  else
-    echo "🔍 DEBUG: Skipping ccache atime update (directory empty or missing)"
-  fi
-  
-  echo "🔍 DEBUG: Checking if ld_cache directory needs atime update"
-  if [ -d /home/runner/.ld_cache ] && find /home/runner/.ld_cache -type f -print -quit 2>/dev/null | grep -q .; then
-    echo "🔍 DEBUG: ld_cache directory has files, updating atime"
-    echo "Updating LTO cache atime to prevent cache eviction..."
-    echo "🔍 DEBUG: Executing find touch command for ld_cache files"
-    find /home/runner/.ld_cache -type f -exec touch -t $(date -d "1 day ago" +%Y%m%d%H%M) {} +
-    echo "✅ LTO cache atime updated"
-    echo "🔍 DEBUG: LTO cache atime update completed"
-  else
-    echo "🔍 DEBUG: Skipping ld_cache atime update (directory empty or missing)"
-  fi
-else
-  echo "🔍 DEBUG: clear_stats is false, keeping ccache stats for next run"
-  echo "Keeping ccache stats for next run"
-fi
-echo "🔍 DEBUG: ccache stats section complete"
+        echo "🔍 DEBUG: Calculating hit rates"
+        echo "🔍 DEBUG: CACHEABLE=${CACHEABLE:-0}, HITS=${HITS:-0}, DIRECT=${DIRECT:-0}"
+        if [ "${CACHEABLE:-0}" -gt 0 ]; then
+          HIT_RATE=$(awk -v h="${HITS:-0}" -v c="$CACHEABLE" 'BEGIN{printf "%.1f", (h/c)*100}')
+          DIRECT_RATE=$(awk -v d="${DIRECT:-0}" -v c="$CACHEABLE" 'BEGIN{printf "%.1f", (d/c)*100}')
+          echo "🔍 DEBUG: Calculated HIT_RATE=$HIT_RATE%, DIRECT_RATE=$DIRECT_RATE%"
+        else
+          HIT_RATE="0.0"
+          DIRECT_RATE="0.0"
+          echo "🔍 DEBUG: CACHEABLE is 0, setting rates to 0.0%"
+        fi
+
+        echo "hit_rate=${HIT_RATE}%"
+        echo "direct_rate=${DIRECT_RATE}%"
+        echo "🔍 DEBUG: Hit rates output complete"
+
+        echo "🔍 DEBUG: clear_stats check: ${{ inputs.clear_stats }}"
+        if [ "${{ inputs.clear_stats }}" = "true" ]; then
+          echo "🔍 DEBUG: Clearing ccache stats (ccache -z)"
+          echo "=== ccache reset ==="
+          echo "====================="
+          ccache -z || true
+          echo "🔍 DEBUG: ccache -z completed"
+          echo "====================="
+          
+          # Touch all files to prevent LRU eviction of freshly restored cache
+          echo "🔍 DEBUG: Checking if ccache directory needs atime update"
+          if [ -d /home/runner/.ccache ] && find /home/runner/.ccache -type f -print -quit 2>/dev/null | grep -q .; then
+            echo "🔍 DEBUG: ccache directory has files, updating atime"
+            echo "Updating ccache atime to prevent cache eviction..."
+            echo "🔍 DEBUG: Executing find touch command for ccache files"
+            find /home/runner/.ccache -type f -exec touch -t $(date -d "1 day ago" +%Y%m%d%H%M) {} +
+            echo "✅ ccache atime updated"
+            echo "🔍 DEBUG: ccache atime update completed"
+          else
+            echo "🔍 DEBUG: Skipping ccache atime update (directory empty or missing)"
+          fi
+          
+          echo "🔍 DEBUG: Checking if ld_cache directory needs atime update"
+          if [ -d /home/runner/.ld_cache ] && find /home/runner/.ld_cache -type f -print -quit 2>/dev/null | grep -q .; then
+            echo "🔍 DEBUG: ld_cache directory has files, updating atime"
+            echo "Updating LTO cache atime to prevent cache eviction..."
+            echo "🔍 DEBUG: Executing find touch command for ld_cache files"
+            find /home/runner/.ld_cache -type f -exec touch -t $(date -d "1 day ago" +%Y%m%d%H%M) {} +
+            echo "✅ LTO cache atime updated"
+            echo "🔍 DEBUG: LTO cache atime update completed"
+          else
+            echo "🔍 DEBUG: Skipping ld_cache atime update (directory empty or missing)"
+          fi
+        else
+          echo "🔍 DEBUG: clear_stats is false, keeping ccache stats for next run"
+          echo "Keeping ccache stats for next run"
+        fi
+        echo "🔍 DEBUG: ccache stats section complete"
 
     - name: Show ccache folder Stats
       shell: bash
       working-directory: ${{ github.workspace }}
       run: |
-set -euo pipefail
-echo "🔍 DEBUG: ccache folder stats section started"
-# shellcheck disable=SC1091
-source /tmp/cache_summary.sh
-echo "🔍 DEBUG: cache_summary.sh loaded successfully"
-
-echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.ccache with top_n=10, sub_n=5"
-echo "==============="
-echo "=== .ccache ==="
-echo "==============="
-summarize_dir /home/runner/.ccache 10 5 || true
-echo "🔍 DEBUG: ccache folder stats section complete"
+        set -euo pipefail
+        echo "🔍 DEBUG: ccache folder stats section started"
+        # shellcheck disable=SC1091
+        source /tmp/cache_summary.sh
+        echo "🔍 DEBUG: cache_summary.sh loaded successfully"
+
+        echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.ccache with top_n=10, sub_n=5"
+        echo "==============="
+        echo "=== .ccache ==="
+        echo "==============="
+        summarize_dir /home/runner/.ccache 10 5 || true
+        echo "🔍 DEBUG: ccache folder stats section complete"
 
     - name: Show Bazel Cache folder Stats
       shell: bash
       working-directory: ${{ github.workspace }}
       run: |
-set -euo pipefail
-echo "🔍 DEBUG: Bazel cache folder stats section started"
-# shellcheck disable=SC1091
-source /tmp/cache_summary.sh
-echo "🔍 DEBUG: cache_summary.sh loaded successfully"
-
-echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.cache/bazel with top_n=10, sub_n=5"
-echo "===================="
-echo "=== .cache/bazel ==="
-echo "===================="
-summarize_dir /home/runner/.cache/bazel 10 5 || true
-echo "🔍 DEBUG: Bazel cache folder stats section complete"
+        set -euo pipefail
+        echo "🔍 DEBUG: Bazel cache folder stats section started"
+        # shellcheck disable=SC1091
+        source /tmp/cache_summary.sh
+        echo "🔍 DEBUG: cache_summary.sh loaded successfully"
+
+        echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.cache/bazel with top_n=10, sub_n=5"
+        echo "===================="
+        echo "=== .cache/bazel ==="
+        echo "===================="
+        summarize_dir /home/runner/.cache/bazel 10 5 || true
+        echo "🔍 DEBUG: Bazel cache folder stats section complete"
         
     - name: Show ld cache folder Stats
       shell: bash
       working-directory: ${{ github.workspace }}
       run: |
-set -euo pipefail
-echo "🔍 DEBUG: ld cache folder stats section started"
-# shellcheck disable=SC1091
-source /tmp/cache_summary.sh
-echo "🔍 DEBUG: cache_summary.sh loaded successfully"
-
-echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.ld_cache with top_n=10, sub_n=5"
-echo "================="
-echo "=== .ld_cache ==="
-echo "================="
-summarize_dir /home/runner/.ld_cache 10 5 || true
-echo "🔍 DEBUG: ld cache folder stats section complete"
-echo "🔍 DEBUG: cache-stats action finished successfully"
-        
+        set -euo pipefail
+        echo "🔍 DEBUG: ld cache folder stats section started"
+        # shellcheck disable=SC1091
+        source /tmp/cache_summary.sh
+        echo "🔍 DEBUG: cache_summary.sh loaded successfully"
+
+        echo "🔍 DEBUG: Calling summarize_dir for /home/runner/.ld_cache with top_n=10, sub_n=5"
+        echo "================="
+        echo "=== .ld_cache ==="
+        echo "================="
+        summarize_dir /home/runner/.ld_cache 10 5 || true
+        echo "🔍 DEBUG: ld cache folder stats section complete"
+        echo "🔍 DEBUG: cache-stats action finished successfully"