From cdff00d571e5fcf3eceed71cc4395e046d994373 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Mon, 27 Apr 2020 10:17:10 +0200 Subject: [PATCH] Run tests inside a container --- Dockerfile | 6 +++++- Makefile | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a30b3538..bea06624 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ git \ protobuf-compiler \ libprotobuf-dev -RUN go get github.com/golang/protobuf/protoc-gen-go +RUN go get github.com/golang/protobuf/protoc-gen-go && \ + go get gotest.tools/gotestsum WORKDIR ${PWD} ADD go.* ${PWD} RUN go mod download @@ -25,6 +26,9 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ GOARCH=${TARGET_ARCH} \ make bins +FROM make-protos as make-test +RUN make test + FROM make-protos AS make-xbins RUN --mount=type=cache,target=/root/.cache/go-build \ make xbins diff --git a/Makefile b/Makefile index 4a693bc7..7286a142 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,10 @@ dxbins: dbins --output type=local,dest=./bin \ --target xbins +dtest: + docker build . \ + --target make-test + test: gotestsum ./...