-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (115 loc) Β· 4.48 KB
/
Makefile
File metadata and controls
140 lines (115 loc) Β· 4.48 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
SHELL := /bin/bash
.PHONY: test test-unit test-integration test-all clean setup lint format generate-models
# Use UV for all commands
PYTHON = uv run --env-file .test.env
# Quick unit tests (no database dependencies)
test-unit:
@echo "π§ͺ Running unit tests..."
$(PYTHON) pytest tests/unit/ -m "unit" -v
# Integration tests (requires databases)
test-integration:
@echo "π Running integration tests..."
$(PYTHON) pytest tests/integration/ -m "integration" -v --log-cli-level=CRITICAL
# All tests with coverage
test-all:
@echo "π― Running all tests with coverage..."
$(PYTHON) pytest --cov=src/amp --cov-report=html --cov-report=term-missing
# Specific loader tests
test-postgresql:
@echo "π Running PostgreSQL tests..."
$(PYTHON) pytest tests/ -m "postgresql" -v --log-cli-level=ERROR
test-redis:
@echo "π΄ Running Redis tests..."
$(PYTHON) pytest tests/ -m "redis" -v --log-cli-level=ERROR
test-deltalake:
@echo "πΊ Running Delta Lake tests..."
$(PYTHON) pytest tests/ -m "delta_lake" -v --log-cli-level=ERROR
test-iceberg:
@echo "π§ Running iceberg tests..."
$(PYTHON) pytest tests/ -m "iceberg" -v --log-cli-level=ERROR
test-snowflake:
@echo "βοΈ Running Snowflake tests..."
$(PYTHON) pytest tests/ -m "snowflake" -v --log-cli-level=ERROR
test-lmdb:
@echo "β‘ Running LMDB tests..."
$(PYTHON) pytest tests/ -m "lmdb" -v --log-cli-level=ERROR
# Parallel streaming integration tests
test-parallel-streaming:
@echo "β‘ Running parallel streaming integration tests..."
$(PYTHON) pytest tests/integration/test_parallel_streaming.py -v -s --log-cli-level=INFO
# Performance tests
test-performance:
@echo "π Running performance tests..."
$(PYTHON) pytest tests/performance/ -m "performance" -v --log-cli-level=ERROR
# Code quality (using your ruff config)
lint:
@echo "π Linting code..."
$(PYTHON) ruff check .
lint-fix:
@echo "π Linting code..."
$(PYTHON) ruff check . --fix
format:
@echo "β¨ Formatting code..."
$(PYTHON) ruff format .
# Generate Pydantic models from OpenAPI spec
generate-models:
@echo "ποΈ Generating Pydantic models from OpenAPI spec..."
$(PYTHON) python scripts/generate_models.py
# Setup development environment
setup:
@echo "π Setting up development environment..."
uv sync --all-groups
# Install specific loader dependencies
install-postgresql:
@echo "π¦ Installing PostgreSQL dependencies..."
uv sync --group postgresql --group test --group dev
install-redis:
@echo "π¦ Installing Redis dependencies..."
uv sync --group redis --group test --group dev
install-snowflake:
@echo "π¦ Installing Snowflake dependencies..."
uv sync --group snowflake --group test --group dev
# Database setup for testing
test-setup:
@echo "π³ Starting test databases..."
docker run -d --name test-postgres \
-e POSTGRES_DB=test_db \
-e POSTGRES_USER=test_user \
-e POSTGRES_PASSWORD=test_pass \
-p 5432:5432 postgres:13
docker run -d --name test-redis -p 6379:6379 redis:7-alpine
@echo "β³ Waiting for databases to start..."
sleep 10
# Cleanup test databases
test-cleanup:
@echo "π§Ή Cleaning up test databases..."
-docker stop test-postgres test-redis
-docker rm test-postgres test-redis
# Full test cycle with setup/cleanup (good for CI)
test-ci: test-setup test-all test-cleanup
# Clean test artifacts
clean:
@echo "π§Ή Cleaning test artifacts..."
rm -rf .pytest_cache/
rm -rf htmlcov/
rm -rf .coverage
find . -type d -name __pycache__ -delete
find . -type f -name "*.pyc" -delete
# Show available commands
help:
@echo "Available commands:"
@echo " make setup - Setup development environment"
@echo " make generate-models - Generate Pydantic models from OpenAPI spec"
@echo " make test-unit - Run unit tests (fast)"
@echo " make test-integration - Run integration tests"
@echo " make test-parallel-streaming - Run parallel streaming integration tests"
@echo " make test-all - Run all tests with coverage"
@echo " make test-postgresql - Run PostgreSQL tests"
@echo " make test-redis - Run Redis tests"
@echo " make test-snowflake - Run Snowflake tests"
@echo " make test-performance - Run performance tests"
@echo " make lint - Lint code with ruff"
@echo " make format - Format code with ruff"
@echo " make test-setup - Start test databases"
@echo " make test-cleanup - Stop test databases"
@echo " make clean - Clean test artifacts"