diff --git a/.travis.yml b/.travis.yml index d7b59bb669d..8b6d2fe41d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ +dist: trusty language: go +go_import_path: github.com/coreos/etcd sudo: false go: @@ -6,6 +8,13 @@ go: - 1.6 - tip +env: + global: + - GO15VENDOREXPERIMENT=1 + matrix: + - TARGET=amd64 + - TARGET=arm64 + matrix: allow_failures: - go: tip @@ -17,9 +26,6 @@ addons: - libaspell-dev - libhunspell-dev -env: - - GO15VENDOREXPERIMENT=1 - before_install: - go get -v github.com/chzchzchz/goword - go get -v honnef.co/go/simple/cmd/gosimple @@ -30,4 +36,9 @@ install: - pushd cmd/ && go get -t -v ./... && popd script: - - ./test + - > + if [ "${TARGET}" == "amd64" ]; then + GOARCH="${TARGET}" ./test; + elif [ "${TARGET}" == "arm64" ]; then + GOARCH="${TARGET}" ./build; + fi diff --git a/build b/build index 9d6c3eb3e14..930fb0662f7 100755 --- a/build +++ b/build @@ -11,6 +11,14 @@ GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"` LINK_OPERATOR="=" +host_arch=$(GOARCH="" go env | egrep 'GOARCH=' | cut --delimiter='"' --field=2) + +if [ -z "${GOARCH}" ] || [ "${GOARCH}" = "${host_arch}" ]; then + out="bin" +else + out="bin/${GOARCH}" +fi + # Static compilation is useful when etcd is run in a container -CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA${LINK_OPERATOR}${GIT_SHA}" -o bin/etcd ${REPO_PATH}/cmd -CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s" -o bin/etcdctl ${REPO_PATH}/cmd/etcdctl +CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s -X ${REPO_PATH}/version.GitSHA${LINK_OPERATOR}${GIT_SHA}" -o ${out}/etcd ${REPO_PATH}/cmd +CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "-s" -o ${out}/etcdctl ${REPO_PATH}/cmd/etcdctl diff --git a/test b/test index 86d071907b3..b62204ce8dc 100755 --- a/test +++ b/test @@ -17,7 +17,7 @@ GOSIMPLE_UNUSED_PATHS=$(go list ./... | sed -e 's/github.com\/coreos\/etcd\///g' # Invoke ./cover for HTML output COVER=${COVER:-"-cover"} -GO_BUILD_FLAGS=-a +GO_BUILD_FLAGS="-a -v" source ./build # Set up gopath so tests use vendored dependencies