-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (52 loc) · 1.64 KB
/
Copy pathMakefile
File metadata and controls
61 lines (52 loc) · 1.64 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
.PHONY: init
init:
go mod tidy
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@v1.1.0
.PHONY: test
test:
go test ./ ./internal/... -coverprofile=coverage.txt
.PHONY: debug
debug:
dlv test $${PACKAGE:-./} --listen=:40000 --headless=true --api-version=2
.PHONY: docs
docs:
gomarkdoc --repository.url "https://github.com/guidewire-oss/sawchain" ./ \
| awk 'BEGIN { RS=""; ORS="\n\n" } { gsub(/```\n/, "```go\n"); print }' \
> docs/api-reference.md
EXAMPLES := $(wildcard examples/*/)
CLUSTER_NAME := sawchain-test
.PHONY: bump-all
bump-all:
@test -n "$(MODS)" || (echo "Usage: make bump-all MODS=\"mod1@v1 mod2@v2 ...\""; exit 1)
go get $(MODS)
go mod tidy
@for dir in $(EXAMPLES); do \
echo "==> Tidying $$dir"; \
(cd "$$dir" && go mod tidy) || exit 1; \
if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -n -C "$$dir" init >/dev/null 2>&1 && { $(MAKE) -C "$$dir" init || exit 1; } || :; \
$(MAKE) -n -C "$$dir" generate >/dev/null 2>&1 && { $(MAKE) -C "$$dir" generate || exit 1; } || :; \
$(MAKE) -n -C "$$dir" manifests >/dev/null 2>&1 && { $(MAKE) -C "$$dir" manifests || exit 1; } || :; \
fi; \
done
.PHONY: test-all
test-all:
$(MAKE) test
$(MAKE) cluster-up && $(MAKE) test-examples; result=$$?; $(MAKE) cluster-down; exit $$result
.PHONY: test-examples
test-examples:
@for dir in $(EXAMPLES); do \
echo "==> Testing $$dir"; \
if [ -f "$$dir/Makefile" ]; then \
$(MAKE) -C "$$dir" test || exit 1; \
else \
(cd "$$dir" && go test -v ./...) || exit 1; \
fi; \
done
.PHONY: cluster-up
cluster-up:
k3d cluster create $(CLUSTER_NAME)
vela install --yes
.PHONY: cluster-down
cluster-down:
k3d cluster delete $(CLUSTER_NAME)