-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (57 loc) · 1.85 KB
/
Copy pathMakefile
File metadata and controls
70 lines (57 loc) · 1.85 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
.PHONY: build deps run lint docker test docs integration-test
BINARY_NAME=scyllaridae
DOCKER_IMAGE=scyllaridae
deps:
go get .
go mod tidy
build: deps
go build -o $(BINARY_NAME) .
run: docker
@docker stop $(DOCKER_IMAGE) 2>/dev/null || true
@docker rm $(DOCKER_IMAGE) 2>/dev/null || true
@PORT=8080; \
VOLUMES="-v ./scyllaridae.yml:/app/scyllaridae.yml"; \
if [ -f ./cmd.sh ]; then \
VOLUMES="$$VOLUMES -v ./cmd.sh:/app/cmd.sh"; \
fi; \
while lsof -Pi :$$PORT -sTCP:LISTEN -t >/dev/null 2>&1; do \
PORT=$$((PORT + 1)); \
done; \
echo "Starting scyllaridae at http://localhost:$$PORT"; \
docker run -d $$VOLUMES --name $(DOCKER_IMAGE) -p $$PORT:8080 $(DOCKER_IMAGE):latest > /dev/null
lint:
go fmt ./...
golangci-lint run
@if command -v yq > /dev/null 2>&1; then \
echo "Running yq validation on YAML files..."; \
yq . **/*.yml > /dev/null; \
else \
echo "yq not found, skipping YAML validation"; \
fi
@if command -v shellcheck > /dev/null 2>&1; then \
echo "Running shellcheck on shell scripts..."; \
shellcheck **/*.sh; \
else \
echo "shellcheck not found, skipping shell script validation"; \
fi
@if command -v hadolint > /dev/null 2>&1; then \
echo "Running hadolint on Dockerfiles..."; \
find . -name "Dockerfile" | xargs hadolint; \
else \
echo "hadolint not found, skipping Dockerfile validation"; \
fi
docker:
docker build -t $(DOCKER_IMAGE):latest .
test:
go test -v -race ./...
integration-test: docker
./tests/integration-test.sh
docs:
docker build -t $(DOCKER_IMAGE)-docs:latest docs
@docker stop $(DOCKER_IMAGE)-docs 2>/dev/null || true
@PORT=8080; \
while lsof -Pi :$$PORT -sTCP:LISTEN -t >/dev/null 2>&1; do \
PORT=$$((PORT + 1)); \
done; \
echo "Starting documentation server at http://localhost:$$PORT"; \
docker run -d --rm --name $(DOCKER_IMAGE)-docs -p $$PORT:80 $(DOCKER_IMAGE)-docs:latest > /dev/null