소스 검색

fix(action): enhance upload process with increased timeout and improved error handling

TheWildJames 4 달 전
부모
커밋
b12390d06e
3개의 변경된 파일28개의 추가작업 그리고 18개의 파일을 삭제
  1. 20 11
      .github/actions/cache-save/action.yml
  2. 1 1
      .github/actions/cache-setup/action.yml
  3. 7 6
      .github/actions/cache-stats/action.yml

+ 20 - 11
.github/actions/cache-save/action.yml

@@ -102,16 +102,26 @@ runs:
           local file=$1
           local tag_name=$2
           local max_attempts=3
+          local timeout_duration="30m"  # Increased timeout for large files
+          
           for ((i=1; i<=max_attempts; i++)); do
             echo "  Attempt $i for $file..."
             
-            if timeout 10m gh release upload "$tag_name" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
-              echo "  Successfully uploaded $file"
+            if timeout $timeout_duration gh release upload "$tag_name" "$file" --clobber --repo "$TARGET_REPO"; then
+              echo "  Successfully uploaded $file"
               return 0
+            else
+              local exit_code=$?
+              if [ $exit_code -eq 124 ]; then
+                echo "  ⚠ Attempt $i timed out (timeout after $timeout_duration). Retrying..."
+              else
+                echo "  ⚠ Attempt $i failed with exit code $exit_code. Retrying..."
+              fi
             fi
             
-            echo "  ⚠ Attempt $i failed or timed out. Retrying..."
-            sleep 5
+            if [ $i -lt $max_attempts ]; then
+              sleep 5
+            fi
           done
           return 1
         }
@@ -162,22 +172,21 @@ runs:
           MAX_SIZE=2000000000 # ~1.86GB
           
           if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
-            echo "⚠ File > 2GB. Splitting..."
+            echo "⚠ File > 2GB. Splitting into 1.5GB chunks..."
             split -b 1500M -a 2 "$FILENAME" "${FILENAME}.part"
             for part in "${FILENAME}".part*; do
-              echo "Uploading $part..."
+              echo "  Uploading $part..."
               if ! upload_with_retry "$part" "$TAG_NAME"; then
-                echo "::error::Failed to upload part $part after multiple attempts."
-                exit 1
+                echo "::warning::Failed to upload part $part after 3 attempts. Continuing with next cache..."
               fi
               rm -f "$part"
             done
             rm -rf "$FILENAME"
           else
-            echo "Uploading $FILENAME..."
+            echo "  File size: $((FILE_SIZE / 1024 / 1024))MB"
+            echo "  Uploading $FILENAME..."
             if ! upload_with_retry "$FILENAME" "$TAG_NAME"; then
-              echo "::error::Failed to upload $FILENAME after multiple attempts."
-              exit 1
+              echo "::warning::Failed to upload $FILENAME after 3 attempts. The cache will not be available for next run."
             fi
             rm -f "$FILENAME"
           fi

+ 1 - 1
.github/actions/cache-setup/action.yml

@@ -18,7 +18,7 @@ runs:
       shell: bash
       if: |
         (inputs.kernel_version == '5.10' && inputs.android_version == 'android12') ||
-        (inputs.kernel_version == '5.15' && inputs.android_version == 'android13') || 
+        (inputs.kernel_version == '5.10' && inputs.android_version == 'android13') || 
         (inputs.kernel_version == '5.15' && inputs.android_version == 'android13')
       working-directory: ${{ github.workspace }}
       run: |

+ 7 - 6
.github/actions/cache-stats/action.yml

@@ -18,6 +18,13 @@ runs:
         echo "===================="
         echo "=== ccache stats ==="
         echo "===================="
+        
+        if ! command -v ccache >/dev/null 2>&1; then
+          echo "⚠️  ccache not installed, skipping ccache stats"
+          echo "===================="
+          exit 0
+        fi
+        
         ccache -s || true
         echo "====================="
         echo "=== ccache config ==="
@@ -25,12 +32,6 @@ runs:
         ccache -p || true
         echo "====================="
 
-        if command -v ccache >/dev/null 2>&1; then
-          echo "ccache is installed"
-        else
-          echo "ccache not installed, exiting"
-          exit 0
-        fi
         STATS="$(ccache -s)"
         
         CACHEABLE=$(echo "$STATS" | awk '/Cacheable calls:/ {