version: "3" vars: COMPOSE: docker compose DEV_FLAGS: -f docker-compose.yml -f docker-compose.dev.yml INFRA_SERVICES: db redis APP_SERVICES: api audio-worker nc-watcher DEV_SERVICES: db redis api web audio-worker nc-watcher # ── Development ─────────────────────────────────────────────────────────────── tasks: dev:up: desc: "Start full dev environment and follow logs (recommended)" cmds: - echo "Starting services..." - "{{.COMPOSE}} {{.DEV_FLAGS}} up -d --wait {{.DEV_SERVICES}}" - echo "All services healthy. Following logs... (Ctrl+C to stop)" - "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f api web audio-worker nc-watcher" dev:down: desc: "Stop all dev services" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} down" dev:restart: desc: "Restart one service or all (e.g. task dev:restart SERVICE=api)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} restart {{if .SERVICE}}{{.SERVICE}}{{else}}{{.DEV_SERVICES}}{{end}}" dev:rebuild: desc: "Rebuild and restart one service (e.g. task dev:rebuild SERVICE=api)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} up -d --build --wait {{.SERVICE}}" dev:build: desc: "Rebuild all dev images (run after dependency changes)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} build api web audio-worker nc-watcher" dev:fresh: desc: "Wipe volumes, rebuild all images, and start clean" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} down -v" - "{{.COMPOSE}} {{.DEV_FLAGS}} build api web audio-worker nc-watcher" - task: dev:up dev:clean: desc: "Stop services and remove volumes (preserves images)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} down -v" dev:nuke: desc: "Full cleanup — removes containers, volumes, images, and build cache" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} down -v --rmi local" - docker system prune -f dev:status: desc: "Show status of all dev services" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} ps" dev:logs: desc: "Follow dev logs (all services, or pass SERVICE=api)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f {{.SERVICE}}" dev:web: desc: "Run Vite dev server locally with HMR (run alongside dev:up)" dir: web cmds: - npm run dev # ── Production ──────────────────────────────────────────────────────────────── up: desc: Start all services (production) cmds: - "{{.COMPOSE}} up -d" down: desc: Stop all services (production) cmds: - "{{.COMPOSE}} down" logs: desc: Follow logs (pass SERVICE= to filter) cmds: - "{{.COMPOSE}} logs -f {{.SERVICE}}" restart: desc: Restart a service without rebuilding (e.g. task restart SERVICE=api) cmds: - "{{.COMPOSE}} restart {{.SERVICE}}" # ── Database ────────────────────────────────────────────────────────────────── migrate: desc: Run Alembic migrations (works whether or not the API container is running) cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic upgrade head" migrate:auto: desc: Autogenerate a migration (e.g. task migrate:auto M="add users table") cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic revision --autogenerate -m '{{.M}}'" db:reset: desc: "Drop and recreate schema (dev only — destroys all data)" cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic downgrade base" - "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic upgrade head" # ── Setup ───────────────────────────────────────────────────────────────────── setup: desc: First-time setup — start services, configure Nextcloud, seed data cmds: - task: up - echo "Waiting for Nextcloud to initialize (~60s)..." - sleep 60 - bash scripts/nc-setup.sh - bash scripts/seed.sh # ── Testing ─────────────────────────────────────────────────────────────────── test:feature: desc: "Fast post-feature check: typecheck + frontend + backend unit tests (no services needed)" cmds: - task: typecheck:web - task: lint - task: test:web - task: test:api:unit - task: test:worker - task: test:watcher ci: desc: "Full CI pipeline: lint + typecheck + all tests (requires services running)" cmds: - task: lint - task: typecheck:web - task: test:web - task: test:api - task: test:worker - task: test:watcher test: desc: Run all backend tests (unit + integration) deps: [test:api, test:worker, test:watcher] test:web: desc: Run frontend unit tests dir: web cmds: - npm run test test:api: desc: Run all API tests with coverage (unit + integration) dir: api cmds: - uv run pytest tests/ -v --cov=src/rehearsalhub --cov-report=term-missing test:api:unit: desc: Run API unit tests only (no database or external services required) dir: api cmds: - uv run pytest tests/unit/ -v -m "not integration" test:worker: desc: Run worker tests with coverage dir: worker cmds: - uv run pytest tests/ -v --cov=src/worker --cov-report=term-missing test:watcher: desc: Run watcher tests with coverage dir: watcher cmds: - uv run pytest tests/ -v --cov=src/watcher --cov-report=term-missing test:integration: desc: Run integration tests (requires services running) dir: api cmds: - uv run pytest tests/integration/ -v -m integration # ── Linting & type checking ─────────────────────────────────────────────────── check: desc: Run all linters and type checkers cmds: - task: lint - task: typecheck:web lint: desc: Lint all services cmds: - cd api && uv run ruff check src/ tests/ - cd worker && uv run ruff check src/ tests/ - cd watcher && uv run ruff check src/ tests/ - cd web && npm run lint typecheck:web: desc: TypeScript type check dir: web cmds: - npm run typecheck format: desc: Auto-format all Python source cmds: - cd api && uv run ruff format src/ tests/ - cd worker && uv run ruff format src/ tests/ - cd watcher && uv run ruff format src/ tests/ # ── Shells ──────────────────────────────────────────────────────────────────── shell:api: desc: Shell into the API container interactive: true cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} exec api bash" shell:db: desc: Open a psql shell interactive: true cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} exec db psql -U ${POSTGRES_USER:-rh_user} -d ${POSTGRES_DB:-rehearsalhub}" shell:redis: desc: Open a redis-cli shell interactive: true cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} exec redis redis-cli" # ── Container Build & Release ───────────────────────────────────────────────── build: desc: Build all production images cmds: - bash scripts/build-containers.sh push: desc: Push all container images to the registry cmds: - bash scripts/upload-containers-simple.sh release: desc: Build and push all containers for release (uses current git tag) cmds: - bash scripts/release.sh