-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 857 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (30 loc) · 857 Bytes
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
DB_SERVICE_NAME=postgres
# Application Entry point
start: check-db
go run cmd/daemon/main.go
# Internal target: Ensures DB is up and running before proceeding
check-db:
@echo "Checking database status..."
@if [ -z "$$(docker compose ps -q $(DB_SERVICE_NAME))" ] || [ -z "$$(docker compose ps --filter "status=running" -q $(DB_SERVICE_NAME))" ]; then \
echo "Database is not running. Starting database..."; \
docker compose up -d; \
echo "Waiting for database to be ready..."; \
sleep 5; \
else \
echo "Database is already running."; \
fi
# Run all tests
test:
go test -v ./...
# Run tests for determining test coverage
test-cover:
go test -cover ./...
# Starts database instance
start-db:
docker compose up -d
# Stops database
stop-db:
docker compose down
# Stops database and deletes it's data
clean-db:
docker compose down -v