forked from aquasecurity/starboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (49 loc) · 1.56 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
SOURCES := $(shell find . -name '*.go')
BINARY := starboard
GOPATH=$(shell go env GOPATH)
GOBIN=$(GOPATH)/bin
build: $(BINARY)
.PHONY: get-ginkgo
## get-ginkgo Installs Ginkgo CLI.
get-ginkgo:
go install github.com/onsi/ginkgo/ginkgo
.PHONY: get-qtc
## get-qtc Installs quicktemplate compiler.
get-qtc:
go install github.com/valyala/quicktemplate/qtc
.PHONY: compile-templates
## compile-templates Converts quicktemplate files (*.qtpl) into Go code.
compile-templates: get-qtc
$(GOBIN)/qtc
$(BINARY): $(SOURCES)
CGO_ENABLED=0 go build -o ./bin/$(BINARY) ./cmd/starboard/main.go
.PHONY: test
## test will run both unit tests and integration tests
test: unit-tests integration-tests
.PHONY: unit-tests
## unit-tests Runs unit tests with codecov enabled.
unit-tests: $(SOURCES)
go test -v -short -race -timeout 30s -coverprofile=coverage.txt ./...
.PHONY: integration-tests
## integration-tests Runs integration tests with codecov enabled.
integration-tests: check-env get-ginkgo
$(GOBIN)/ginkgo \
--progress \
--v \
-coverprofile=coverage.txt \
-coverpkg=github.com/aquasecurity/starboard/pkg/cmd,\
github.com/aquasecurity/starboard/pkg/kube \
github.com/aquasecurity/starboard/pkg/kubebench \
github.com/aquasecurity/starboard/pkg/kubehunter \
github.com/aquasecurity/starboard/pkg/polaris \
github.com/aquasecurity/starboard/pkg/find/vulnerabilities/trivy \
github.com/aquasecurity/starboard/pkg/find/vulnerabilities/crd \
./itest
check-env:
ifndef KUBECONFIG
$(error Environment variable KUBECONFIG is not set)
endif
.PHONY: clean
clean:
rm -r ./bin
rm -r ./dist