Merge pull request #41 from appleboy/testing2

#10 support testing in docker.
This commit is contained in:
Bo-Yi Wu 2016-04-11 01:28:09 -05:00
commit a568ed98c7
3 changed files with 22 additions and 9 deletions

View File

@ -3,22 +3,27 @@
VERSION=0.0.1
DEPS := $(wildcard *.go)
BUILD_IMAGE := "gopush-build"
BUILD_IMAGE := "appleboy/gopush-build:latest"
TEST_IMAGE := "appleboy/gopush-testing:latest"
all: build
build: clean
sh script/build.sh
docker_build: clean
tar -zcvf build.tar.gz gopush.go gopush script
docker build -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
docker run $(BUILD_IMAGE) > bin.tar.gz
tar -zxvf bin.tar.gz
-rm -rf bin.tar.gz build.tar.gz
test:
cd gopush && go test -v -covermode=count -coverprofile=coverage.out
docker_build: clean
tar -zcvf build.tar.gz gopush.go gopush script
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
docker run --rm $(BUILD_IMAGE) > bin.tar.gz
tar -zxvf bin.tar.gz
-rm -rf bin.tar.gz build.tar.gz
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"
clean:
rm -rf build.tar.gz bin.tar.gz bin/*

View File

@ -5,7 +5,7 @@ MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
RUN mkdir -p /tmp/build
Add build.tar.gz /tmp/build/
WORKDIR /tmp/build
RUN go get -d
RUN go get -v -d
RUN sh script/build.sh
CMD tar -czf - bin

View File

@ -0,0 +1,8 @@
FROM golang:1.6
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
RUN mkdir -p /tmp/build
Add . /tmp/build/
WORKDIR /tmp/build
RUN go get -v -d -t ./...