This is an automated email from the ASF dual-hosted git repository. ocket8888 pushed a commit to branch dev-actions in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 4b9b0438067ea19fa4c396f321c59da2ddc6c6c5 Author: ocket8888 <[email protected]> AuthorDate: Fri Aug 2 11:41:01 2019 -0600 Added a GH action for running go tests --- .../traffic_ops/golang/Dockerfile | 13 ++++++------ test/traffic_ops/golang/README.md | 14 +++++++++++++ test/traffic_ops/golang/entrypoint.sh | 23 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/traffic_ops/app/bin/tests/Dockerfile-golangtest b/test/traffic_ops/golang/Dockerfile similarity index 64% rename from traffic_ops/app/bin/tests/Dockerfile-golangtest rename to test/traffic_ops/golang/Dockerfile index 8b4a925..153deb2 100644 --- a/traffic_ops/app/bin/tests/Dockerfile-golangtest +++ b/test/traffic_ops/golang/Dockerfile @@ -13,13 +13,12 @@ # FROM golang:1.11 MAINTAINER [email protected] -ARG DIR=github.com/apache/trafficcontrol -ADD traffic_ops /go/src/$DIR/traffic_ops -ADD lib /go/src/$DIR/lib +# ADD traffic_ops /go/src/github.com/apache/trafficcontrol/traffic_ops +# ADD lib /go/src/github.com/apache/trafficcontrol/lib +# WORKDIR /go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang -WORKDIR /go/src/$DIR/traffic_ops/traffic_ops_golang +ADD entrypoint.sh / -CMD bash -c 'go get -v && go test -cover -v ./... ../../lib/go-tc/...' -# -# vi:syntax=Dockerfile +# CMD bash -c 'go get -v && go test -cover -v ./... ../../lib/go-tc/...' +ENTRYPOINT ["/entrypoint.sh"] diff --git a/test/traffic_ops/golang/README.md b/test/traffic_ops/golang/README.md new file mode 100644 index 0000000..9f81ae5 --- /dev/null +++ b/test/traffic_ops/golang/README.md @@ -0,0 +1,14 @@ +<!-- Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + +# Traffic Ops Go Tests +This Dockerfile is responsible for importing the repository's Traffic Ops Go code and running unit tests and coverage tests. diff --git a/test/traffic_ops/golang/entrypoint.sh b/test/traffic_ops/golang/entrypoint.sh new file mode 100644 index 0000000..46309b0 --- /dev/null +++ b/test/traffic_ops/golang/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +pushd traffic_ops/traffic_ops_golang + +if [ ! $(go get -v) ]; then + echo "Failed to get dependencies; bailing" >&2 + exit 1 +fi + +if [ ! $(go test -cover -v ./...)]; then + echo "TO tests failed" >&2 + exit 1 +fi + +popd +pushd lib/go-tc + +if [ ! $(go test -cover -v ../../)]; then + echo "Library tests failed" >&2 + exit 1 +fi + +popd
