version: '3' vars: build_dir: bin binary: '{{.build_dir}}/receiver' cmd: ./cmd/main tasks: all: desc: Default target cmds: - task: build build: desc: Build the receiver binary cmds: - mkdir -p {{.build_dir}} - echo "Building receiver..." - go build -o {{.binary}} {{.cmd}} run: desc: Alias for run-dev cmds: - task: run-dev run-dev: desc: Run the receiver in development mode deps: - build cmds: - echo "Running receiver in development mode..." - GO_ENV=dev {{.binary}} listen run-prod: desc: Run the receiver in production mode deps: - build cmds: - echo "Running receiver in production mode..." - GO_ENV=prod {{.binary}} listen run-test: desc: Run the receiver in test mode deps: - build cmds: - echo "Running receiver in test mode..." - GO_ENV=test {{.binary}} listen run-local: desc: Run receiver via go run (default GO_ENV=dev) cmds: - | echo "Running receiver via go run (GO_ENV=${GO_ENV:-dev})..." GO_ENV=${GO_ENV:-dev} go run {{.cmd}} listen test: desc: Run go test ./... cmds: - echo "Running go test..." - go test ./... test-int: desc: Run integration tests (requires Docker) cmds: - | echo "Running integration tests (Docker required)..." GO_ENV=${GO_ENV:-test} go test -tags=integration ./test/integration/... test-ginkgo: desc: Run ginkgo suites cmds: - command -v ginkgo >/dev/null || { echo "Install ginkgo (go install github.com/onsi/ginkgo/v2/ginkgo@latest)"; exit 1; } - ginkgo -r -v coverage: desc: Generate coverage report (profile + HTML) cmds: - mkdir -p coverage - echo "Generating test coverage report..." - go test ./... -coverprofile=coverage/coverage.out - go tool cover -html=coverage/coverage.out -o coverage/coverage.html fmt: desc: Format Go code cmds: - echo "Formatting code..." - go fmt ./... lint: desc: Run golangci-lint cmds: - | if ! command -v golangci-lint >/dev/null; then echo "Install golangci-lint: https://golangci-lint.run/" exit 1 fi - echo "Linting code..." - golangci-lint run ./... deps: desc: Sync go.mod / go.sum cmds: - echo "Tidying go modules..." - go mod tidy upgrade: desc: Upgrade Go dependencies cmds: - echo "Upgrading go modules..." - go get -u -v ./... - go mod tidy install-test: desc: Install ginkgo/gomega tooling cmds: - echo "Installing ginkgo tooling..." - go install github.com/onsi/ginkgo/v2/ginkgo@latest - go get github.com/onsi/gomega/... clean: desc: Clean build + coverage artifacts cmds: - echo "Cleaning build artifacts..." - rm -rf {{.build_dir}} coverage up: desc: Start TimescaleDB + NATS dev stack (docker compose) cmds: - echo "Starting dev infrastructure..." - docker compose -f docker-compose.dev.yml up -d postgres nats nats-box nats-exporter - docker compose -f docker-compose.dev.yml up -d otel-collector jaeger prometheus grafana down: desc: Stop dev compose stack and remove containers cmds: - echo "Stopping dev infrastructure..." - docker compose -f docker-compose.dev.yml down -v dev-run: desc: Run receiver locally against dev stack deps: - up env: CAATSM_NATS_URL: nats://localhost:4222 CAATSM_NATS_MODE: jetstream CAATSM_POSTGRES_URL: postgres://caatsm:caatsm@localhost:5432/aviation?sslmode=disable CAATSM_TELEMETRY_ENABLED: "true" CAATSM_TELEMETRY_ENDPOINT: localhost:4318 CAATSM_TELEMETRY_INSECURE: "true" GO_ENV: dev cmds: - | echo "Ensuring observability stack is healthy (Jaeger @ http://localhost:16686)" docker compose -f docker-compose.dev.yml ps jaeger otel-collector >/dev/null echo "Running receiver with telemetry (mode=${CAATSM_NATS_MODE:-core})" CAATSM_NATS_MODE=${CAATSM_NATS_MODE:-core} \ go run ./cmd/main listen seed: desc: Generate sample telegrams (publish to NATS) cmds: - | GO_ENV=dev \ NATS_URL=${CAATSM_NATS_URL:-nats://localhost:4222} \ SUBJECT=${CAATSM_NATS_SUBJECT:-telegram.serial} \ COUNT=${COUNT:-10} \ CATEGORY=${CATEGORY:-mixed} \ STATUS=${STATUS:-random} \ bash -c ' set -euo pipefail cmd=(go run ./cmd/seed-telegrams) if [ -n "$NATS_URL" ]; then cmd+=("--nats-url" "$NATS_URL") fi cmd+=( --subject "$SUBJECT" --count "$COUNT" --category "$CATEGORY" --status "$STATUS" ) exec "${cmd[@]}" ' help: desc: Show this help message cmds: - | printf "Task targets:\n" task --list