-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (31 loc) · 1.05 KB
/
Makefile
File metadata and controls
42 lines (31 loc) · 1.05 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
PROJECT_DIR = $(shell pwd)
PROJECT_BIN = $(PROJECT_DIR)/bin
GOLANGCI_LINT = $(PROJECT_BIN)/golangci-lint
.PHONY: .install-linter
.install-linter:
### INSTALL GOLANGCI-LINT ###
[ -f $(PROJECT_BIN)/golangci-lint ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_BIN) v1.50.1
.PHONY: lint
lint: .install-linter
### RUN GOLANGCI-LINT ###
$(GOLANGCI_LINT) run ./... --config=./.golangci.yml
.PHONY: lint-fast
lint-fast: .install-linter
$(GOLANGCI_LINT) run ./... --fast --config=./.golangci.yml
TESTS_WD = $(PROJECT_DIR)/tests
# === Test ===
.PHONY: test
test:
mkdir -p $(TESTS_WD)
go test -v --timeout=5m --covermode=count --coverprofile=$(TESTS_WD)/profile.cov_tmp ./...
cat $(TESTS_WD)/profile.cov_tmp > $(TESTS_WD)/profile.cov
.PHONY: test-coverage
test-coverage: test
go tool cover --func=$(TESTS_WD)/profile.cov
.PHONY: test-coverage-html
test-coverage-html: test
go tool cover --html=$(TESTS_WD)/profile.cov
# === Build ===
.PHONY: build
build:
go build -o $(PROJECT_BIN)/dp-cli ./cmd/