-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
203 lines (173 loc) · 4.67 KB
/
Makefile
File metadata and controls
203 lines (173 loc) · 4.67 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Planfile Makefile
.PHONY: help install test docker-build docker-run ci-loop clean
# Default target
help:
@echo "Planfile CI/CD Automation"
@echo "============================"
@echo ""
@echo "Targets:"
@echo " install Install Planfile with all integrations"
@echo " test Run tests"
@echo " docker-build Build Docker image"
@echo " docker-run Run Docker container"
@echo " ci-loop Run CI/CD loop locally"
@echo " clean Clean up artifacts"
@echo ""
@echo "Examples:"
@echo " make install # Install with all backends"
@echo " make ci-loop BACKENDS=github # Run with GitHub only"
@echo " make docker-run AUTO_FIX=true # Run with auto-fix enabled"
# Installation
install:
pip install -e ".[all]"
pip install llx
# Testing
test:
pytest --cov=src --cov-report=html --cov-report=term
# Docker commands
docker-build:
docker build -t planfile/runner:latest .
docker-run:
docker-compose up -d planfile-runner
docker-compose logs -f planfile-runner
docker-stop:
docker-compose down
docker-clean:
docker-compose down -v
docker system prune -f
# CI/CD commands
ci-loop:
@if [ -z "$(STRATEGY)" ]; then \
echo "Usage: make ci-loop STRATEGY=<strategy.yaml> [BACKENDS=github,jira] [MAX_ITERATIONS=5]"; \
exit 1; \
fi
planfile auto loop \
--strategy $(STRATEGY) \
--project . \
--backend $(or $(BACKENDS),github) \
--max-iterations $(or $(MAX_ITERATIONS),5) \
$(if $(filter true,$(AUTO_FIX)),--auto-fix) \
--output ci-results.json
# Development commands
dev-setup:
python -m venv .venv
source .venv/bin/activate && pip install -e ".[dev]"
pre-commit install
lint:
ruff check src/ tests/
ruff format --check src/ tests/
format:
ruff check --fix src/ tests/
ruff format src/ tests/
# Examples
example-github:
@echo "Running example with GitHub backend..."
@echo "Make sure GITHUB_TOKEN and GITHUB_REPO are set"
planfile auto loop \
--strategy examples/strategies/onboarding.yaml \
--project . \
--backend github \
--max-iterations 3 \
--dry-run
example-jira:
@echo "Running example with Jira backend..."
@echo "Make sure JIRA_URL, JIRA_EMAIL, JIRA_TOKEN, JIRA_PROJECT are set"
planfile auto loop \
--strategy examples/strategies/ecommerce-mvp.yaml \
--project . \
--backend jira \
--max-iterations 3 \
--dry-run
# Monitoring
status:
planfile auto ci-status
logs:
docker-compose logs -f planfile-runner
# Cleanup
clean:
rm -rf .pytest_cache
rm -rf htmlcov
rm -rf .coverage
rm -rf coverage.json
rm -rf ci-results.json
rm -rf test-results.xml
rm -rf build
rm -rf dist
rm -rf *.egg-info
# Release
version:
@python -c "import planfile; print(planfile.__version__)"
bump-patch:
bump2version patch
bump-minor:
bump2version minor
bump-major:
bump2version major
publish:
python3 -m build
twine upload dist/*
# CI/CD Pipeline helpers
pipeline-test:
@echo "Running full CI/CD pipeline locally..."
@echo "Step 1: Install dependencies"
make install
@echo "Step 2: Run tests"
make test
@echo "Step 3: Run CI loop"
make ci-loop STRATEGY=examples/strategies/onboarding.yaml BACKENDS=github MAX_ITERATIONS=1
pipeline-docker:
@echo "Running CI/CD pipeline in Docker..."
make docker-build
docker-compose up -d
sleep 10
docker-compose exec planfile-runner planfile auto loop \
--strategy /app/planfile.yaml \
--project /workspace \
--backend github \
--max-iterations 1
# Advanced examples
full-loop:
@echo "Running full bug-fix loop with auto-fix..."
planfile auto loop \
--strategy examples/strategies/onboarding.yaml \
--project . \
--backend github \
--max-iterations 10 \
--auto-fix \
--output full-loop-results.json
strategy-review:
planfile strategy review \
--strategy examples/strategies/onboarding.yaml \
--project . \
--backend github
# Integration tests
test-github:
@echo "Testing GitHub integration..."
@if [ -z "$(GITHUB_TOKEN)" ] || [ -z "$(GITHUB_REPO)" ]; then \
echo "Set GITHUB_TOKEN and GITHUB_REPO"; \
exit 1; \
fi
python3 -m tests.integration.test_github
test-jira:
@echo "Testing Jira integration..."
@if [ -z "$(JIRA_TOKEN)" ] || [ -z "$(JIRA_URL)" ]; then \
echo "Set JIRA_TOKEN and JIRA_URL"; \
exit 1; \
fi
python -m tests.integration.test_jira
# Documentation
docs:
@echo "Generating documentation..."
cd docs && make html
serve-docs:
@echo "Serving documentation..."
cd docs/_build/html && python3 -m http.server 8080
# Quick start
quick-start:
@echo "Quick start with Planfile"
@echo "=========================="
@echo "1. Install: make install"
@echo "2. Configure: export GITHUB_TOKEN=your_token"
@echo "3. Run: make ci-loop STRATEGY=examples/strategies/onboarding.yaml"
@echo ""
@echo "For Docker: make docker-build && make docker-run"