Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (77 loc) · 2.52 KB
/
Copy pathMakefile
File metadata and controls
89 lines (77 loc) · 2.52 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
88
89
.PHONY: help install install-dev test lint format clean container-build container-run container-test
help:
@echo "Available commands:"
@echo ""
@echo "Development:"
@echo " make install - Install production dependencies"
@echo " make install-dev - Install development dependencies"
@echo " make test - Run tests with coverage"
@echo " make lint - Run linting checks"
@echo " make format - Format code with black and ruff"
@echo " make clean - Clean build and cache files"
@echo ""
@echo "Container:"
@echo " make container-build - Build container image"
@echo " make container-run - Run container with dry-run"
@echo " make container-test - Test container image"
@echo " make container-push - Push container to registry"
install:
pip install -r requirements.txt
install-dev:
pip install -r requirements.txt
pip install -r requirements-dev.txt
test:
pytest -v --cov=firstpass --cov-report=term-missing --cov-report=html
lint:
@echo "Running ruff..."
ruff check .
@echo "Running black check..."
black --check .
@echo "Running mypy..."
mypy firstpass --ignore-missing-imports
format:
@echo "Formatting with black..."
black .
@echo "Auto-fixing with ruff..."
ruff check --fix .
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .pytest_cache/
rm -rf .ruff_cache/
rm -rf .mypy_cache/
rm -rf htmlcov/
rm -f .coverage
rm -f coverage.xml
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name '*.pyc' -delete
# Container commands
RUNTIME ?= $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
IMAGE_NAME ?= firstpass-agent
IMAGE_TAG ?= latest
container-build:
@if [ -z "$(RUNTIME)" ]; then \
echo "Error: Neither podman nor docker found"; \
exit 1; \
fi
$(RUNTIME) build -t $(IMAGE_NAME):$(IMAGE_TAG) -f Containerfile .
container-run: container-build
@if [ ! -f .env ]; then \
echo "Error: .env file not found. Copy .env.example to .env"; \
exit 1; \
fi
$(RUNTIME) run --rm \
--env-file .env \
-v $(PWD)/config.yaml:/app/config.yaml:ro \
$(IMAGE_NAME):$(IMAGE_TAG) --dry-run
container-test: container-build
$(RUNTIME) run --rm $(IMAGE_NAME):$(IMAGE_TAG) --help
@echo "Container test passed!"
container-push: container-build
@if [ -z "$(REGISTRY)" ]; then \
echo "Error: REGISTRY not set. Use: make container-push REGISTRY=quay.io/yourorg"; \
exit 1; \
fi
$(RUNTIME) tag $(IMAGE_NAME):$(IMAGE_TAG) $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)
$(RUNTIME) push $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)