forked from gojekfarm/iap_auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (36 loc) · 1.09 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
.PHONY: all
all: build fmt vet lint test
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
APP_EXECUTABLE="out/iap_auth"
COMMIT_HASH=$(shell git rev-parse --verify head | cut -c-1-8)
BUILD_DATE=$(shell date +%Y-%m-%dT%H:%M:%S%z)
setup:
go get -u github.com/golang/lint/golint
compile:
mkdir -p out/
go build -o $(APP_EXECUTABLE) -ldflags "-X main.Build=$(BUILD_DATE) -X main.Commit=$(COMMIT_HASH) -s -w"
build: compile fmt vet lint
install:
go install ./...
fmt:
go fmt ./...
vet:
go vet ./...
lint: ## lint checker
golangci-lint run
test: copy-config
go test -race $(shell go list ./... | grep -v /test/) -covermode=atomic -coverprofile=coverage.out
test-cover-html:
@echo "mode: count" > coverage-all.out
$(foreach pkg, $(ALL_PACKAGES),\
go test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out -o out/coverage.html
copy-config:
cp iap.conf.toml.sample iap.conf.toml
clean:
go clean && rm -rf ./vendor ./build
docker-up:
docker-compose up -d
start: docker-up compile
$(APP_EXECUTABLE) server