-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (44 loc) · 1.12 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
# Set variables
APP_NAME := teredix
GOOS := linux
GOARCH := amd64
BUILD_DIR := build
DIST_DIR := dist
# Set flags
LDFLAGS := -w -s
GCFLAGS := -trimpath=$(GOPATH) -installsuffix netgo
# Set commands
GO := go
GOBUILD := CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build
GOCLEAN := $(GO) clean
GOTEST := $(GO) test
GOMOD := $(GO) mod
MKDIR := mkdir -p
CP := cp
RM := rm -rf
.PHONY: all build clean test mod vendor dist
all: clean build test
build:
$(MKDIR) $(BUILD_DIR)
$(GOBUILD) -gcflags="$(GCFLAGS)" -ldflags="$(LDFLAGS)" -o $@
clean:
$(GOCLEAN)
$(RM) $(BUILD_DIR)
$(RM) $(DIST_DIR)
test:
$(GOTEST) ./...
test-unit:
$(GOTEST) ./... -coverprofile=coverage_unit.out
test-integration:
$(GOTEST) -tags integration -cover ./... -coverprofile=coverage_integration.out
mod:
$(GOMOD) download
vendor:
$(GOMOD) vendor
dist: clean build
$(MKDIR) $(DIST_DIR)
$(CP) $(BUILD_DIR)/$(APP_NAME) $(DIST_DIR)/$(APP_NAME)
validate_json_schema: clean build
$(MKDIR) $(DIST_DIR)
$(BUILD_DIR)/$(APP_NAME) validate --config ./cmd/testdata/valid_config.yaml
$(BUILD_DIR)/$(APP_NAME) validate --config ./pkg/config/testdata/valid_config.yaml