fix: improve firmware image collection and diagnostics

Enhanced the firmware build workflow with better diagnostics:

1. Added directory listing before artifact collection to show what was built
2. Changed collection strategy to copy all files from target dir (excluding
   metadata like .ipk, .manifest, .json, .buildinfo)
3. Added warnings when no firmware images are found
4. Added file listing after successful builds to verify output
5. Show file sizes during collection

This should help identify why firmware artifacts might be missing:
- Shows exactly what files were generated
- Provides clear warnings if target directory is empty
- Helps debug firmware build issues

The new approach copies all firmware image files regardless of extension,
which is more robust than pattern matching specific file types.
This commit is contained in:
CyberMind-FR 2025-12-24 00:23:02 +01:00
parent fde352369a
commit 2432001fcd

View File

@ -377,6 +377,9 @@ jobs:
echo "⏱️ Build Time: ${MINUTES}m ${SECONDS}s"
echo "📁 Output: bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/"
echo ""
echo "📦 Generated Files:"
ls -lh "bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/" 2>/dev/null | grep -v "^total" | grep -v "^d" | head -20 || echo " (no files found)"
echo ""
else
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@ -401,6 +404,9 @@ jobs:
echo "⏱️ Total Build Time: ${MINUTES}m ${SECONDS}s"
echo "📁 Output: bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/"
echo ""
echo "📦 Generated Files:"
ls -lh "bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/" 2>/dev/null | grep -v "^total" | grep -v "^d" | head -20 || echo " (no files found)"
echo ""
else
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@ -423,17 +429,47 @@ jobs:
echo "📦 Collecting Firmware Images"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Copy firmware images
# List what was actually built
echo "🔍 Searching for firmware images in:"
echo " openwrt/bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/"
echo ""
if [[ -d "openwrt/bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}" ]]; then
echo "📂 Directory contents:"
ls -lh "openwrt/bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}/" | grep -v "^total" | grep -v "^d" || echo " (empty)"
echo ""
fi
# Copy firmware images (all common patterns)
IMG_COUNT=0
for pattern in "*.img.gz" "*.bin" "*sysupgrade*" "*factory*"; do
TARGET_DIR="openwrt/bin/targets/${{ matrix.target }}/${{ matrix.subtarget }}"
if [[ -d "$TARGET_DIR" ]]; then
# Find all firmware image files (not directories, not packages)
while IFS= read -r file; do
if [[ -f "$file" ]]; then
cp "$file" artifacts/
echo " ✅ $(basename "$file")"
IMG_COUNT=$((IMG_COUNT + 1))
# Skip certain files
case "$(basename "$file")" in
*.ipk|*.manifest|*.json|sha256sums|*.buildinfo|packages)
continue
;;
*)
cp "$file" artifacts/
echo " ✅ $(basename "$file") ($(du -h "$file" | cut -f1))"
IMG_COUNT=$((IMG_COUNT + 1))
;;
esac
fi
done < <(find openwrt/bin/targets -name "$pattern" 2>/dev/null)
done
done < <(find "$TARGET_DIR" -maxdepth 1 -type f 2>/dev/null)
else
echo "⚠️ Warning: Target directory not found: $TARGET_DIR"
fi
if [[ $IMG_COUNT -eq 0 ]]; then
echo ""
echo "⚠️ WARNING: No firmware images found!"
echo "This could indicate a build failure or unexpected output location."
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"