-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
76 lines (59 loc) · 1.62 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
73
74
75
76
SOURCE_FILES?=./...
GOLANGCI_VERSION=v1.59.0
GOIMPORTS_VERSION=v0.21.0
COVERAGE=coverage.out
export GO111MODULE := on
export PATH := ./bin:$(PATH)
default: build
.PHONY: link-git-hooks
link-git-hooks:
find .git/hooks -type l -exec rm {} \;
find githooks -type f -exec ln -sf ../../{} .git/hooks/ \;
.PHONY: build
build:
go install $(SOURCE_FILES)
.PHONY: test
test:
go test $(SOURCE_FILES) -coverprofile $(COVERAGE) -timeout=30s -parallel=4 -cover -race
.PHONY: test-examples
test-examples:
cd examples && go test ./...
.PHONY: fmt
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./**/**/*.go
.PHONY: lint-fix
lint-fix:
./bin/golangci-lint run --fix
.PHONY: lint
lint:
./bin/golangci-lint run $(SOURCE_FILES)
.PHONY: check
check: test lint-fix
.PHONY: install-golangci-lint
install-golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_VERSION)
.PHONY: install-goimports
install-goimports:
go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
.PHONY: tools
tools: install-golangci-lint install-goimports
.PHONY: addcopy
addcopy:
@scripts/add-copy.sh
TAG=$(patsubst v%,%,$(shell git describe --tags --dirty --always))
.PHONY: check-version
check-version:
scripts/check-version.sh "$(TAG)"
.PHONY: openapi-pipeline
openapi-pipeline: install-goimports
echo "Running OpenAPI Generation and Validation process"
$(MAKE) -C tools clean_client
echo "Running client generation"
$(MAKE) -C tools generate_client
echo "Validating generated SDK"
go test ./test
.PHONY: gen-docs
gen-docs:
$(MAKE) -C tools generate_docs
./scripts/toc.sh