This repository was archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (42 loc) · 1.32 KB
/
Makefile
File metadata and controls
54 lines (42 loc) · 1.32 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
GO ?= go
GOROOT ?= $(shell $(GO) env GOROOT)
GOPATH ?= $(shell $(GO) env GOPATH)
GOBIN ?= $(GOPATH)/bin
GODEP ?= $(GOBIN)/dep
GOLINT ?= $(GOBIN)/golint
GOSEC ?= $(GOBIN)/gosec
SWAGGER ?= $(GOBIN)/swagger
MKCERT ?= $(GOBIN)/mkcert
COVERAGE_FILE ?= coverage.out
CSTBIN ?= cst
CST_CERTS_DIR ?= .certs
.PHONY: build get-dev-deps lint test test-with-coverage
generate-self-signed-certificate
security-check
validate-swagger-spec
build:
$(GO) build -o "$(CSTBIN)"
test: lint security-check test-with-coverage validate-swagger-spec
lint:
$(GOLINT) $(shell $(GO) list ./...)
security-check:
$(GOSEC) -severity medium ./...
test-with-coverage:
$(GO) test -v -cover -coverprofile=$(COVERAGE_FILE) ./...
grep -v "mock.go" $(COVERAGE_FILE) > coverage.txt
$(GO) tool cover -func=coverage.txt
rm $(COVERAGE_FILE)
validate-swagger-spec:
$(SWAGGER) validate swagger.yml
get-dev-deps:
$(GO) get -u github.com/golang/dep/cmd/dep
$(GO) get -u golang.org/x/lint/golint
$(GO) get -u github.com/securego/gosec/cmd/gosec
$(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger
$(GO) get -u github.com/FiloSottile/mkcert
generate-self-signed-certificate:
$(MKCERT) -install
mkdir -p $(CST_CERTS_DIR)
$(MKCERT) cst.local localhost 127.0.0.1 ::1
mv cst.local+*-key.pem $(CST_CERTS_DIR)/key.pem
mv cst.local+*.pem $(CST_CERTS_DIR)/cert.pem