-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
144 lines (120 loc) · 4.3 KB
/
Makefile
File metadata and controls
144 lines (120 loc) · 4.3 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
# Makefile for Mimic - Axum Web Server Project
# This file provides convenient shortcuts for common development tasks
.PHONY: help dev build release test test-verbose test-coverage test-all clean fmt lint check docker-build docker-run docker-stop docker-compose-up docker-compose-down install audit watch
# Default target - show help
help:
@echo "Mimic Project - Available Commands"
@echo "==================================="
@echo ""
@echo "Development:"
@echo " make dev - Run development server with debug logging"
@echo " make watch - Auto-rebuild and run on file changes (requires cargo-watch)"
@echo " make check - Quick compile check without building"
@echo ""
@echo "Building:"
@echo " make build - Build debug binary"
@echo " make release - Build optimized release binary"
@echo " make install - Install binary to system"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests"
@echo " make test-verbose - Run tests with output"
@echo " make test-coverage- Generate test coverage report"
@echo " make test-all - Run all tests including coverage"
@echo ""
@echo "Code Quality:"
@echo " make fmt - Format code with rustfmt"
@echo " make lint - Run clippy linter"
@echo " make audit - Security audit of dependencies"
@echo " make ci - Run all CI checks (fmt + lint + test)"
@echo ""
@echo "Docker:"
@echo " make docker-build - Build Docker image"
@echo " make docker-run - Run application in Docker container"
@echo " make docker-stop - Stop running Docker container"
@echo " make docker-compose-up - Start with docker-compose (uses .env)"
@echo " make docker-compose-down- Stop docker-compose services"
@echo ""
@echo "Cleanup:"
@echo " make clean - Remove build artifacts"
@echo " make clean-all - Deep clean including dependencies"
# Development
dev:
@echo "Starting development server..."
RUST_LOG=debug cargo run
watch:
@echo "Starting file watcher..."
@command -v cargo-watch >/dev/null 2>&1 || { echo "cargo-watch not installed. Run: cargo install cargo-watch"; exit 1; }
cargo watch -x run
check:
@echo "Running quick compile check..."
cargo check
# Building
build:
@echo "Building debug binary..."
cargo build
release:
@echo "Building release binary (optimized)..."
cargo build --release
@echo "Binary location: target/release/mimic"
install: release
@echo "Installing binary to system..."
cargo install --path .
# Testing
test:
@echo "Running tests..."
cargo test
test-verbose:
@echo "Running tests with output..."
cargo test -- --nocapture --test-threads=1
test-coverage:
@echo "Generating test coverage report..."
@command -v cargo-tarpaulin >/dev/null 2>&1 || { echo "cargo-tarpaulin not installed. Run: cargo install cargo-tarpaulin"; exit 1; }
cargo tarpaulin --out Html --output-dir ./coverage
@echo "Coverage report generated in ./coverage/index.html"
test-all: test test-coverage
@echo "All tests completed with coverage!"
# Code Quality
fmt:
@echo "Formatting code..."
cargo fmt
lint:
@echo "Running clippy linter..."
cargo clippy -- -D warnings
audit:
@echo "Auditing dependencies for security vulnerabilities..."
@command -v cargo-audit >/dev/null 2>&1 || { echo "cargo-audit not installed. Run: cargo install cargo-audit"; exit 1; }
cargo audit
ci: fmt lint test
@echo "All CI checks passed!"
ci-local: check fmt lint test
@echo "Local CI checks passed! Ready to commit."
# Docker
docker-build:
@echo "Building Docker image..."
docker build -t mimic:latest .
@echo "Image built: mimic:latest"
docker-compose-up:
@echo "Starting with docker-compose..."
docker compose up -d
@echo "Container running. Check with: docker-compose ps"
docker-compose-down:
@echo "Stopping docker-compose services..."
docker compose down
docker-run: docker-build
@echo "Running Docker container..."
docker run -d --name mimic-container -p 8080:8080 mimic:latest
@echo "Container running on http://localhost:8080"
@echo "Stop with: make docker-stop"
docker-stop:
@echo "Stopping Docker container..."
docker stop mimic-container || true
docker rm mimic-container || true
# Cleanup
clean:
@echo "Cleaning build artifacts..."
cargo clean
clean-all: clean
@echo "Deep cleaning (including dependencies cache)..."
rm -rf target/
rm -rf Cargo.lock