forked from hellofresh/goengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (48 loc) · 2.56 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
### --------------------------------------------------------------------------------------------------------------------
### Variables
### (https://www.gnu.org/software/make/manual/html_node/Using-Variables.html#Using-Variables)
### --------------------------------------------------------------------------------------------------------------------
BUILD_DIR ?= $(CURDIR)/out
POSTGRES_DSN ?= "postgres://goengine:goengine@localhost:8043/goengine?sslmode=disable&client_encoding=UTF8"
### --------------------------------------------------------------------------------------------------------------------
### RULES
### (https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction)
### --------------------------------------------------------------------------------------------------------------------
.PHONY: all
all: clean deps test
#-----------------------------------------------------------------------------------------------------------------------
# Housekeeping - Cleans our project: deletes binaries
#-----------------------------------------------------------------------------------------------------------------------
.PHONY: clean
clean:
$(call title, "Cleaning")
go clean -v
#-----------------------------------------------------------------------------------------------------------------------
# Dependencies
#-----------------------------------------------------------------------------------------------------------------------
.PHONY: deps
deps:
$(call title, "Installing dependencies")
go mod vendor
#-----------------------------------------------------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------------------------------------------------
.PHONY: test test-unit
test: test-unit test-examples
test-unit:
$(call title, "Running unit tests")
go test -tags=unit -race ./...
test-integration:
$(call title, "Running integration tests on ci")
POSTGRES_DSN=$(POSTGRES_DSN) go test -tags=integration -race ./...
test-examples:
$(call title, "Running examples")
go run -race example/aggregate/*.go
go run -race example/repository/*.go
###-----------------------------------------------------------------------------------------------------------------------
### Functions
### (https://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function)
###-----------------------------------------------------------------------------------------------------------------------
define title
@printf "\e[1m%s\e[0m\n" $(1)
endef