4
1
Fork 0
backend-core/Makefile

58 lines
1.2 KiB
Makefile
Raw Normal View History

# See https://git.makerforce.io/beep/best-practices/wiki/Makefile
#
# Programs
#
GOCMD?=go
GORUN?=$(GOCMD) run
GOBUILD?=$(GOCMD) build
GOCLEAN?=$(GOCMD) clean
GOTEST?=$(GOCMD) test
GOFMT_PROG?=gofmt
DOCKERCOMPOSE?=docker-compose
#
# Local
#
BINARY_NAME=core
2019-09-28 23:01:36 +08:00
#
# Files
#
DOCKERCOMPOSE_INTEGRATION_CONFIG?=docker-compose.integration.yml
2019-09-28 23:01:36 +08:00
#
# Tasks
#
2019-09-28 23:01:36 +08:00
# Let's do a quick unit test and then build backend-core
all: test_fmt test_unit build
2019-09-28 23:01:36 +08:00
build:
$(GOBUILD) -o $(BINARY_NAME) -v
test: test_fmt test_unit test_integration
2019-09-28 23:01:36 +08:00
2019-10-23 13:49:43 +08:00
test_fmt:
$(GOFMT_PROG) -l .
2019-09-28 23:01:36 +08:00
test_unit:
$(GOTEST) -tags=unit -v -cover
test_integration: test_integration_prepare
$(GOTEST) -tags=integration -v -cover
test_integration_prepare:
2019-11-03 20:54:30 +08:00
$(GORUN) scripts/testutils.go isrunning || ($(DOCKERCOMPOSE) -f $(DOCKERCOMPOSE_INTEGRATION_CONFIG) up -d && echo "$(shell tput bold)NOTE: Started some containers, cleanup with 'make test_integration_cleanup'$(shell tput sgr0)")
2019-09-28 23:01:36 +08:00
$(GORUN) scripts/testutils.go wait
test_integration_sql_shell:
$(DOCKERCOMPOSE) -f $(DOCKERCOMPOSE_INTEGRATION_CONFIG) exec pg psql -d core
2019-09-28 23:01:36 +08:00
test_integration_cleanup:
$(DOCKERCOMPOSE) -f $(DOCKERCOMPOSE_INTEGRATION_CONFIG) down
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)