#10 support testing in docker.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
430a64e536
commit
5f93c9f861
21
Makefile
21
Makefile
|
@ -3,22 +3,27 @@
|
||||||
VERSION=0.0.1
|
VERSION=0.0.1
|
||||||
|
|
||||||
DEPS := $(wildcard *.go)
|
DEPS := $(wildcard *.go)
|
||||||
BUILD_IMAGE := "gopush-build"
|
BUILD_IMAGE := "appleboy/gopush-build:latest"
|
||||||
|
TEST_IMAGE := "appleboy/gopush-testing:latest"
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
sh script/build.sh
|
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:
|
test:
|
||||||
cd gopush && go test -v -covermode=count -coverprofile=coverage.out
|
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:
|
clean:
|
||||||
rm -rf build.tar.gz bin.tar.gz bin/*
|
rm -rf build.tar.gz bin.tar.gz bin/*
|
||||||
|
|
|
@ -5,7 +5,7 @@ MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
RUN mkdir -p /tmp/build
|
RUN mkdir -p /tmp/build
|
||||||
Add build.tar.gz /tmp/build/
|
Add build.tar.gz /tmp/build/
|
||||||
WORKDIR /tmp/build
|
WORKDIR /tmp/build
|
||||||
RUN go get -d
|
RUN go get -v -d
|
||||||
RUN sh script/build.sh
|
RUN sh script/build.sh
|
||||||
|
|
||||||
CMD tar -czf - bin
|
CMD tar -czf - bin
|
||||||
|
|
|
@ -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 ./...
|
Loading…
Reference in New Issue