-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
31 lines (22 loc) · 1018 Bytes
/
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
BIN_NAME := binlog-parser
GOCC := env GOPATH=$(CURDIR)/_vendor:$(CURDIR) go
SRC_DIR := zalora/binlog-parser/...
TEST_DB_NAME := test_db
TEST_DB_SCHEMA_FILE := data/fixtures/test_db.sql
all:
env CGO_ENABLED=0 $(GOCC) install -ldflags '-s' $(SRC_DIR)
deps:
git submodule update --init
test: unit-test integration-test
unit-test:
$(info ************ UNIT TESTS ************)
env TZ="UTC" env DATA_DIR=$(CURDIR)/data $(GOCC) test -tags=unit -cover $(SRC_DIR)
integration-test: integration-test-setup
$(info ************ INTEGRATION TESTS ************)
env TEST_DB_DSN="root@/$(TEST_DB_NAME)" env TZ="UTC" env DATA_DIR=$(CURDIR)/data $(GOCC) test -tags=integration -cover $(SRC_DIR)
integration-test-setup:
mysql -uroot -e 'DROP DATABASE IF EXISTS $(TEST_DB_NAME)'
mysql -uroot < $(TEST_DB_SCHEMA_FILE)
integration-test-schema-dump:
mysqldump --no-data -uroot -B $(TEST_DB_NAME) > $(TEST_DB_SCHEMA_FILE)
.PHONY: all deps test unit-test integration-test-setup integration-test integration-test-schema-dump