-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
39 lines (31 loc) · 990 Bytes
/
Makefile
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
.DEFAULT_GOAL := build
.PHONY: build clean dist test coverage vet fmt tidy
build: # Build executable for local target
go build
clean: # Clean cache
go clean -testcache -modcache -cache
dist: # Build executable for supported platforms
for ARCH in amd64 arm64 ppc64le; do \
for OS in linux darwin windows; do \
if GOARCH=$${ARCH} GOOS=$${OS} go build -o dist/distronaut-$${OS}-$${ARCH}; then \
echo "built $${OS}-$${ARCH}"; \
fi \
done \
done;
test: # Run test
go clean -testcache
go run tests/server.go &
curl --retry 5 --retry-connrefused 0.0.0.0:3000/ready --silent
RC=$$(go test ./... -coverprofile .coverage); true
curl 0.0.0.0:3000/stop
exit $$RC
coverage: # Check coverage
test -f .coverage && true || make test
go tool cover -func .coverage
test $$(go tool cover -func .coverage | grep -Po 'total:\s+.statements.\s+\d+' | grep -Po '\d+') -ge 0
vet: # Vet code
go vet
fmt: # Format code
test $$(go fmt ./... | wc -l) -eq 0
tidy: # Tidy
go mod tidy