forked from rudderlabs/rudder-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (49 loc) · 2.47 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
58
59
60
61
62
63
64
65
66
67
68
69
.PHONY: help default build run run-dev test mocks prepare-build enterprise-init enterprise-cleanup enterprise-update-commit enterprise-prepare-build
GO=go
GINKGO=ginkgo
LDFLAGS?=-s -w
include .enterprise/env
default: build
mocks: install-tools ## Generate all mocks
$(GO) generate ./...
test: enterprise-prepare-build mocks ## Run all unit tests
ifdef package
$(GINKGO) -p --randomizeAllSpecs --randomizeSuites --failOnPending --cover -coverprofile=profile.out -covermode=atomic --trace --skipPackage=tests $(package)
else
$(GINKGO) -p --randomizeAllSpecs --randomizeSuites --failOnPending --cover -coverprofile=profile.out -covermode=atomic --trace --skipPackage=tests ./...
endif
build-sql-migrations: ./services/sql-migrator/migrations_vfsdata.go ## Prepare sql migrations embedded scripts
prepare-build: build-sql-migrations enterprise-prepare-build
./services/sql-migrator/migrations_vfsdata.go: $(shell find sql/migrations)
$(GO) run -tags=dev cmd/generate-migrations/generate-sql-migrations.go
build: prepare-build ## Build rudder-server binary
$(eval BUILD_OPTIONS = )
ifeq ($(RACE_ENABLED), TRUE)
$(eval BUILD_OPTIONS = $(BUILD_OPTIONS) -race -o rudder-server-with-race)
endif
$(GO) build $(BUILD_OPTIONS) -a -installsuffix cgo -ldflags="$(LDFLAGS)"
$(GO) build -o build/wait-for-go/wait-for-go build/wait-for-go/wait-for.go
run: prepare-build ## Run rudder-server using go run
$(GO) run main.go
run-dev: prepare-build ## Run rudder-server using go run with 'dev' build tag
$(GO) run -tags=dev main.go
help: ## Show the available commands
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Enterprise version
enterprise-init: ## Initialise enterprise version
@.enterprise/scripts/init.sh
enterprise-cleanup: ## Cleanup enterprise dependencies, revert to oss version
rm -rf ${ENTERPRISE_DIR}
rm -f ./imports/enterprise.go
enterprise-update-commit: ## Updates linked enterprise commit to current commit in ENTERPRISE_DIR
@.enterprise/scripts/update-commit.sh
enterprise-prepare-build: ## Create ./imports/enterprise.go, to link enterprise packages in binary
@if [ -d "./$(ENTERPRISE_DIR)" ]; then \
$(ENTERPRISE_DIR)/import.sh ./$(ENTERPRISE_DIR) | tee ./imports/enterprise.go; \
else \
rm -f ./imports/enterprise.go; \
fi
install-tools:
# Try install for go 1.16+, fallback to get
go install github.com/golang/mock/mockgen@v1.6.0 || \
GO111MODULE=on go get github.com/golang/mock/mockgen@v1.6.0