[tools] node = "22.17.0" [tasks.setup] description = "Install Node deps and Playwright browsers" run = """ if [ ! -d node_modules ]; then npm install; fi npx playwright install chromium """ [tasks."docker:build"] description = "Build OpenWRT LuCI image with podman (seccomp bypass for apk)" run = "podman build --security-opt seccomp=unconfined -t zt-gateway-luci:dev -f Dockerfile.openwrt ." [tasks."docker:up"] description = "Build image + start the full test stack (router + ZT gateways + LuCI)" depends = ["docker:build"] run = "docker compose up -d" [tasks."docker:down"] description = "Stop the test stack" run = "docker compose down" [tasks."docker:logs"] description = "View OpenWRT LuCI container logs" run = "docker compose logs -f openwrt-luci" [tasks."docker:shell"] description = "Open shell in the OpenWRT LuCI container" run = "docker compose exec openwrt-luci sh" [tasks."test:e2e"] description = "Run Playwright E2E tests (assumes stack is up)" depends = ["setup"] run = "npx playwright test" [tasks."test:e2e:ui"] description = "Run Playwright tests in interactive UI mode" depends = ["setup"] run = "npx playwright test --ui" [tasks."test:e2e:headed"] description = "Run Playwright tests in headed (visible) browser" depends = ["setup"] run = "npx playwright test --headed" [tasks."test:e2e:debug"] description = "Run Playwright tests in debug mode" depends = ["setup"] run = "npx playwright test --debug" [tasks."inspect"] description = "Start stack and open headed browser for manual inspection" depends = ["docker:up"] run = "npx playwright open chromium http://localhost:8080/cgi-bin/luci/admin/services/zt-gateway" [tasks."reset"] description = "Reset gateway state to amsterdam (default) via docker exec" run = """ docker exec openwrt-luci /usr/sbin/zt-gateway-switch 10.99.12.3 force docker exec openwrt-luci sh -c "uci set zt-gateway.global.active_gateway=amsterdam && uci commit zt-gateway" || true """ [tasks.ci] description = "Full CI: build stack + install browsers + run E2E" depends = ["docker:up", "setup"] run = "npx playwright test" # =============================== # Deployment # =============================== [tasks."deploy:install"] description = "SCP app files to an OpenWrt device and restart services" run = ''' set -e HOST="${HOST:-root@192.168.15.1}" echo "==> Checking connectivity to ${HOST}..." if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$HOST" true 2>/dev/null; then echo "ERROR: Cannot reach ${HOST}. Check SSH access." echo " ssh-copy-id ${HOST} # if needed" exit 1 fi echo " ${HOST} is reachable." echo "==> Uploading files..." # root/ files → strip leading root/, map to / on device scp -O -q root/usr/sbin/zt-gateway-switch "$HOST:/usr/sbin/" echo " zt-gateway-switch" scp -O -q root/usr/share/rpcd/ucode/zt-gateway.uc "$HOST:/usr/share/rpcd/ucode/" echo " rpcd/ucode/zt-gateway.uc" scp -O -q root/usr/share/rpcd/ucode/system.uc "$HOST:/usr/share/rpcd/ucode/" echo " rpcd/ucode/system.uc" scp -O -q root/usr/share/ucode/luci/runtime.uc "$HOST:/usr/share/ucode/luci/" echo " ucode/luci/runtime.uc" scp -O -q root/usr/share/luci/menu.d/luci-app-zt-gateway.json "$HOST:/usr/share/luci/menu.d/" echo " menu.d/luci-app-zt-gateway.json" scp -O -q root/usr/share/rpcd/acl.d/luci-app-zt-gateway.json "$HOST:/usr/share/rpcd/acl.d/" echo " acl.d/luci-app-zt-gateway.json" scp -O -q root/etc/config/zt-gateway "$HOST:/etc/config/" echo " config/zt-gateway" # Frontend view ssh -q "$HOST" mkdir -p /www/luci-static/resources/view/zt-gateway scp -O -q htdocs/luci-static/resources/view/zt-gateway/overview.js "$HOST:/www/luci-static/resources/view/zt-gateway/" echo " overview.js" echo "==> Setting permissions..." ssh -q "$HOST" chmod +x /usr/sbin/zt-gateway-switch echo "==> Restarting rpcd and uhttpd..." ssh -q "$HOST" /etc/init.d/rpcd restart ssh -q "$HOST" /etc/init.d/uhttpd restart DEVICE_IP=$(echo "$HOST" | sed 's/.*@//') echo "" echo "==> Done! Open: http://${DEVICE_IP}/cgi-bin/luci/admin/services/zt-gateway" '''