travis: Enable arm64 builds

Setup a travis test matrix on a new variable 'TARGET', which specifies the CI
target.  Update the script section with a conditional that runs the needed
commands for each target.

Also, set go_import_path to make cloned repos work, enable the trusty VM, and
enable verbose builds when testing.

Signed-off-by: Geoff Levand <geoff@infradead.org>
release-3.0
Geoff Levand 2016-04-29 14:54:40 -07:00
parent 00d6f104b5
commit b79bb6f164
3 changed files with 26 additions and 7 deletions

View File

@ -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

12
build
View File

@ -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

2
test
View File

@ -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