version: "3"
vars:
BINARY_NAME: zc
PACKAGE_NAME: zc2
INSTALL_DIR:
sh: echo "$HOME/.local/bin"
INSTALL_PATH: "{{.INSTALL_DIR}}/{{.BINARY_NAME}}"
COMMIT_SHA:
sh: git show --format='%H' --no-patch
TIMESTAMP:
sh: date +%Y%m%d-%H%M%S
MACOS_SIGN_ARGS: 'CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY="Apple Development"'
tasks:
default:
desc: Build binary and start Docker services
cmds:
- task: build
build:
desc: Build binary and start Docker services
cmds:
- task: build:bin
- docker compose down
- docker compose build
- docker compose up -d
build:bin:
desc: Build the release binaries incrementally and install them to ~/.local/bin
cmds:
- cargo build --release --workspace
- mkdir -p "{{.INSTALL_DIR}}"
- install -m 0755 target/release/{{.BINARY_NAME}} target/release/zc-hooks "{{.INSTALL_DIR}}/"
dev:
desc: Debug build for fixing bugs (~1-2 s after an edit), linked as zc-dev
cmds:
- cargo build --bin {{.BINARY_NAME}}
- mkdir -p "{{.INSTALL_DIR}}"
- ln -sf "{{.ROOT_DIR}}/target/debug/{{.BINARY_NAME}}" "{{.INSTALL_DIR}}/zc-dev"
build:docker:
desc: Build Docker image only (no binary compilation)
cmds:
- docker compose build
run:
desc: Build and run the CLI
deps: [build]
cmds:
- ./{{.BINARY_NAME}}
release:
desc: Run the release binary
cmds:
- "{{.INSTALL_PATH}}"
debug:
desc: Build and run with full backtrace
deps: [build]
env:
RUST_BACKTRACE: full
cmds:
- ./{{.BINARY_NAME}}
broker:
desc: Start broker in foreground mode
cmds:
- "{{.INSTALL_PATH}} broker"
broker:daemon:
desc: Start broker in daemon (background) mode
cmds:
- "{{.INSTALL_PATH}} -d broker"
bench:
desc: Run default benchmark (10 concurrent, 1000 requests)
cmds:
- "{{.INSTALL_PATH}} bench {{.CLI_ARGS}}"
bench:compare:
desc: Compare all routing strategies
cmds:
- "{{.INSTALL_PATH}} bench --compare {{.CLI_ARGS}}"
test:two-brokers:
desc: Run two brokers and two workers locally, then bench with different strategies
cmds:
- bash scripts/two-brokers-two-workers-local.sh
info:
desc: Show system info, clusters, and network status
cmds:
- "{{.INSTALL_PATH}} info"
docker:up:
desc: Start Docker services
cmds:
- docker compose up -d
docker:down:
desc: Stop Docker services
cmds:
- docker compose down
docker:logs:
desc: Show Docker service logs
cmds:
- docker compose logs -f
macos:gen:
desc: Generate macos/Zakuro.xcodeproj from macos/project.yml
cmds:
- xcodegen generate --spec macos/project.yml
macos:build:
desc: Build Zakuro.app (Release) signed with your Apple Development identity
deps: [macos:gen]
preconditions:
- sh: test -n "$ZAKURO_DEVELOPMENT_TEAM"
msg: "export ZAKURO_DEVELOPMENT_TEAM=<Team ID> first (see macos/README.md)"
cmds:
- xcodebuild -project macos/Zakuro.xcodeproj -scheme Zakuro -configuration Release -destination 'generic/platform=macOS' -derivedDataPath macos/build {{.MACOS_SIGN_ARGS}} DEVELOPMENT_TEAM=$ZAKURO_DEVELOPMENT_TEAM build
macos:install:
desc: Install Zakuro.app into /Applications, quit the running copy, relaunch
deps: [macos:build]
cmds:
- pkill -x Zakuro || true
- rm -rf /Applications/Zakuro.app
- cp -R macos/build/Build/Products/Release/Zakuro.app /Applications/Zakuro.app
- open /Applications/Zakuro.app
macos:test:
desc: Run ZakuroAgentKit tests (swift test) and the app's unit tests (xcodebuild test)
cmds:
- swift test --package-path macos/Packages/ZakuroAgentKit
- xcodegen generate --spec macos/project.yml
- xcodebuild test -project macos/Zakuro.xcodeproj -scheme Zakuro -destination 'platform=macOS,arch=arm64' -derivedDataPath macos/build CODE_SIGNING_ALLOWED=NO
macos:stub-agent:
desc: Serve a stub of the zc agent /v1 API (docs/agent-api/summary.v1.json) for app development
cmds:
- python3 -u macos/Scripts/stub-agent.py {{.CLI_ARGS}}
clean:
desc: Remove build artifacts
cmds:
- cargo clean
- rm -rf target/