-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (65 loc) · 2.29 KB
/
Makefile
File metadata and controls
79 lines (65 loc) · 2.29 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
.PHONY: help build test test-v test-race vet fmt fmt-check tidy sample docker-sample clean ci
VERSION := 26.05.01
help:
@echo "Firefly Framework for Go — v$(VERSION)"
@echo ""
@echo "Targets:"
@echo " build go build ./... across the workspace"
@echo " test go test ./... across the workspace"
@echo " test-v go test -v ./..."
@echo " test-race go test -race ./... across the workspace"
@echo " vet go vet ./..."
@echo " fmt gofmt -w ."
@echo " fmt-check verify gofmt cleanliness"
@echo " tidy go mod tidy in every module"
@echo " sample run samples/orders/web"
@echo " docker-sample build the orders sample container image"
@echo " ci fmt-check + vet + build + test"
build:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
echo "==> build $$dir"; \
(cd $$dir && go build ./...) || exit 1; \
done
test:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
echo "==> test $$dir"; \
(cd $$dir && go test ./...) || exit 1; \
done
test-v:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
echo "==> test $$dir"; \
(cd $$dir && go test -v ./...) || exit 1; \
done
vet:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
(cd $$dir && go vet ./...) || exit 1; \
done
fmt:
gofmt -w .
fmt-check:
@out=$$(gofmt -l .); \
if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi
tidy:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
echo "==> tidy $$dir"; \
(cd $$dir && go mod tidy) || exit 1; \
done
test-race:
@for m in $$(find . -mindepth 2 -maxdepth 4 -name go.mod -not -path './*/vendor/*'); do \
dir=$$(dirname $$m); \
echo "==> test -race $$dir"; \
(cd $$dir && go test -race ./...) || exit 1; \
done
sample:
cd samples/orders/web && go run .
docker-sample:
docker build -t firefly-orders-sample:$(VERSION) -f samples/orders/web/Dockerfile .
clean:
@find . -name '*.test' -delete
@find . -name 'coverage.*' -delete
ci: fmt-check vet build test