-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
69 lines (52 loc) · 1.45 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
SHELL = bash -o pipefail
TEST_FLAGS ?= -p 1 -v
# MOD_VENDOR ?= -mod=vendor
PG_HOST ?= 127.0.0.1
PG_PASSWORD ?= postgres
PG_USER ?= postgres
PG_DATABASE ?= pgkit_test
all:
@echo "make <cmd>"
@echo ""
@echo "commands:"
@echo ""
@echo " + Development:"
@echo " - build"
@echo " - test"
@echo " - todo"
@echo " - clean"
@echo ""
@echo ""
@echo " + Database stuff:"
@echo " - db-reset"
@echo " - db-create"
@echo " - db-drop"
@echo ""
##
## Development
##
build:
go build ./...
clean:
go clean -cache -testcache
test: test-clean
GOGC=off go test $(TEST_FLAGS) $(MOD_VENDOR) -run=$(TEST) ./tests/...
test-all: test-clean
GOGC=off go test $(TEST_FLAGS) $(MOD_VENDOR) -run=$(TEST) ./...
test-all-tparse: test-clean
GOGC=off go test $(TEST_FLAGS) $(MOD_VENDOR) -run=$(TEST) ./... -json | tparse --follow
test-with-reset: db-reset test-all
test-with-reset-tparse: db-reset test-all-tparse
test-clean:
GOGC=off go clean -testcache
todo:
@git grep TODO -- './*' ':!./vendor/' ':!./Makefile' || :
##
## Database stuff
##
db-reset:
@env PGPASSWORD=$(PG_PASSWORD) PG_USER=$(PG_USER) PG_HOST=$(PG_HOST) ./tests/scripts/db.sh import $(PG_DATABASE) ./tests/testdata/pgkit_test_db.sql
db-create:
@env PGPASSWORD=$(PG_PASSWORD) PG_USER=$(PG_USER) ./tests/scripts/db.sh create $(PG_DATABASE)
db-drop:
@env PGPASSWORD=$(PG_PASSWORD) PG_USER=$(PG_USER) ./tests/scripts/db.sh drop $(PG_DATABASE)