-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (66 loc) · 2.31 KB
/
Makefile
File metadata and controls
82 lines (66 loc) · 2.31 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
# DQV Agent Makefile
# Docker is the source of truth for builds/tests
.PHONY: help build test test-external lint format typecheck all clean shell
# Default target
help:
@echo "DQV Agent - Available targets:"
@echo ""
@echo "Docker targets (source of truth):"
@echo " build - Build Docker image"
@echo " test - Run tests with coverage (mounts artifacts)"
@echo " test-external - Run external tests (requires secrets in .env)"
@echo " lint - Run ruff linter"
@echo " format - Run ruff formatter"
@echo " typecheck - Run mypy strict type checking"
@echo " all - Run lint + format-check + typecheck + test"
@echo " shell - Open interactive shell in container"
@echo " clean - Remove Docker image and artifacts"
@echo ""
@echo "Local targets (for quick iteration, Docker is canonical):"
@echo " local-install - Install locally with pip"
@echo " local-test - Run tests locally"
# Docker image name
IMAGE := dqv:dev
# Build Docker image
build:
docker build -t $(IMAGE) .
# Run tests with artifacts mounted
test: build
@mkdir -p artifacts
docker run --rm -v "$$(pwd)/artifacts:/app/artifacts" $(IMAGE) \
pytest -q --cov=src --cov-fail-under=90
# Run external tests (requires .env with secrets)
test-external: build
@mkdir -p artifacts
docker run --rm \
--env-file .env \
-v "$$(pwd)/artifacts:/app/artifacts" \
$(IMAGE) \
pytest -m external -q
# Run linter
lint: build
docker run --rm $(IMAGE) ruff check .
# Run formatter (check mode)
format: build
docker run --rm $(IMAGE) ruff format --check .
# Run type checker
typecheck: build
docker run --rm $(IMAGE) mypy --strict src
# Run all checks
all: build
docker run --rm -v "$$(pwd)/artifacts:/app/artifacts" $(IMAGE) \
sh -c "ruff check . && ruff format --check . && mypy --strict src && pytest -q --cov=src --cov-fail-under=90"
# Interactive shell
shell: build
docker run --rm -it -v "$$(pwd)/artifacts:/app/artifacts" $(IMAGE) bash
# Clean up
clean:
docker rmi $(IMAGE) 2>/dev/null || true
rm -rf artifacts/ .mypy_cache/ .pytest_cache/ .ruff_cache/ .coverage htmlcov/
# ============================================
# Local development targets (Docker is canonical)
# ============================================
local-install:
pip install -e ".[dev]"
local-test:
pytest -q --cov=src