From 60f2ffde67a7fe5914973cb28cae5683fbd06b57 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Tue, 23 Dec 2025 18:29:51 +0100 Subject: [PATCH] fix: improve artifact publishing and build diagnostics --- .github/workflows/build-openwrt-packages.yml | 157 +++++++++++++++---- 1 file changed, 125 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-openwrt-packages.yml b/.github/workflows/build-openwrt-packages.yml index 0a3c2a8c..ac3d3740 100644 --- a/.github/workflows/build-openwrt-packages.yml +++ b/.github/workflows/build-openwrt-packages.yml @@ -325,6 +325,7 @@ jobs: BUILT=0 FAILED=0 BUILT_LIST="" + FAILED_LIST="" for pkg in package/luci-app-*/; do [[ -d "$pkg" ]] || continue @@ -335,8 +336,19 @@ jobs: echo "📦 Building: $PKG_NAME" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + # Show package contents for debugging + echo "📁 Package contents:" + ls -la "$pkg" + + # Verify Makefile syntax + if ! grep -q "BuildPackage" "${pkg}Makefile"; then + echo "⚠️ WARNING: Makefile missing BuildPackage call" + fi + # Build with timeout (10 minutes per package) - if timeout 600 make package/${PKG_NAME}/compile V=s -j$(nproc) 2>&1 | tail -100; then + BUILD_LOG="/tmp/build-${PKG_NAME}.log" + + if timeout 600 make package/${PKG_NAME}/compile V=s -j$(nproc) > "$BUILD_LOG" 2>&1; then # Check if .ipk was created IPK_FILE=$(find bin -name "${PKG_NAME}*.ipk" 2>/dev/null | head -1) @@ -347,11 +359,17 @@ jobs: BUILT_LIST="${BUILT_LIST}${PKG_NAME}," else echo "⚠️ No .ipk generated for $PKG_NAME" + echo "📋 Last 50 lines of build log:" + tail -50 "$BUILD_LOG" FAILED=$((FAILED + 1)) + FAILED_LIST="${FAILED_LIST}${PKG_NAME}," fi else - echo "❌ Failed: $PKG_NAME" + echo "❌ Build failed: $PKG_NAME" + echo "📋 Last 100 lines of build log:" + tail -100 "$BUILD_LOG" FAILED=$((FAILED + 1)) + FAILED_LIST="${FAILED_LIST}${PKG_NAME}," fi echo "" @@ -363,7 +381,10 @@ jobs: echo "✅ Built: $BUILT packages" echo "❌ Failed: $FAILED packages" echo "" - echo "Packages: $BUILT_LIST" + echo "Built: $BUILT_LIST" + if [[ -n "$FAILED_LIST" ]]; then + echo "Failed: $FAILED_LIST" + fi - name: Collect artifacts id: collect @@ -426,88 +447,160 @@ jobs: fi # ============================================ - # Create release + # Publish combined artifacts (always) # ============================================ - release: + publish-artifacts: needs: [setup, build] runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') + if: always() && needs.build.result == 'success' steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Download all artifacts uses: actions/download-artifact@v4 with: path: packages pattern: packages-* - - name: Organize release + - name: Create combined archives run: | VERSION="${{ needs.setup.outputs.version }}" mkdir -p release - echo "📁 Organizing release..." + echo "📁 Creating combined archives..." + # Per-architecture archives for dir in packages/packages-*/; do [[ -d "$dir" ]] || continue ARCH=$(basename "$dir" | sed 's/packages-//') echo "📦 $ARCH" - tar -czf "release/secubox-${VERSION}-${ARCH}.tar.gz" -C "$dir" . + # Copy .ipk files to release + mkdir -p "release/${ARCH}" + cp "$dir"/*.ipk "release/${ARCH}/" 2>/dev/null || true + + # Create archive + if ls "release/${ARCH}"/*.ipk >/dev/null 2>&1; then + tar -czf "release/secubox-${VERSION}-${ARCH}.tar.gz" -C "release/${ARCH}" . + fi done # Create all-in-one archive - tar -czf "release/secubox-${VERSION}-all.tar.gz" -C packages . + tar -czf "release/secubox-${VERSION}-all-architectures.tar.gz" -C packages . # Checksums cd release - sha256sum *.tar.gz > SHA256SUMS + sha256sum *.tar.gz > SHA256SUMS 2>/dev/null || true - echo "📋 Release:" + echo "" + echo "📋 Release contents:" ls -la + + echo "" + echo "📊 Package count per architecture:" + for dir in */; do + [[ -d "$dir" ]] || continue + COUNT=$(ls "$dir"/*.ipk 2>/dev/null | wc -l) + echo " ${dir%/}: $COUNT packages" + done + + - name: Upload combined release + uses: actions/upload-artifact@v4 + with: + name: secubox-release-${{ needs.setup.outputs.version }} + path: | + release/*.tar.gz + release/SHA256SUMS + retention-days: 90 + + - name: Upload individual .ipk files + uses: actions/upload-artifact@v4 + with: + name: secubox-all-ipk-${{ needs.setup.outputs.version }} + path: release/*/*.ipk + retention-days: 90 + + # ============================================ + # Create GitHub Release (on tags or manual) + # ============================================ + release: + needs: [setup, build, publish-artifacts] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download release artifact + uses: actions/download-artifact@v4 + with: + name: secubox-release-${{ needs.setup.outputs.version }} + path: release + + - name: Download all .ipk files + uses: actions/download-artifact@v4 + with: + name: secubox-all-ipk-${{ needs.setup.outputs.version }} + path: ipk-files + continue-on-error: true + + - name: List packages + id: list-packages + run: | + echo "📦 Packages in release:" + find . -name "*.ipk" -exec basename {} \; | sort -u + + # Count unique packages + PKG_LIST=$(find . -name "*.ipk" -exec basename {} \; | sort -u | sed 's/_[0-9].*//g' | sort -u | tr '\n' ', ' | sed 's/,$//') + echo "packages=$PKG_LIST" >> $GITHUB_OUTPUT - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: name: SecuBox ${{ needs.setup.outputs.version }} + tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', needs.setup.outputs.version) }} body: | - ## SecuBox Packages v${{ needs.setup.outputs.version }} + ## 📦 SecuBox Packages v${{ needs.setup.outputs.version }} Pre-built LuCI packages for OpenWrt ${{ env.OPENWRT_VERSION }}. - ### 📦 Included Modules + ### ✅ Built Packages - - luci-app-secubox - Central Hub - - luci-app-crowdsec-dashboard - - luci-app-netdata-dashboard - - luci-app-netifyd-dashboard - - luci-app-wireguard-dashboard - - luci-app-network-modes - - luci-app-client-guardian - - luci-app-bandwidth-manager - - luci-app-auth-guardian - - luci-app-media-flow - - luci-app-vhost-manager + ${{ steps.list-packages.outputs.packages }} ### 📥 Installation ```bash - # Upload .ipk to router, then: + # Download the archive for your architecture + # Extract and upload .ipk files to router + opkg update - opkg install /tmp/luci-app-secubox_*.ipk + opkg install /tmp/luci-app-*.ipk + + # Restart services + /etc/init.d/rpcd restart ``` + ### 🏗️ Supported Architectures + + - `x86-64` - PC, VMs, Proxmox + - `aarch64-cortex-a72` - MOCHAbin, RPi4 + - `aarch64-cortex-a53` - ESPRESSObin + - `aarch64-generic` - Generic ARM64 + - `mips-24kc` - TP-Link, ath79 + - `mipsel-24kc` - Xiaomi, GL.iNet + - `mediatek-filogic` - MT7981/MT7986 + ### 🔗 Links - - [Website](https://secubox.cybermood.eu) - - [Documentation](https://cybermind.fr/docs/secubox) + - [SecuBox Website](https://secubox.cybermood.eu) + - [CyberMind.fr](https://cybermind.fr) files: | release/*.tar.gz release/SHA256SUMS draft: false + prerelease: ${{ github.event_name == 'workflow_dispatch' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}