2016-04-12 14:45:37 +00:00
|
|
|
.PHONY: all
|
2016-03-27 12:20:57 +00:00
|
|
|
|
|
|
|
DEPS := $(wildcard *.go)
|
2016-04-13 07:22:04 +00:00
|
|
|
BUILD_IMAGE := "gorush-build"
|
|
|
|
TEST_IMAGE := "gorush-testing"
|
|
|
|
PRODUCTION_IMAGE := "gorush"
|
2016-04-11 09:18:53 +00:00
|
|
|
DEPLOY_ACCOUNT := "appleboy"
|
2016-03-27 12:20:57 +00:00
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
|
|
build: clean
|
2016-03-27 14:37:54 +00:00
|
|
|
sh script/build.sh
|
2016-03-27 12:20:57 +00:00
|
|
|
|
2016-05-03 01:42:53 +00:00
|
|
|
test: memory_test redis_test boltdb_test
|
2016-05-02 03:01:07 +00:00
|
|
|
cd gorush && go test -cover -v -coverprofile=coverage.out
|
|
|
|
|
2016-05-03 01:42:53 +00:00
|
|
|
memory_test:
|
|
|
|
cd gorush/storage/memory && go test -v -cover *.go
|
|
|
|
|
|
|
|
redis_test:
|
|
|
|
cd gorush/storage/redis && go test -v -cover *.go
|
|
|
|
|
|
|
|
boltdb_test:
|
|
|
|
cd gorush/storage/boltdb && go test -v -cover *.go
|
|
|
|
|
2016-05-02 03:01:07 +00:00
|
|
|
html: test
|
|
|
|
cd gorush && go tool cover -html=coverage.out
|
2016-04-11 06:10:46 +00:00
|
|
|
|
2016-03-27 12:20:57 +00:00
|
|
|
docker_build: clean
|
2016-04-13 07:22:04 +00:00
|
|
|
tar -zcvf build.tar.gz gorush.go gorush
|
2016-04-11 06:10:46 +00:00
|
|
|
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
|
2016-04-13 07:22:04 +00:00
|
|
|
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
|
2016-04-11 08:38:59 +00:00
|
|
|
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
2016-03-27 12:20:57 +00:00
|
|
|
|
2016-04-11 06:10:46 +00:00
|
|
|
docker_test:
|
|
|
|
@docker build --rm -t $(TEST_IMAGE) -f docker/Dockerfile.testing .
|
2016-04-13 07:22:04 +00:00
|
|
|
@docker run --rm -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "cd gorush && go test -v"
|
2016-04-10 03:36:49 +00:00
|
|
|
|
2016-04-11 09:18:53 +00:00
|
|
|
deploy:
|
|
|
|
ifeq ($(tag),)
|
|
|
|
@echo "Usage: make $@ tag=<tag>"
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
docker tag -f $(PRODUCTION_IMAGE):latest $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
|
|
|
docker push $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
|
|
|
|
2016-04-13 06:59:28 +00:00
|
|
|
lint:
|
2016-04-13 07:22:04 +00:00
|
|
|
golint gorush
|
2016-04-13 06:59:28 +00:00
|
|
|
|
2016-03-27 12:20:57 +00:00
|
|
|
clean:
|
2016-04-13 07:22:04 +00:00
|
|
|
-rm -rf build.tar.gz gorush.tar.gz bin/*
|