forked from didiladi/dynatrace-monitoring-as-code
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (49 loc) · 1.23 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
BINARY=monaco
.PHONY: lint format mocks build install clean test integration-test test-package default add-license-headers
default: build
lint:
ifeq ($(OS),Windows_NT)
@.\tools\check-format.cmd
else
@go get github.com/google/addlicense
@sh ./tools/check-format.sh
@sh ./tools/check-license-headers.sh
endif
format:
@gofmt -w .
add-license-headers:
ifeq ($(OS),Windows_NT)
@echo "This is currently not supported on windows"
@exit 1
else
@sh ./tools/add-missing-license-headers.sh
endif
mocks:
@go get github.com/golang/mock/mockgen
@go generate ./...
build: clean lint
@echo Build ${BINARY}
@go build ./...
@go build -o ./bin/${BINARY} ./cmd/monaco
install: clean lint
@echo Install ${BINARY}
@go install ./...
clean:
@echo Remove ${BINARY} and bin/
ifeq ($(OS),Windows_NT)
@if exist ${BINARY} del /Q ${BINARY}
@if exist bin rd /S /Q bin
else
@rm -f ${BINARY}
@rm -rf bin/
endif
test: mocks build
@go test -tags=unit -v ./...
integration-test: build
@go test -tags=cleanup -v ./...
@go test -tags=integration -v ./...
# Build and Test a single package supplied via pgk variable, without using test cache
# Run as e.g. make test-package pkg=project
pkg=...
test-package: mocks build
@go test -tags=unit -count=1 -v ./pkg/${pkg}