-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (48 loc) · 1.37 KB
/
Copy pathMakefile
File metadata and controls
61 lines (48 loc) · 1.37 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
# binary name matches the CLI command name
BINARY = goqueue
GO = go
# to signify that all these are commands and not files
.PHONY = all buiild run clean test lint docker-up docker-down help
## all: Default when running make
all: build
# compile the binary for current OS/arch
#these flags strip debugging info and reduce binary size
#@ prints only output and no command
## build: build the binary
build:
$(GO) build -ldflags="-s -w" -o $(BINARY) .
@echo "built ./$(BINARY)"
## run: run the binary
run: build
./$(BINARY) server --workers 5 --port 8080
## test: run all tests with race detector enabled
test:
$(GO) test ./... -v -race
## lint: run go vet to catch common mistakes
lint:
$(GO) vet ./...
## clean: remove compiled binary
clean:
rm -f $(BINARY)
## deps: download and tidy dependencies
deps:
$(GO) mod tidy
## docker-up: build image and start Redis + goqueue together
docker-up:
docker compose up --build
## docker-down: stop and remove all containers and volumes
docker-down:
docker compose down -v
## submit: submit a sample job (server must already be running)
submit: build
./$(BINARY) submit \
--name "sample-job" \
--type email_send \
--priority high
## stats: show live queue metrics (server must already be running)
stats: build
./$(BINARY) stats
## help: print this help message
help:
@echo "Available targets:"
@grep -E '^##' Makefile | sed 's/## / /'