-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (51 loc) · 1.75 KB
/
Makefile
File metadata and controls
66 lines (51 loc) · 1.75 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
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
VERSION := $(shell git describe --tags --always 2>/dev/null || echo "dev")
BUILD_TIME := $(shell date -u +%Y%m%dT%H%M%SZ)
LDFLAGS := -s -w \
-X github.com/omersiar/ript/internal/version.Version=$(VERSION) \
-X github.com/omersiar/ript/internal/version.GitCommit=$(GIT_COMMIT) \
-X github.com/omersiar/ript/internal/version.BuildTime=$(BUILD_TIME)
.PHONY: help build run test clean docker-up docker-down harness-build harness-run
help:
@echo "Available commands:"
@echo " make build - Build the ript binary"
@echo " make run - Run ript locally"
@echo " make test - Run tests"
@echo " make clean - Clean build artifacts"
@echo " make docker-build - Build Docker image"
@echo " make docker-up - Start Docker Compose stack"
@echo " make docker-down - Stop Docker Compose stack"
@echo " make deps - Download dependencies"
@echo " make harness-build - Build test harness (mass topic creator)"
@echo " make harness-run - Build and run test harness"
deps:
go mod download
go mod tidy
build: deps
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o bin/ript ./cmd/ript
run: build
./bin/ript
test:
go test -v ./...
clean:
rm -rf bin/
go clean
docker-build:
docker build \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg VERSION=$(VERSION) \
--build-arg BUILD_TIME=$(BUILD_TIME) \
-t ript:latest .
docker-up: docker-build
docker compose up -d
docker-down:
docker compose down
docker-logs:
docker compose logs -f ript
docker-shell:
docker compose exec ript sh
harness-build: deps
CGO_ENABLED=0 go build -o bin/testharness ./cmd/testharness
harness-run: harness-build
./bin/testharness
.DEFAULT_GOAL := help