소스 검색

Run tests inside a container

Djordje Lukic 5 년 전
부모
커밋
cdff00d571
2개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      Dockerfile
  2. 4 0
      Makefile

+ 5 - 1
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

+ 4 - 0
Makefile

@@ -72,6 +72,10 @@ dxbins: dbins
 	--output type=local,dest=./bin \
 	--target xbins
 
+dtest:
+	docker build . \
+	--target make-test
+
 test:
 	gotestsum ./...