- Replace sh <(wget -O - ...) with wget -O /tmp/... && sh /tmp/... - BusyBox ash on OpenWrt does not support process substitution <(...)
3.5 KiB
3.5 KiB
07. Build System, Testing & Deployment Pipeline
1. Release Package Compilation (build.sh)
Tachyon produces both legacy IPK (opkg) and modern APK (apk-tools, OpenWrt 25.x+) packages.
1.1. Running the Build
bash build.sh <x.y.z> [output-dir]
- Semver Requirement:
build.shstrictly enforces semantic versioning (x.y.z). - Cross-Filesystem WSL Protection: When executed under Windows Subsystem for Linux (WSL),
build.shautomatically clones the source repository into the native Linux filesystem (/tmp/tachyon-build-...) before packaging to avoid Windows filesystem metadata and permission corruption. - Outputs:
dist/release-final/tachyon_<version>_all.ipkdist/release-final/luci-app-tachyon_<version>_all.ipkdist/release-final/tachyon-<version>.apkdist/release-final/luci-app-tachyon-<version>.apk
2. End-User Installer (install.sh)
Tachyon provides an automated one-liner installer:
wget -O /tmp/tachyon-setup.sh https://raw.githubusercontent.com/Dushnilin/tachyon/main/install.sh && sh /tmp/tachyon-setup.sh
2.1. Installer Lifecycle
- Architecture & OS Detection: Detects OpenWrt version (23.05, 24.10, 25.x, SNAPSHOT), CPU architecture (
mips,mipsel,arm_cortex-a7,aarch64_cortex-a53,x86_64), and package manager (opkgvsapk). - Dependency Resolution: Ensures
ucode,ucode-mod-fs,ucode-mod-uci,ucode-mod-ubus,kmod-nft-tproxy,kmod-nft-queue,ca-bundleare installed. - Legacy Migration: Automatically detects
/etc/config/forkopor/etc/config/podkopand seamlessly migrates all rules and servers to/etc/config/tachyon. - Binary Provisioning: Downloads pre-compiled, optimized sing-box, Zapret, or ByeDPI binaries tailored for the router's target architecture.
- Zero-Reboot Initialization: Configures UCI defaults, registers LuCI menus, builds initial rulesets, and starts services without requiring a full router reboot.
3. Testing Workflows
3.1. Frontend Unit Tests (vitest)
cd fe-app-tachyon
npm test # Runs all 522+ vitest unit tests
npm run build # Verifies TypeScript compilation and LuCI bundle packaging
3.2. Backend Integration Tests & ucode Syntax Linting
Backend tests require the ucode binary. On development machines without local ucode, tests run inside the Docker CI image:
# 1. ucode syntax check across all 60+ modules
docker run --rm -v "$(pwd):/mnt" -w /mnt ucode-ci-img:latest bash tests/ucode_syntax_lint.sh
# 2. Run all backend behavioral and unit tests in parallel (-P4)
docker run --rm -v "$(pwd):/mnt" -w /mnt ucode-ci-img:latest bash tests/run_all.sh
# 3. Run a specific test
docker run --rm -v "$(pwd):/mnt" -w /mnt ucode-ci-img:latest bash tests/ai_doctor_local.sh
3.3. ShellCheck Linting
shellcheck --severity=error build.sh install.sh tachyon/files/etc/init.d/* tests/**/*.sh
4. Key Developer Gotchas & Conventions
- LF Line Endings: Enforced via
.gitattributes. Committing CRLF will break shell scripts on OpenWrt target systems. fe-app-tachyonPackage Manager: Always usenpm(npm install,npm test,npm run build), notyarn.- Version Placeholder:
__COMPILED_VERSION_VARIABLE__insrc/constants.tsis replaced duringbuild.shpackaging. Do not remove it. - UCI Config Permissions:
/etc/config/tachyonmust remainchmod 600because it can store sensitive Telegram bot tokens and API keys.