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-04 01:29:36 +00:00
test : redis_test boltdb_test memory_test config_test
2016-05-04 02:53:17 +00:00
go test -v -cover -covermode= count -coverprofile= coverage.out ./gorush/...
2016-05-03 01:42:53 +00:00
redis_test :
2016-05-04 02:53:17 +00:00
go test -v -cover -covermode= count -coverprofile= coverage.out ./storage/redis/...
2016-05-03 01:42:53 +00:00
boltdb_test :
2016-05-04 02:53:17 +00:00
go test -v -cover -covermode= count -coverprofile= coverage.out ./storage/boltdb/...
2016-05-04 01:29:36 +00:00
memory_test :
2016-05-04 02:53:17 +00:00
go test -v -cover -covermode= count -coverprofile= coverage.out ./storage/memory/...
2016-05-04 01:29:36 +00:00
config_test :
2016-05-04 02:53:17 +00:00
go test -v -cover -covermode= count -coverprofile= coverage.out ./config/...
2016-05-03 01:42:53 +00:00
2016-05-04 01:29:36 +00:00
html :
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-05-03 12:39:24 +00:00
@docker run --name gorush-redis -d redis
@docker run --rm --link gorush-redis:redis -e ANDROID_TEST_TOKEN = $( ANDROID_TEST_TOKEN) -e ANDROID_API_KEY = $( ANDROID_API_KEY) $( TEST_IMAGE) sh -c "cd gorush && go test -v"
@docker rm -f gorush-redis
2016-04-10 03:36:49 +00:00
2016-04-11 09:18:53 +00:00
deploy :
i f e q ( $( tag ) , )
@echo " Usage: make $@ tag=<tag> "
@exit 1
e n d i f
docker tag -f $( PRODUCTION_IMAGE) :latest $( DEPLOY_ACCOUNT) /$( PRODUCTION_IMAGE) :$( tag)
docker push $( DEPLOY_ACCOUNT) /$( PRODUCTION_IMAGE) :$( tag)
2016-05-04 03:05:44 +00:00
bundle :
glide install
bundle_update :
glide update --all-dependencies --resolve-current
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/*