-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 894 Bytes
/
Makefile
File metadata and controls
40 lines (30 loc) · 894 Bytes
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
SHELL=bash
MAIN=dp-import-api
BUILD=build
BUILD_ARCH=$(BUILD)/$(GOOS)-$(GOARCH)
BIN_DIR?=.
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 "-w -s -X 'main.Version=${VERSION}' -X 'main.BuildTime=$(BUILD_TIME)' -X 'main.GitCommit=$(GIT_COMMIT)'"
export GOOS?=$(shell go env GOOS)
export GOARCH?=$(shell go env GOARCH)
.PHONY: all
all: audit test build
.PHONY: audit
audit:
dis-vulncheck
.PHONY: build
build:
@mkdir -p $(BUILD_ARCH)/$(BIN_DIR)
go build $(LDFLAGS) -o $(BUILD_ARCH)/$(BIN_DIR)/$(MAIN) cmd/$(MAIN)/main.go
.PHONY: debug
debug:
HUMAN_LOG=1 go run $(LDFLAGS) -race cmd/$(MAIN)/main.go
.PHONY: acceptance
acceptance:
MONGODB_DATABASE=test HUMAN_LOG=1 go run $(LDFLAGS) -race cmd/$(MAIN)/main.go
.PHONY: test
test:
go test -cover -race ./...
.PHONY: test build debug