From c739104bcafdff22607993f9c3d95949b73bcde4 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 24 Dec 2025 11:37:26 +0100 Subject: [PATCH] feat: add local build tool that replicates GitHub Actions workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add local-build.sh: comprehensive local build system - Validates packages (Makefiles, JSON, JavaScript, shell scripts) - Downloads and caches OpenWrt SDK - Builds .ipk packages locally - Supports multiple architectures (x86-64, ARM, MIPS) - Collects artifacts with SHA256 checksums - Update CLAUDE.md with local build documentation - Add Local Build section with usage examples - Update Development Workflow to include local testing - List supported architectures and environment variables - Update secubox-tools/README.md - Add comprehensive local-build.sh documentation - Update workflow examples to include local building - Add dependencies and installation instructions Benefits: - Test builds locally before CI/CD - Faster development iteration - Reduced GitHub Actions usage - Offline development support Usage: ./secubox-tools/local-build.sh validate ./secubox-tools/local-build.sh build ./secubox-tools/local-build.sh build luci-app- ./secubox-tools/local-build.sh build --arch ./secubox-tools/local-build.sh full 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 --- CLAUDE.md | 56 ++- secubox-tools/README.md | 105 ++++- secubox-tools/local-build.sh | 793 +++++++++++++++++++++++++++++++++++ 3 files changed, 950 insertions(+), 4 deletions(-) create mode 100755 secubox-tools/local-build.sh diff --git a/CLAUDE.md b/CLAUDE.md index c40d585d..eb8e9d13 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,6 +54,51 @@ find . -name "*.json" -exec jsonlint {} \; ./secubox-tools/secubox-debug.sh luci-app- ``` +### Local Build (Replicates GitHub Actions) + +The `local-build.sh` script allows you to build and test packages locally, replicating the GitHub Actions workflows: + +```bash +# Validate all packages (syntax, JSON, shell scripts) +./secubox-tools/local-build.sh validate + +# Build all packages for x86_64 +./secubox-tools/local-build.sh build + +# Build single package +./secubox-tools/local-build.sh build luci-app-system-hub + +# Build for specific architecture +./secubox-tools/local-build.sh build --arch aarch64-cortex-a72 + +# Full validation + build +./secubox-tools/local-build.sh full + +# Clean build artifacts +./secubox-tools/local-build.sh clean +``` + +Supported architectures: +- `x86-64` - PC, VMs (default) +- `aarch64-cortex-a53` - ARM Cortex-A53 (ESPRESSObin) +- `aarch64-cortex-a72` - ARM Cortex-A72 (MOCHAbin, RPi4) +- `aarch64-generic` - Generic ARM64 +- `mips-24kc` - MIPS 24Kc (TP-Link) +- `mipsel-24kc` - MIPS LE (Xiaomi, GL.iNet) + +The script automatically: +- Downloads and caches the OpenWrt SDK +- Configures feeds (packages, luci) +- Copies your packages to the SDK +- Builds .ipk packages +- Collects artifacts in `build//` + +Environment variables: +- `OPENWRT_VERSION` - OpenWrt version (default: 23.05.5) +- `SDK_DIR` - SDK directory (default: ./sdk) +- `BUILD_DIR` - Build output directory (default: ./build) +- `CACHE_DIR` - Download cache directory (default: ./cache) + ## Architecture ### LuCI Package Structure @@ -412,10 +457,19 @@ Run the validation script to check all naming conventions: 2. **Run validation checks** (CRITICAL): ```bash ./secubox-tools/validate-modules.sh + # Or use the local build tool: + ./secubox-tools/local-build.sh validate ``` 3. Test JSON syntax: `jsonlint .json` 4. Test shell scripts: `shellcheck