-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (54 loc) · 1.85 KB
/
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
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
# --------- BUILD & RELEASE ------------
COMMIT = $(shell git rev-parse HEAD)
.PHONY: build build-docker build-linux
build-linux:
mkdir -p bin/linux
GOARCH=amd64 GOOS=linux go build -o bin/linux ./cmd/...
build-darwin:
mkdir -p bin/darwin
GOARCH=amd64 GOOS=darwin go build -o bin/darwin ./cmd/...
build: build-linux build-darwin build-docker
build-docker:
docker build -t pdcl-acceptance-sentinel:$(COMMIT) .
docker tag pdcl-acceptance-sentinel:$(COMMIT) pdcl-acceptance-sentinel:latest
.PHONY: release
release:
standard-version -s
clean:
rm bin/*
# --------- TESTS ------------
.PHONY: unit-test
unit-test:
go test -race -short -count=1 ./...
# --------- TOOLS ------------
.PHONY: install-tools install-npm-tools install-go-tools
install-tools: | install-go-tools install-npm-tools
install-npm-tools:
npm install -g @commitlint/cli @commitlint/config-conventional
npm install -g standard-version
install-go-tools:
cd tools && go mod download -x && cat tools.go | grep _ | grep \".*\" -o | xargs -tI % go install %
# --------- FORMAT & LINT ------------
.PHONY: format format-go format-add-trailing-newline
format: format-go format-add-trailing-newline
format-go:
gofumpt -w .
goimports -w -local github.com/areknoster/public-distributed-commit-log .
format-add-trailing-newline:
git grep -zIl '' | while IFS= read -rd '' f; do tail -c1 < "$$f" | read -r _ || echo >> "$$f"; done
.PHONY: lint lint-go lint-commits
lint: | lint-go lint-commits
lint-go:
golangci-lint run
lint-commits:
commitlint --from main --config commitlint.config.yaml
# --------- CODEGEN ------------
.PHONY: generate-code generate-go-code
generate-code: | generate-go-code format
generate-go-code:
go generate ./...
# --------- DOCS ------------
.PHONY: show-docs
show-docs:
echo "Visit http://localhost:6060/pkg/github.com/areknoster/public-distributed-commit-log/"
godoc -http=:6060