-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (74 loc) · 2.53 KB
/
Copy pathMakefile
File metadata and controls
94 lines (74 loc) · 2.53 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Directory containing the Makefile.
export PATH := $(GOBIN):$(PATH)
MIN_COVERAGE = 70
.PHONY: all
all: lint cover
.PHONY: lint
lint:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run ./...
.PHONY: test
test-unit:
@go test ./...
.PHONY: cover
test-cover:
@pkgs=$$(go list ./... | grep -v /Store/) \
go test -coverprofile=cover.out.tmp $${pkgs} -coverpkg=$${pkgs} \
&& cat cover.out.tmp | grep -v "rdtparser_base_visitor.go" > cover.out \
&& rm cover.out.tmp \
&& go tool cover -func=cover.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}' | \
awk '{if ($$1 < $(MIN_COVERAGE)) {print "Coverage is below $(MIN_COVERAGE)%!" ; exit 1}}' \
&& go tool cover -html=cover.out -o cover.html
.PHONY: test
test: test-cover
.PHONY: build
build: go-build
.PHONY: go-build
go-build:
@echo "Building raml"
@cd cmd/raml && go build -o ../../.build/raml \
&& echo "Build successful in .build/raml"
.PHONY: go
go:
@# Run go command with the specified arguments
@# examples:
@# make go a="mod tidy"
@# make go a="mod vendor"
@go $(a)
.PHONY: install
install:
@echo "Installing raml"
@cd cmd/raml && go install . \
&& echo "Installed to $(GOPATH)/bin/raml"
# ---------------------------------------------------------------------------
# CLI utility (cmd/raml)
# ---------------------------------------------------------------------------
.PHONY: build-cli
build-cli: go-build
.PHONY: lint-cli
lint-cli:
@cd cmd/raml && go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --timeout=5m -v ./...
# ---------------------------------------------------------------------------
# LSP server (cmd/raml-lsp)
# ---------------------------------------------------------------------------
.PHONY: build-lsp
build-lsp:
@echo "Building raml-lsp"
@cd cmd/raml-lsp && go build -o ../../.build/raml-lsp \
&& echo "Build successful in .build/raml-lsp"
.PHONY: test-lsp
test-lsp:
@cd cmd/raml-lsp && go test ./...
.PHONY: lint-lsp
lint-lsp:
@cd cmd/raml-lsp && go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --timeout=5m -v ./...
# ---------------------------------------------------------------------------
# External plugins
# ---------------------------------------------------------------------------
.PHONY: build-plugin-vscode
build-plugin-vscode:
@echo "Building VS Code plugin"
@cd external/raml-lsp-vscode && npm ci && npm run webpack:prod
.PHONY: build-plugin-jetbrains
build-plugin-jetbrains:
@echo "Building JetBrains plugin"
@cd external/raml-lsp-jetbrains && ./gradlew buildPlugin