ソースを参照

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>
Geoff Levand 9 年 前
コミット
b79bb6f164
3 ファイル変更26 行追加7 行削除
  1. 15 4
      .travis.yml
  2. 10 2
      build
  3. 1 1
      test

+ 15 - 4
.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

+ 10 - 2
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

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