-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 910 Bytes
/
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
BINPATH ?= build
BUILD_TIME=$(shell date +%s)
GIT_COMMIT=$(shell git rev-parse HEAD)
VERSION ?= $(shell git tag --points-at HEAD | grep ^v | head -n 1)
LDFLAGS = -ldflags "-X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)"
.PHONY: all
all: audit test build
.PHONY: audit
audit:
go list -json -m all | nancy sleuth
.PHONY: lint
lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
golangci-lint run ./...
.PHONY: build
build:
go build -tags 'production' $(LDFLAGS) -o $(BINPATH)/dp-feedback-api
.PHONY: debug
debug:
go build -tags 'debug' $(LDFLAGS) -o $(BINPATH)/dp-feedback-api
HUMAN_LOG=1 DEBUG=1 $(BINPATH)/dp-feedback-api
.PHONY: test
test:
go test -race -cover ./...
.PHONY: convey
convey:
goconvey ./...
.PHONY: test-component
test-component:
go test -cover -coverpkg=github.com/ONSdigital/dp-feedback-api/... -component