-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (62 loc) · 2.09 KB
/
Copy pathMakefile
File metadata and controls
87 lines (62 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Webhook Gateway Makefile
.PHONY: help install dev test clean build start stop logs
.DEFAULT_GOAL := help
help: ## 顯示可用指令
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
##@ 開發環境
install: ## 安裝依賴
uv sync
install-dev: ## 安裝開發依賴
uv sync --dev
dev: ## 啟動開發服務器
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
dev-ipython: ## 啟動 ipython shell
uv run ipython
##@ 測試
test: ## 運行單元測試
uv run python -m pytest tests/ -v
e2e-test: ## 運行端到端 webhook 系統測試
uv run python scripts/e2e_webhook_test.py
##@ 功能演示腳本
demo-webhook: ## 演示 webhook 功能(需要服務器運行)
uv run python scripts/webhook_demo.py
demo-api: ## 演示訂閱管理 API(需要服務器運行)
uv run python scripts/subscriptions_api_demo.py
setup-test-data: ## 設置測試數據
uv run python scripts/setup_test_data.py
debug-webhook: ## Debug webhook 問題
uv run python scripts/webhook_debug.py
##@ TaskIQ 任務處理
worker: ## 啟動 TaskIQ worker
uv run -m taskiq worker app.taskiq.broker_manager:broker --workers 1
##@ Docker 部署
build: ## 構建並啟動所有服務
docker compose build
docker compose up -d
start: ## 啟動所有服務
docker compose up -d
stop: ## 停止所有服務
docker compose down
restart: stop start ## 重啟所有服務
logs: ## 查看服務日誌
docker compose logs -f
status: ## 查看服務狀態
docker compose ps
##@ 程式碼品質
lint: ## 代碼檢查
uv run ruff check app/
format: ## 格式化代碼
uv run ruff format app/
uv run ruff check --fix app/
##@ 維護
clean: ## 清理本地文件
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} +
rm -f *.db *.sqlite *.sqlite3
clean-docker: ## 清理 Docker 資源
docker compose down -v
docker system prune -f
##@ 監控
health: ## 檢查服務健康狀態
@curl -f http://localhost:8000/health || echo "服務不可用"