-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
185 lines (157 loc) · 4.56 KB
/
Makefile
File metadata and controls
185 lines (157 loc) · 4.56 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
.PHONY: help setup test quality clean docker-up docker-down
# Default target
help:
@echo "ExPgflow Development Commands"
@echo "=============================="
@echo ""
@echo "Setup:"
@echo " make setup - Set up development environment (interactive)"
@echo " make setup-nix - Set up using Nix"
@echo " make setup-docker - Set up using Docker (PostgreSQL only)"
@echo ""
@echo "Development:"
@echo " make deps - Install dependencies"
@echo " make compile - Compile the project"
@echo " make test - Run tests"
@echo " make test-watch - Run tests in watch mode"
@echo " make quality - Run all quality checks"
@echo ""
@echo "Database:"
@echo " make db-create - Create database"
@echo " make db-migrate - Run migrations"
@echo " make db-reset - Reset database"
@echo " make db-shell - Open PostgreSQL shell"
@echo ""
@echo "Docker:"
@echo " make docker-up - Start PostgreSQL with Docker"
@echo " make docker-down - Stop PostgreSQL"
@echo " make docker-logs - View PostgreSQL logs"
@echo " make docker-reset - Reset Docker environment"
@echo ""
@echo "Formatting & Linting:"
@echo " make format - Format code"
@echo " make lint - Run Credo linter"
@echo " make dialyzer - Run Dialyzer type checker"
@echo " make security - Run security checks"
@echo ""
@echo "Documentation:"
@echo " make docs - Generate documentation"
@echo " make docs-open - Generate and open documentation"
@echo ""
@echo "Cleanup:"
@echo " make clean - Clean build artifacts"
@echo " make clean-all - Clean everything (including deps)"
@echo ""
# Setup
setup:
@./scripts/setup-dev-environment.sh
setup-nix:
@./scripts/setup-dev-environment.sh --method nix
setup-docker:
@./scripts/setup-dev-environment.sh --method docker
# Dependencies
deps:
@echo "Installing dependencies..."
@mix deps.get
@echo "✓ Dependencies installed"
compile: deps
@echo "Compiling project..."
@mix compile
@echo "✓ Compilation complete"
# Testing
test: compile
@echo "Running tests..."
@mix test
test-watch:
@echo "Running tests in watch mode..."
@mix test.watch
test-coverage:
@echo "Generating test coverage report..."
@mix coveralls.html
@echo "✓ Coverage report generated at cover/excoveralls.html"
# Quality
quality:
@echo "Running quality checks..."
@mix quality
format:
@echo "Formatting code..."
@mix format
@echo "✓ Code formatted"
lint:
@echo "Running Credo linter..."
@mix credo --strict
dialyzer:
@echo "Running Dialyzer type checker..."
@mix dialyzer
security:
@echo "Running security checks..."
@mix sobelow --exit-on-warning
@mix deps.audit
# Database
db-create:
@echo "Creating database..."
@mix ecto.create
@echo "✓ Database created"
db-migrate:
@echo "Running migrations..."
@mix ecto.migrate
@echo "✓ Migrations complete"
db-reset:
@echo "Resetting database..."
@mix ecto.reset
@echo "✓ Database reset"
db-shell:
@echo "Opening PostgreSQL shell..."
@psql $(DATABASE_URL)
# Docker
docker-up:
@echo "Starting PostgreSQL with Docker..."
@docker-compose up -d
@echo "Waiting for PostgreSQL to be ready..."
@sleep 3
@docker-compose exec -T postgres pg_isready -U postgres || (echo "PostgreSQL not ready" && exit 1)
@echo "✓ PostgreSQL is ready"
@echo "Database URL: postgresql://postgres:postgres@localhost:5433/postgres"
docker-down:
@echo "Stopping PostgreSQL..."
@docker-compose down
@echo "✓ PostgreSQL stopped"
docker-logs:
@docker-compose logs -f
docker-reset:
@echo "Resetting Docker environment..."
@docker-compose down -v
@echo "✓ Docker environment reset"
# Documentation
docs:
@echo "Generating documentation..."
@mix docs
@echo "✓ Documentation generated at doc/index.html"
docs-open: docs
@echo "Opening documentation..."
@open doc/index.html || xdg-open doc/index.html || echo "Please open doc/index.html manually"
# Cleanup
clean:
@echo "Cleaning build artifacts..."
@mix clean
@echo "✓ Build artifacts cleaned"
clean-all: clean
@echo "Cleaning dependencies..."
@rm -rf deps _build
@echo "✓ All artifacts cleaned"
# Development shell (Nix)
shell:
@echo "Entering Nix development shell..."
@nix develop
# Quick start (for first-time setup)
quickstart: setup deps db-create db-migrate test
@echo ""
@echo "=============================="
@echo "✓ Setup complete!"
@echo "=============================="
@echo ""
@echo "Next steps:"
@echo " - Run tests: make test"
@echo " - Check quality: make quality"
@echo " - Read docs: make docs-open"
@echo ""