Skip to content

Commit c4d6ad4

Browse files
dugshubclaude
andcommitted
CI: Enhance Makefile with dual-mode CI targets
- Add CI-specific targets (quality, ci-native, ci-docker) - Support both uv and pip package managers - Add environment detection for flexible tooling - Implement ci-setup for environment info display - Add clean-docker target for container cleanup - Separate test targets by component type - Add format-check for CI validation 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fc95342 commit c4d6ad4

File tree

1 file changed

+81
-6
lines changed

1 file changed

+81
-6
lines changed

Makefile

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CLI Patterns Makefile
22
# Development and testing automation
33

4-
.PHONY: help install test test-unit test-integration test-coverage test-parser test-executor test-design test-fast test-components lint type-check format clean all
4+
.PHONY: help install test test-unit test-integration test-coverage test-parser test-executor test-design test-fast test-components lint type-check format clean clean-docker all quality format-check ci-setup ci-native ci-docker verify-sync benchmark test-all ci-summary
55

66
# Default target
77
help:
@@ -21,12 +21,18 @@ help:
2121
@echo "make type-check - Run mypy type checking"
2222
@echo "make format - Format code with black"
2323
@echo "make clean - Remove build artifacts and cache"
24+
@echo "make clean-docker - Clean up Docker containers and volumes"
2425
@echo "make all - Run format, lint, type-check, and test"
2526

2627
# Install dependencies
2728
install:
28-
uv sync
29-
uv add --dev mypy pytest pytest-asyncio pytest-cov pre-commit black ruff
29+
@if command -v uv > /dev/null 2>&1; then \
30+
uv sync; \
31+
uv add --dev mypy pytest pytest-asyncio pytest-cov pre-commit black ruff; \
32+
else \
33+
pip install -e .; \
34+
pip install mypy pytest pytest-asyncio pytest-cov pre-commit black ruff; \
35+
fi
3036

3137
# Run all tests
3238
test:
@@ -51,15 +57,23 @@ test-file:
5157

5258
# Lint code
5359
lint:
54-
uv run ruff check src/ tests/
60+
@if command -v uv > /dev/null 2>&1; then \
61+
uv run ruff check src/ tests/; \
62+
else \
63+
ruff check src/ tests/; \
64+
fi
5565

5666
# Type check with mypy
5767
type-check:
5868
PYTHONPATH=src python3 -m mypy src/cli_patterns --strict
5969

6070
# Format code
6171
format:
62-
uv run black src/ tests/
72+
@if command -v uv > /dev/null 2>&1; then \
73+
uv run black src/ tests/; \
74+
else \
75+
black src/ tests/; \
76+
fi
6377

6478
# Clean build artifacts
6579
clean:
@@ -71,6 +85,10 @@ clean:
7185
rm -rf .coverage
7286
rm -rf .ruff_cache
7387

88+
# Clean Docker containers and volumes
89+
clean-docker:
90+
docker compose -f docker-compose.ci.yml down --remove-orphans
91+
7492
# Run all quality checks
7593
all: format lint type-check test
7694

@@ -115,4 +133,61 @@ summary:
115133
@echo -n "Integration Tests: "
116134
@PYTHONPATH=src python3 -m pytest tests/integration/ -q 2>/dev/null | tail -1
117135
@echo -n "Type Check: "
118-
@PYTHONPATH=src python3 -m mypy src/cli_patterns --strict 2>&1 | grep -E "Success|Found" | head -1
136+
@PYTHONPATH=src python3 -m mypy src/cli_patterns --strict 2>&1 | grep -E "Success|Found" | head -1
137+
138+
# CI-specific targets
139+
# Combined quality checks
140+
quality: lint type-check format-check
141+
142+
# Format check (for CI, doesn't modify)
143+
format-check:
144+
@if command -v uv > /dev/null 2>&1; then \
145+
uv run black src/ tests/ --check; \
146+
else \
147+
black src/ tests/ --check; \
148+
fi
149+
150+
# Environment info (for sync checking)
151+
ci-setup:
152+
@echo "=== Environment Info ==="
153+
@python3 --version
154+
@if command -v uv > /dev/null 2>&1; then \
155+
uv --version; \
156+
echo "=== Dependencies (first 10) ==="; \
157+
uv pip list | head -10; \
158+
else \
159+
pip --version; \
160+
echo "=== Dependencies (first 10) ==="; \
161+
pip list | head -10; \
162+
fi
163+
164+
# Native CI run
165+
ci-native: quality test-all
166+
167+
# Docker CI run
168+
ci-docker:
169+
docker compose -f docker-compose.ci.yml run --rm ci make ci-native
170+
171+
# Verify environments are in sync
172+
verify-sync:
173+
@echo "Checking native environment..."
174+
@make ci-setup > /tmp/native-env.txt
175+
@echo "Checking Docker environment..."
176+
@docker compose -f docker-compose.ci.yml run ci make ci-setup > /tmp/docker-env.txt
177+
@echo "Comparing..."
178+
@diff /tmp/native-env.txt /tmp/docker-env.txt && echo "✅ In sync!" || echo "❌ Out of sync!"
179+
180+
# Placeholder for future benchmarks
181+
benchmark:
182+
@echo "Benchmark suite not yet implemented"
183+
@echo "Future: pytest tests/ --benchmark-only"
184+
185+
# All tests
186+
test-all: test-unit test-integration
187+
188+
# Summary for CI
189+
ci-summary:
190+
@echo "=== CI Summary ==="
191+
@echo "Quality checks: make quality"
192+
@echo "All tests: make test-all"
193+
@echo "Component tests: make test-components"

0 commit comments

Comments
 (0)