2016-04-12 14:45:37 +00:00
|
|
|
.PHONY: all
|
2016-03-27 12:20:57 +00:00
|
|
|
|
|
|
|
VERSION=0.0.1
|
|
|
|
|
|
|
|
DEPS := $(wildcard *.go)
|
2016-04-11 09:18:53 +00:00
|
|
|
BUILD_IMAGE := "gopush-build"
|
|
|
|
TEST_IMAGE := "gopush-testing"
|
|
|
|
PRODUCTION_IMAGE := "gopush"
|
|
|
|
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-04-11 06:10:46 +00:00
|
|
|
test:
|
|
|
|
cd gopush && go test -v -covermode=count -coverprofile=coverage.out
|
|
|
|
|
2016-03-27 12:20:57 +00:00
|
|
|
docker_build: clean
|
2016-04-11 08:38:59 +00:00
|
|
|
tar -zcvf build.tar.gz gopush.go gopush
|
2016-04-11 06:10:46 +00:00
|
|
|
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
|
2016-04-11 08:38:59 +00:00
|
|
|
docker run --rm $(BUILD_IMAGE) > gopush.tar.gz
|
|
|
|
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 .
|
|
|
|
@docker run --rm -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "cd gopush && 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:
|
|
|
|
golint gopush
|
|
|
|
|
2016-03-27 12:20:57 +00:00
|
|
|
clean:
|
2016-04-11 08:38:59 +00:00
|
|
|
-rm -rf build.tar.gz gopush.tar.gz bin/*
|