-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (53 loc) · 1.8 KB
/
Makefile
File metadata and controls
65 lines (53 loc) · 1.8 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
.PHONY: install test test-cov lint build dev-run dev-redis deploy logs clean release help
help:
@echo "Hermes - Alertmanager Routing and Distribution System"
@echo ""
@echo "Usage:"
@echo " make install Install dependencies"
@echo " make test Run tests"
@echo " make test-cov Run tests with coverage"
@echo " make lint Run linter"
@echo " make build Build Docker image"
@echo " make dev-run Run locally"
@echo " make dev-redis Run Redis locally"
@echo " make deploy Deploy to Kubernetes"
@echo " make logs Show pod logs"
@echo " make release Create and push a release tag (usage: make release VERSION=v1.0.0)"
@echo " make clean Clean up"
install:
pip install -e ".[dev]"
test:
PYTHONPATH=. pytest tests/ -v
test-cov:
PYTHONPATH=. pytest tests/ -v --cov=src --cov-report=html --cov-report=term
lint:
ruff check src/ tests/
build:
docker build -t hermes:latest .
dev-run:
python -m src.main
dev-redis:
docker run -d --name hermes-redis -p 6379:6379 redis:7-alpine
deploy:
kubectl apply -k k8s/overlays/prod
logs:
kubectl logs -l app=hermes -f --tail=100
clean:
rm -rf .pytest_cache .coverage htmlcov *.egg-info
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
release:
ifndef VERSION
@echo "Error: VERSION is required"
@echo "Usage: make release VERSION=v1.0.0"
@exit 1
endif
@echo "Running tests before release..."
@$(MAKE) test
@echo "Checking for uncommitted changes..."
@git diff-index --quiet HEAD -- || (echo "Error: Uncommitted changes exist. Commit or stash them first." && exit 1)
@echo "Creating tag $(VERSION)..."
@git tag $(VERSION)
@echo "Pushing tag to origin..."
@git push origin $(VERSION)
@echo "Release $(VERSION) created! Check GitHub Actions for Docker build status."