-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (77 loc) · 2.5 KB
/
Makefile
File metadata and controls
94 lines (77 loc) · 2.5 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
.PHONY: help dev up down logs run test lint build clean db-migrate wait-postgres db-migrate fmt test-coverage docker-build docker-dev
# Default target
help:
@echo "FIP - Financial Intelligence Platform"
@echo ""
@echo "Available commands:"
@echo " dev Start postgres, temporal, and app (full stack development)"
@echo " up Start postgres and temporal services (Docker)"
@echo " down Stop all Docker services"
@echo " logs Tail application logs"
@echo " run Run the Go server locally (no Docker)"
@echo " build Build the binary"
@echo " test Run all unit tests"
@echo " test-coverage Run tests with coverage report"
@echo " lint Run static analysis (go vet)"
@echo " fmt Format code"
@echo " clean Clean build artifacts"
@echo " docker-build Build app Docker image"
@echo " docker-dev Run full stack in Docker"
@echo ""
# Development targets
dev: up wait-postgres db-migrate run
up:
@echo "Starting postgres and temporal..."
docker compose up -d postgres temporal
@echo "✓ Services started"
down:
@echo "Stopping all services..."
docker compose down
@echo "✓ Services stopped"
logs:
docker compose logs -f app
wait-postgres:
@echo "Waiting for Postgres to be ready..."
@docker compose exec -T postgres sh -c 'until pg_isready -U fip >/dev/null 2>&1; do sleep 1; done'
@echo "✓ Postgres ready"
db-migrate:
@echo "Setting up database schema..."
@docker compose exec -T postgres psql -U fip -d fip < migrations/0001_init_analyses.sql
@echo "✓ Database schema ready"
run:
@echo "Starting FIP server..."
go run ./cmd/server
build:
@echo "Building FIP binary..."
go build -o bin/fip ./cmd/server
@echo "✓ Binary built: bin/fip"
# Test targets
test:
@echo "Running tests..."
go test -v -race ./...
test-coverage:
@echo "Running tests with coverage..."
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "✓ Coverage report: coverage.html"
# Code quality targets
lint:
@echo "Running linter..."
go vet ./...
@echo "✓ Lint checks passed"
fmt:
@echo "Formatting code..."
go fmt ./...
@echo "✓ Code formatted"
clean:
@echo "Cleaning..."
rm -rf bin/
rm -f coverage.out coverage.html
@echo "✓ Clean complete"
# Docker targets
docker-build:
@echo "Building Docker image..."
docker compose build app
@echo "✓ Docker image built"
docker-dev: docker-build
docker compose up app